Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
14 commits
Select commit Hold shift + click to select a range
0ca968b
CCOR-13193 - run integration tests against Conductor OSS, and fix two…
chrishagglund-ship-it Nov 19, 2026
b3dab81
fix(examples): healthcheck hello-world Conductor with wget, always pull
chrishagglund-ship-it Nov 19, 2026
0c61f4f
ci: cache Gradle dependencies in build, integration and agent-e2e jobs
chrishagglund-ship-it Nov 19, 2026
d45fb54
Revert "ci: cache Gradle dependencies in build, integration and agent…
chrishagglund-ship-it Nov 19, 2026
af99e4d
fix(sdk): fail a monitored workflow only after 1 minute of failed polls
chrishagglund-ship-it Nov 19, 2026
f6ca46c
test(oss): run tests that only failed on OSS because of the tests the…
chrishagglund-ship-it Nov 19, 2026
c19f0bb
chore(scripts): save OSS container logs to a file instead of dumping …
chrishagglund-ship-it Nov 19, 2026
ae3cd10
ci: move OSS integration tests to their own pull_request workflow
chrishagglund-ship-it Nov 23, 2026
134fd6c
fix(sdk): keep TaskClient metrics listeners when a task runner shuts …
chrishagglund-ship-it Nov 23, 2026
d80268c
fix(compose): healthcheck Conductor with wget or curl
chrishagglund-ship-it Nov 23, 2026
ab244d1
test(oss): gate Orkes-only tests with @DisabledOnOss
chrishagglund-ship-it Nov 23, 2026
26ab01b
chore(scripts): default the OSS integration stack to Conductor 3.34.0
chrishagglund-ship-it Nov 23, 2026
ce963b9
test(sdk): wait on recorded ack failures instead of verify(timeout, a…
chrishagglund-ship-it Nov 23, 2026
e047940
test: search tasks by workflowId on Orkes, by workflowType only on OSS
chrishagglund-ship-it Nov 23, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
127 changes: 127 additions & 0 deletions .github/workflows/integration-tests-oss.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
name: Java Client Integration Tests (OSS)

# Runs the integration suite against a local, disposable Conductor OSS stack
# (scripts/docker-compose-oss.yaml) instead of the Orkes deployment that
# integration-tests.yml targets. Orkes-Enterprise-only tests skip themselves via
# @DisabledOnOss, which checks CONDUCTOR_SERVER_TYPE=oss.
# scripts/run-integration-oss.sh runs the same suite locally.
#
# This is a plain pull_request workflow, like the OSS jobs in the other SDK repos,
# rather than a job in integration-tests.yml: that file is triggered by workflow_run,
# which runs PR code with the base repo's write-scoped token. Here a fork PR gets a
# read-only token, and GITHUB_SHA is the PR's commit, so the test report lands on
# the PR.
on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:
inputs:
oss_conductor_version:
description: 'OSS Conductor image tag (falls back to the E2E_TEST_OSS_CONDUCTOR_VERSION org var, then to the default in scripts/docker-compose-oss.yaml on fork PRs)'
required: false
type: string

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true

jobs:
integration-tests-oss:
runs-on: ubuntu-latest
name: Integration Tests (OSS)
timeout-minutes: 30

permissions:
contents: read # minimal read access
checks: write # needed for the test report check run

env:
CONDUCTOR_SERVER_URL: http://localhost:8080/api
CONDUCTOR_SERVER_TYPE: oss
IS_FORK_PR: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository }}

steps:
# OSS_CONDUCTOR_VERSION is resolved here rather than in the job `env` so
# that the two ways it can come back empty get different treatment:
#
# - Fork PR: GitHub withholds org/repo variables from pull_request runs
# on forks exactly as it withholds secrets, so vars.* is always "" for
# an outside contributor (observed in csharp-sdk#178). This job needs
# no secrets, only a tag, so leave the var unset and let the default
# baked into the `image:` line of scripts/docker-compose-oss.yaml
# apply. That is the same tag a plain local run of
# scripts/run-integration-oss.sh gets, and the one place it is
# written -- no second copy to drift out of sync here.
# - Anything else: the org variable is genuinely missing or its
# repository access policy no longer covers this repo. Fail loudly
# rather than silently drifting onto the default.
- name: Resolve OSS Conductor version
env:
REQUESTED_VERSION: ${{ inputs.oss_conductor_version || vars.E2E_TEST_OSS_CONDUCTOR_VERSION }}
run: |
if [ -n "$REQUESTED_VERSION" ]; then
echo "OSS_CONDUCTOR_VERSION=${REQUESTED_VERSION}" >> "$GITHUB_ENV"
elif [ "$IS_FORK_PR" = "true" ]; then
echo "::notice::Fork PR: org variables are withheld, falling back to the default tag in scripts/docker-compose-oss.yaml"
else
echo "::error::No Conductor OSS image tag resolved. Set the E2E_TEST_OSS_CONDUCTOR_VERSION organization variable (and ensure its repository access policy includes this repo), or pass the oss_conductor_version input via workflow_dispatch."
exit 1
fi

- name: Checkout
uses: actions/checkout@v6
with:
# The build below runs PR code; don't leave the token in .git/config for it.
persist-credentials: false

- name: Set up Zulu JDK 21
uses: actions/setup-java@v5
with:
distribution: "zulu"
java-version: "21"

# `docker compose up` only pulls an image when it is missing locally. On a
# GitHub-hosted runner the VM is ephemeral and starts with no cached copy
# of this image, so `up` would pull anyway and this step is redundant
# today. It is here deliberately: it costs no extra network pull (`up`
# then finds the image locally), it separates "couldn't pull the image"
# from "the stack didn't come up" into two distinct red steps, and it is
# what keeps a mutable tag from going stale if this job ever moves to a
# self-hosted runner with a warm Docker daemon -- the same reason
# scripts/run-integration-oss.sh pulls. It also prints the tag actually in
# use, which for a fork PR comes from the compose file's default.
- name: Pull Conductor OSS image
run: |
echo "Using $(docker compose -f scripts/docker-compose-oss.yaml config --images | grep -m1 '^conductoross/conductor:')"
docker compose -f scripts/docker-compose-oss.yaml pull conductor-server

- name: Start Conductor OSS stack
run: docker compose -f scripts/docker-compose-oss.yaml up -d

- name: Wait for Conductor to be healthy
# Matches HEALTH_TIMEOUT in scripts/run-integration-oss.sh, and stays under the compose
# healthcheck's own ~200s budget.
run: timeout 180 bash -c 'until curl -sf http://localhost:8080/health; do sleep 5; done'

- name: Run integration tests (OSS)
run: ./gradlew :tests:test -PIntegrationTests

- name: Dump Conductor logs
if: failure()
run: docker compose -f scripts/docker-compose-oss.yaml logs conductor-server

- name: Publish Test Report
if: always()
uses: mikepenz/action-junit-report@v6
with:
report_paths: 'tests/build/test-results/test/TEST-*.xml'
# Distinct from integration-tests.yml's report and ci.yml's unit report. The action
# defaults every caller to 'JUnit Test Report', so they would overwrite each other.
check_name: OSS Integration Test Report
# A fork PR's token is read-only and cannot create a check run; report through
# annotations and the job summary instead.
annotate_only: ${{ env.IS_FORK_PR == 'true' }}
44 changes: 44 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,50 @@ Run the SDK test suite:
./gradlew test jacocoTestReport
```

### Running the OSS integration suite locally

The `tests` module also has an integration suite (`-PIntegrationTests`) that runs against a
real Conductor server, separate from the unit suite above. `scripts/run-integration-oss.sh`
mirrors the `.github/workflows/integration-tests-oss.yml` workflow: it starts a local Conductor OSS +
Postgres stack (defined in `scripts/docker-compose-oss.yaml`), waits for `/health`, runs the
integration suite, and tears the stack down on exit.

```shell
scripts/run-integration-oss.sh # against the default tag in scripts/docker-compose-oss.yaml
scripts/run-integration-oss.sh --version 3.32.0-rc18
scripts/run-integration-oss.sh --keep-up # leave the stack running afterwards
scripts/run-integration-oss.sh --include-gated # also run tests normally skipped as Orkes-only
```

The script always prints the resolved `conductoross/conductor` tag and pulls it before
starting the stack, since a tag can be re-pushed (an rc, or `latest` via `--version latest`) —
without an explicit pull, `docker compose up` would silently reuse a stale cached image
instead of fetching the current one. It also always runs Gradle with `--rerun-tasks`, since the `test`
task's up-to-date check doesn't account for env vars like `CONDUCTOR_SERVER_TYPE` or the
state of the live server underneath — without it, a rerun after changing gating or switching
server versions could silently report a stale cached result instead of executing anything.

The script doesn't pin a JDK itself, but CI runs on Zulu 21. If your local default JDK is
newer (e.g. 23) you may hit `Unsupported class file major version` errors compiling tests —
set `JAVA_HOME` explicitly to match CI:

```shell
JAVA_HOME=/Library/Java/JavaVirtualMachines/zulu-21.jdk/Contents/Home ./scripts/run-integration-oss.sh
```

Tests annotated `@DisabledOnOss("<reason>")` skip themselves when `CONDUCTOR_SERVER_TYPE=oss`,
because they exercise Orkes-managed-only features that plain OSS lacks (e.g. the Service Registry, Authorization, Prompts/Integrations, Environment Variables, and
Secrets APIs, plus a handful of task/workflow endpoints OSS doesn't implement, and OSS gaps
with an open issue, such as start-workflow idempotency keys). Each annotation's
reason documents the specific, empirically-confirmed gap — treat those as the source
of truth rather than a list here, since they can drift as OSS gains features. If you add or
remove that annotation, re-verify against a freshly-pulled image first: a test that fails
against a stale local image may pass against current OSS, and vice versa.

Before gating a test, check that it doesn't depend on something only the shared Orkes cluster
provides, such as workers already polling a task type or prior execution history. Those tests
can usually be fixed to pass on both servers instead.

Compile the maintained agent examples when changing their APIs or documentation:

```shell
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,11 @@ public void shutdown() {
}
}
scheduledExecutorService.shutdown();
// Only this configurer's own dispatcher. The TaskClient is the caller's and may outlive
// this configurer (AnnotatedWorkerExecutor reuses it for the next runner), so its
// listeners are left in place.
if (metricsCollector != null) {
ListenerRegister.unregister(metricsCollector, eventDispatcher);
taskClient.unregisterListeners();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,9 @@ public void registerTaskRunnerListener(TaskRunnerEventsListener listener) {

/**
* Detaches the auto-wired {@link MetricsCollector} (if any) from this
* client's dispatchers. Called during shutdown to release the entries from
* {@link ListenerRegister}'s static registry.
* client's dispatchers, after which this client emits no metrics events.
* The dispatchers belong to this instance, so this is not needed to free
* them; call it only to stop metrics on a client that stays in use.
*/
public void unregisterListeners() {
if (metricsCollector != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CompletableFuture;
Expand Down Expand Up @@ -80,6 +81,19 @@ public class WorkflowExecutor {
private final Map<String, CompletableFuture<Workflow>> runningWorkflowFutures =
new ConcurrentHashMap<>();

/**
* How long a workflow's polls must keep failing before the monitor stops tracking it and fails
* its future. Long enough for a server restart or failover to pass without failing workflows
* that are still running.
*/
static final long DEFAULT_POLL_FAILURE_TIMEOUT_MILLIS = TimeUnit.MINUTES.toMillis(1);

private volatile long pollFailureTimeoutMillis = DEFAULT_POLL_FAILURE_TIMEOUT_MILLIS;

// When each workflow's current run of failed polls started, in System.nanoTime() units.
// Only accessed from the single monitor thread.
private final Map<String, Long> pollFailingSinceNanos = new HashMap<>();

private final ObjectMapper objectMapper = new ObjectMapperProvider().getObjectMapper();

private final TaskClient taskClient;
Expand Down Expand Up @@ -174,10 +188,37 @@ private void initMonitor() {
for (Map.Entry<String, CompletableFuture<Workflow>> entry : runningWorkflowFutures.entrySet()) {
String workflowId = entry.getKey();
CompletableFuture<Workflow> future = entry.getValue();
Workflow workflow = workflowClient.getWorkflow(workflowId, true);
if (workflow.getStatus().isTerminal()) {
future.complete(workflow);
try {
Workflow workflow = workflowClient.getWorkflow(workflowId, true);
pollFailingSinceNanos.remove(workflowId);
if (workflow.getStatus().isTerminal()) {
future.complete(workflow);
runningWorkflowFutures.remove(workflowId);
}
} catch (Exception e) {
// scheduleAtFixedRate silently kills all future ticks on any uncaught
// exception, so this must not escape: one failed poll would otherwise
// stop completion tracking for every workflow, forever.
long now = System.nanoTime();
Long failingSince = pollFailingSinceNanos.putIfAbsent(workflowId, now);
if (failingSince == null) {
LOGGER.warn("Error polling workflow {} for completion; will retry for up "
+ "to {} ms: {}", workflowId, pollFailureTimeoutMillis, e.getMessage());
continue;
}
long failingForMillis = TimeUnit.NANOSECONDS.toMillis(now - failingSince);
if (failingForMillis < pollFailureTimeoutMillis) {
// Already warned for this run of failures; at the polling interval a
// WARN per tick would flood the log during an outage.
LOGGER.debug("Still failing to poll workflow {} for completion ({} ms so "
+ "far): {}", workflowId, failingForMillis, e.getMessage());
continue;
}
LOGGER.error("Polling workflow {} for completion has failed for {} ms; "
+ "completing its future exceptionally", workflowId, failingForMillis, e);
pollFailingSinceNanos.remove(workflowId);
runningWorkflowFutures.remove(workflowId);
future.completeExceptionally(e);
}
}
},
Expand All @@ -186,6 +227,11 @@ private void initMonitor() {
TimeUnit.MILLISECONDS);
}

// Lets tests shorten the timeout instead of waiting out the default.
void setPollFailureTimeoutMillis(long pollFailureTimeoutMillis) {
this.pollFailureTimeoutMillis = pollFailureTimeoutMillis;
}

public void initWorkers(String... packagesToScan) {
annotatedWorkerExecutor.initWorkers(packagesToScan);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,12 @@ public class AnnotatedWorkerExecutor {

private final Set<String> scannedPackages = new HashSet<>();

/**
* Set whenever a worker is added, cleared whenever {@link #startPolling()} builds a task runner.
* Lets startPolling() distinguish a real (re)start from a redundant duplicate call.
*/
private boolean workersChanged = false;

private final WorkerConfiguration workerConfiguration;

public AnnotatedWorkerExecutor(TaskClient taskClient) {
Expand All @@ -77,6 +83,9 @@ public AnnotatedWorkerExecutor(TaskClient taskClient, WorkerConfiguration worker
*/
public synchronized void initWorkers(String... basePackages) {
scanWorkers(basePackages);
// scanWorkers() -> initWorkersFromClasses() -> initWorkersFromInstances() already reaches
// startPolling(). This second call is therefore redundant, but startPolling() is idempotent
// while the worker set is unchanged, so it is a no-op rather than a task runner restart.
startPolling();
}

Expand Down Expand Up @@ -109,10 +118,18 @@ public synchronized void initWorkersFromClasses(List<? extends Class<?>> classes
}


/** Shuts down the workers */
public void shutdown() {
/**
* Shuts down the workers.
*
* <p>Clears the task runner as well as shutting it down, so a later {@link #startPolling()}
* builds a fresh one and resumes. A {@link TaskRunnerConfigurer} is single-use — its
* shutdown closes the executor backing it — so leaving the field set would make
* startPolling() take its already-polling fast path and never poll again.
*/
public synchronized void shutdown() {
if (taskRunner != null) {
taskRunner.shutdown();
taskRunner = null;
Comment thread
propp-orkes marked this conversation as resolved.
Resolved
}
}

Expand Down Expand Up @@ -168,7 +185,15 @@ private boolean classBelongsToPackage(List<String> packagesToScan, String classN
return false;
}

public void addBean(Object bean) {
/**
* Registers every {@link WorkerTask}-annotated method on the bean as a worker.
*
* <p>Synchronized because it is the public entry point that mutates the worker set and the
* {@code workersChanged} flag {@link #startPolling()} reads to decide whether a restart is
* needed. Without a common lock, a worker added on another thread could be missed and never
* polled.
*/
public synchronized void addBean(Object bean) {
Class<?> clazz = bean.getClass();
for (Method method : clazz.getMethods()) {
WorkerTask annotation = method.getAnnotation(WorkerTask.class);
Expand Down Expand Up @@ -222,6 +247,7 @@ private void addMethod(WorkerTask annotation, Method method, Object bean) {
for (int i = 0; i < pollerCount; i++) {
workers.add(executor);
}
workersChanged = true;

LOGGER.info(
"Adding worker for task {}, method {} with threadCount {} and polling interval set to {} ms",
Expand All @@ -231,11 +257,28 @@ private void addMethod(WorkerTask annotation, Method method, Object bean) {
pollingInterval);
}

public void startPolling() {
/**
* Builds a {@link TaskRunnerConfigurer} over the currently registered workers and starts polling.
*
* <p>Idempotent: if a task runner is already polling and no worker has been added since it was
* built, this returns without doing anything. Restarting unnecessarily would stand up a second
* runner polling the same task types and only shut the first one down afterwards, so a task
* already leased by the outgoing runner could be left in-progress until its response timeout
* expired. Callers that add workers and call this again still get the intended restart.
*/
public synchronized void startPolling() {
if (workers.isEmpty()) {
return;
}

if (taskRunner != null && !workersChanged) {
LOGGER.debug(
"Task runner is already polling {} workers and the worker set is unchanged; "
+ "skipping redundant restart.",
workers.size());
return;
}

LOGGER.info("Starting {} with threadCount {}", workers.stream().map(Worker::getTaskDefName).toList(), workerToThreadCount);
LOGGER.info("Worker domains {}", workerDomains);
LOGGER.info("Worker workerToPollTimeout (in millis) {}", workerToPollTimeout);
Expand All @@ -253,6 +296,8 @@ public void startPolling() {
taskRunner = builder.build();
taskRunner.init();

workersChanged = false;

oldTaskRunner.ifPresent(taskRunner -> {
LOGGER.trace("Shutting down previous task runner with {} workers.", taskRunner.getWorkerCount());
taskRunner.shutdown();
Expand Down
Loading
Loading