Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
7 changes: 4 additions & 3 deletions .github/workflows/run-tck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ on:

env:
# Tag/branch of the TCK
TCK_VERSION: 1.0.0.alpha3
#TCK_VERSION: 1.0.0.alpha3
TCK_VERSION: main
TCK_VERSION_0_3: 0.3.0.beta6
# Tells uv to not need a venv, and instead use system
UV_SYSTEM_PYTHON: 1
Expand Down Expand Up @@ -93,10 +94,10 @@ jobs:
done
- name: Run TCK
id: run-tck
timeout-minutes: 5
timeout-minutes: 10
run: |
set -o pipefail
uv run ./run_tck.py --sut-host ${{ env.SUT_URL }} -v 2>&1 | tee tck-output.log
./run_tck.py --sut-host ${{ env.SUT_URL }} -v 2>&1 | tee tck-output.log
working-directory: a2a-tck
- name: TCK Summary
if: always() && steps.run-tck.outcome != 'skipped'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ public interface MediaType {
/** MIME type for JSON content: {@code application/json}. */
String APPLICATION_JSON = "application/json";

/** MIME type accepted from HTTP+JSON clients alongside {@code application/json}: {@code application/a2a+json}. */
/** MIME type for A2A HTTP+JSON content: {@code application/a2a+json}. */
String APPLICATION_A2A_JSON = "application/a2a+json";
}
Original file line number Diff line number Diff line change
Expand Up @@ -1968,14 +1968,14 @@ public void testMainQueueStaysOpenForNonFinalTasks() throws Exception {
* 2. Task reaches COMPLETED state (final)
* 3. ChildQueue closes after receiving final event
* 4. MainQueue should close because task is finalized
* 5. Resubscription should fail with TaskNotFoundError
* 5. Resubscription should fail with UnsupportedOperationError
*/
@Test
@Timeout(value = 2, unit = TimeUnit.MINUTES)
public void testMainQueueClosesForFinalizedTasks() throws Exception {
// Send a message without taskId - server generates one
Message_v0_3 message = new Message_v0_3.Builder(MESSAGE)
.parts(new TextPart_v0_3("complete task"))
.parts(new TextPart_v0_3("queue-finalization:complete task"))
.build();

CountDownLatch completionLatch = new CountDownLatch(1);
Expand All @@ -1989,10 +1989,6 @@ public void testMainQueueClosesForFinalizedTasks() throws Exception {
if (te.getTask().status().state().isFinal()) {
completionLatch.countDown();
}
} else if (event instanceof MessageEvent_v0_3 me) {
// Message is considered a final event - capture taskId from the message
generatedTaskId.compareAndSet(null, me.getMessage().taskId());
completionLatch.countDown();
} else if (event instanceof TaskUpdateEvent_v0_3 tue &&
tue.getUpdateEvent() instanceof TaskStatusUpdateEvent_v0_3 status) {
generatedTaskId.compareAndSet(null, status.taskId());
Expand Down Expand Up @@ -2020,8 +2016,8 @@ public void testMainQueueClosesForFinalizedTasks() throws Exception {
String taskId = generatedTaskId.get();
assertNotNull(taskId, "Should have captured server-generated taskId");

// Give cleanup time to run after final event
Thread.sleep(2000);
assertTrue(waitForChildQueueCountToBe(taskId, -1, 15000),
"MainQueue should close after the task reaches a final state");

// Try to resubscribe to finalized task - should fail
CountDownLatch errorLatch = new CountDownLatch(1);
Expand Down Expand Up @@ -2051,24 +2047,24 @@ public void testMainQueueClosesForFinalizedTasks() throws Exception {
Throwable error = resubErrorRef.get();
assertNotNull(error, "Resubscription should fail for finalized task");

// Verify it's a TaskNotFoundError
// Verify it's an UnsupportedOperationError
Throwable cause = error;
boolean foundTaskNotFound = false;
while (cause != null && !foundTaskNotFound) {
if (cause instanceof TaskNotFoundError_v0_3 ||
boolean foundUnsupportedOperation = false;
while (cause != null && !foundUnsupportedOperation) {
if (cause instanceof UnsupportedOperationError_v0_3 ||
(cause instanceof A2AClientException_v0_3 &&
((A2AClientException_v0_3) cause).getCause() instanceof TaskNotFoundError_v0_3)) {
foundTaskNotFound = true;
((A2AClientException_v0_3) cause).getCause() instanceof UnsupportedOperationError_v0_3)) {
foundUnsupportedOperation = true;
}
cause = cause.getCause();
}
assertTrue(foundTaskNotFound,
"Should receive TaskNotFoundError - MainQueue closed for finalized task");
assertTrue(foundUnsupportedOperation,
"Should receive UnsupportedOperationError - finalized task rejects resubscription");

} catch (A2AClientException_v0_3 e) {
// Exception might be thrown immediately instead of via error handler
assertInstanceOf(TaskNotFoundError_v0_3.class, e.getCause(),
"Should fail with TaskNotFoundError - MainQueue cleaned up for finalized task");
assertInstanceOf(UnsupportedOperationError_v0_3.class, e.getCause(),
"Should fail with UnsupportedOperationError - finalized task rejects resubscription");
}

} finally {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ public void execute(RequestContext context, AgentEmitter agentEmitter) throws A2
return;
}

if (input.startsWith("queue-finalization:")) {
agentEmitter.startWork();
agentEmitter.complete();
return;
}

// Local handling: creates a task with startWork() + addArtifact() + complete()
if (input.startsWith("a2a-local:")) {
String payload = input.substring("a2a-local:".length());
Expand Down
3 changes: 1 addition & 2 deletions itk/run_itk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
# Everything that used to live here (runtime detection, image build, container
# start, readiness poll, POST /run, result reporting, nightly metrics) is now
# in a2a-itk/scripts/run_itk_shared.sh, which all five SDK repos share —
# including the podman fallback this repo needs, which is why the shared
# driver has it.
# including support for Docker and Podman.
#
# Scenarios come from the shared role-based set in a2a-itk rather than a
# scenarios.json in this repo — see a2a-itk/scenarios/traversal/.
Expand Down
164 changes: 164 additions & 0 deletions itk/run_itk_local.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
#!/usr/bin/env bash
# Local, debug-friendly entry point for the A2A ITK and ACTS suites.
#
# This delegates to run_itk.sh, the same launcher used in CI, while retaining
# its result files and (by default) enabling the ITK service's DEBUG logs under
# itk/logs/.
set -euo pipefail

script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
revision=${A2A_ITK_REVISION:-main}
acts_run=${ITK_ACTS_RUN:-0}
transports=${ITK_ACTS_TRANSPORTS:-jsonrpc,grpc,rest}
log_level=${ITK_LOG_LEVEL:-DEBUG}
scenario_file=${SCENARIO_FILE:-}
disable_selinux_labels=false

usage() {
cat <<'EOF'
Usage: ./run_itk_local.sh [options]

Run the Java SDK's local interoperability suite through the same launcher CI
uses. The default is the shared ITK PR scenario set with DEBUG service logs.

Options:
--acts Run ACTS conformance tests instead of ITK traversal tests.
--transports LIST ACTS transports (comma-separated; default: jsonrpc,grpc,rest).
--scenario FILE Run an explicit ITK scenario YAML or JSON file (ITK only).
--revision REF a2a-itk revision to use (default: main).
--timeout SECONDS Maximum time for the ITK /run request.
--container-runtime NAME Use docker or podman (default: first working runtime).
--info Use INFO instead of DEBUG logging.
--selinux-mount-labels Relabel bind mounts with :Z (default for Podman;
changes labels on the checkout, cache, and logs).
--disable-selinux-labels Let a local Podman container read the bind mount
without SELinux container labels. Use only for a
local debugging run when a mounted file is denied.
-h, --help Show this help.

Useful output after a run:
raw_results.json ITK traversal response
acts-report-*.json ACTS conformance reports
./summarize_results.sh Readable summary of ACTS conformance reports
logs/ Service logs (when DEBUG logging is enabled)

Examples:
./itk/run_itk_local.sh
./itk/run_itk_local.sh --scenario /tmp/failing-scenario.yaml
./itk/run_itk_local.sh --acts --transports jsonrpc
./itk/summarize_results.sh
EOF
}

absolute_file() {
local file=$1
if [[ ! -f $file ]]; then
echo "Scenario file does not exist: $file" >&2
exit 2
fi
cd "$(dirname "$file")" && printf '%s/%s\n' "$PWD" "$(basename "$file")"
}

while (($#)); do
case $1 in
--acts)
acts_run=1
;;
--transports)
[[ $# -ge 2 ]] || { echo "--transports requires a value" >&2; exit 2; }
transports=$2
shift
;;
--scenario)
[[ $# -ge 2 ]] || { echo "--scenario requires a file" >&2; exit 2; }
scenario_file=$(absolute_file "$2")
shift
;;
--revision)
[[ $# -ge 2 ]] || { echo "--revision requires a ref" >&2; exit 2; }
revision=$2
shift
;;
--timeout)
[[ $# -ge 2 && $2 =~ ^[1-9][0-9]*$ ]] || {
echo "--timeout requires a positive number of seconds" >&2
exit 2
}
export ITK_RUN_TIMEOUT=$2
shift
;;
--info)
log_level=INFO
;;
--container-runtime)
[[ $# -ge 2 && ( $2 == docker || $2 == podman ) ]] || {
echo "--container-runtime requires docker or podman" >&2
exit 2
}
export ITK_CONTAINER_RT=$2
shift
;;
--selinux-mount-labels)
export ITK_SELINUX_MOUNT_LABEL=1
;;
--disable-selinux-labels)
disable_selinux_labels=true
;;
-h|--help)
usage
exit 0
;;
*)
echo "Unknown option: $1" >&2
usage >&2
exit 2
;;
esac
shift
done

if [[ -z ${ITK_CONTAINER_RT:-} ]]; then
for runtime in docker podman; do
if command -v "$runtime" >/dev/null 2>&1 && "$runtime" info >/dev/null 2>&1; then
export ITK_CONTAINER_RT=$runtime
break
fi
done
if [[ -z ${ITK_CONTAINER_RT:-} ]]; then
echo "No working Docker or Podman runtime found; check that it is running and accessible." >&2
exit 1
fi
fi

# Podman on an SELinux-enforcing host cannot access ordinary bind mounts
# without a container label. The shared driver applies :Z to all its mounts.
# Honor an explicit environment setting or the opt-out below.
if [[ $ITK_CONTAINER_RT == podman && -z ${ITK_SELINUX_MOUNT_LABEL+x} ]] && ! $disable_selinux_labels; then
export ITK_SELINUX_MOUNT_LABEL=1
fi

export A2A_ITK_REVISION=$revision
export ITK_ACTS_RUN=$acts_run
export ITK_ACTS_TRANSPORTS=$transports
export ITK_LOG_LEVEL=$log_level
if [[ -n $scenario_file ]]; then
export SCENARIO_FILE=$scenario_file
fi

# The shared driver deliberately accepts this as an array. Source its shim
# below so that the optional argument survives; Bash cannot export arrays to a
# child process. `label=disable` avoids altering the checkout's labels, unlike
# a :z/:Z bind-mount suffix, and is only enabled on explicit request.
if $disable_selinux_labels; then
export ITK_SELINUX_MOUNT_LABEL=0
ITK_EXTRA_DOCKER_ARGS=(--security-opt label=disable)
fi

cd "$script_dir"
if [[ $acts_run == 1 || ${acts_run^^} == TRUE ]]; then
suite=ACTS
else
suite=ITK
fi
echo "Running $suite with $ITK_CONTAINER_RT and a2a-itk revision '$A2A_ITK_REVISION' (logs: $ITK_LOG_LEVEL)"
source ./run_itk.sh
8 changes: 8 additions & 0 deletions itk/src/main/java/org/a2aproject/sdk/itk/ActsBehaviors.java
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,14 @@ void run(RequestContext context, AgentEmitter emitter, String behavior) {
return;
}

// A multi-turn task is intentionally interrupted at the end of each turn. Emitting a
// transient WORKING update first makes a blocking send_message response race with the
// following INPUT_REQUIRED update, so return the requested state directly.
if ("tck-multi-turn".equals(behavior)) {
multiTurn(context, emitter);
return;
}

// Persists WORKING before anything blocks, so a concurrent cancel_task finds a non-final
// task in the store and a blocking send_message is released by the first event.
emitter.startWork();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public AgentCard agentCard() {
.version("1.0.0")
.supportedInterfaces(interfaces)
.capabilities(capabilities())
.defaultInputModes(List.of("text"))
.defaultInputModes(List.of("text", "application/x-protobuf"))
.defaultOutputModes(List.of("text"))
.skills(List.of(AgentSkill.builder()
.id("itk_current")
Expand Down
Loading
Loading