Skip to content

feat: implement TCK workflow and SUT for tests, adjust ci#517

Draft
JakubWorek wants to merge 5 commits into
epic/1.0_breaking_changesfrom
jakubworek/enable-tck
Draft

feat: implement TCK workflow and SUT for tests, adjust ci#517
JakubWorek wants to merge 5 commits into
epic/1.0_breaking_changesfrom
jakubworek/enable-tck

Conversation

@JakubWorek

Copy link
Copy Markdown
Collaborator

Description

Replaces the experimental TCK SUT/workflow from bgralewicz/enable_tck_tests with a working setup across all three transports (JSON-RPC, REST/HTTP+JSON, gRPC) on a2a-tck 1.0.0.alpha2, and lands the SDK fixes that the conformance suite exposed.

TCK harness and its consequences:

  • tck/agent/index.ts — rewritten as a messageId-prefix-routed SUT executor matching the canonical Gherkin scenarios (scenarios/core_operations.feature, scenarios/streaming.feature) and the reference Python SUT (a2a-tck/sut/a2a-python/sut_agent.py). Serves the agent card at /.well-known/agent-card.json, JSON-RPC at /, REST at /a2a/rest, and gRPC on a separate port — all three declared in supportedInterfaces so the conformance suite probes all bindings against the same agent.
  • .github/workflows/run-tck.yaml — pinned to TCK release 1.0.0.alpha2; runs both MUST and SHOULD; uploads compatibility reports as artifacts; triggers on main and epic/**.
  • SDK fixes driven by TCK failures

Closes #491 🦕

@JakubWorek JakubWorek requested a review from a team as a code owner June 15, 2026 16:19

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors error mapping, content-type handling, and task lifecycle management to align with the A2A specification. Specifically, capability-gated rejections now map to UNIMPLEMENTED instead of FAILED_PRECONDITION, REST responses default to application/json, and content-type guards are introduced to reject unsupported media types. Additionally, the event bus is kept alive during interrupted task states (INPUT_REQUIRED and AUTH_REQUIRED) to support resubscription, and the TCK agent is updated to handle various test scenarios. Feedback on these changes highlights a potential memory leak in trackLatestTaskState where registered event listeners are never removed from the event bus when a task is interrupted, and suggests cleaning them up in the returned thunk.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread src/server/request_handler/default_request_handler.ts
@github-actions

github-actions Bot commented Jun 15, 2026

Copy link
Copy Markdown

🧪 Code Coverage

⬇️ Download Full Report

Base PR Delta
src/server/events/execution_event_queue.ts 94.33% 94.44% 🟢 +0.11%
src/server/express/json_rpc_handler.ts 95.61% 89.61% 🔴 -6.00%
src/server/express/rest_handler.ts 88.42% 86.84% 🔴 -1.58%
src/server/grpc/grpc_service.ts 81.12% 81.02% 🔴 -0.10%
src/server/request_handler/default_request_handler.ts 82.07% 82.69% 🟢 +0.62%
src/server/transports/rest/rest_transport_handler.ts 98.98% 98.99% 🟢 +0.01%
src/server/utils.ts 85.96% 86.88% 🟢 +0.92%
Total 90.54% 90.44% 🔴 -0.10%

Generated by coverage-comment.yml

@JakubWorek JakubWorek linked an issue Jun 15, 2026 that may be closed by this pull request
Comment thread src/server/request_handler/default_request_handler.ts Outdated
Comment thread src/server/request_handler/default_request_handler.ts Outdated
Comment thread src/errors.ts Outdated
Comment thread src/server/express/rest_handler.ts
Comment on lines -74 to +75
if (error instanceof ContentTypeNotSupportedError) return HTTP_STATUS.BAD_REQUEST;
if (error instanceof ContentTypeNotSupportedError) return HTTP_STATUS.UNSUPPORTED_MEDIA_TYPE;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to spec 5.4, ContentTypeNotSupportedError should map to 400 (Bad Request).

Comment thread src/errors.ts

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These changes does not align with the spec 5.4.

Can you cite some TCK specification that requires such change? Or is there any other source of truth for that?

@JakubWorek JakubWorek marked this pull request as draft June 16, 2026 11:50
JakubWorek added a commit that referenced this pull request Jun 16, 2026
…EST requests, and update event loop termination logic for interrupted states, update ci pipelines for itk (#519)

# Description

This pull request introduces several important improvements to request
handling, event streaming, and content type validation in the server
codebase. The main focus is on correctly handling interrupted
(non-terminal) task states, enforcing strict content type requirements
for JSON-RPC and REST endpoints, and improving the robustness of
server-sent event (SSE) streaming error handling. These changes enhance
protocol compliance (especially with the A2A specification), prevent
subtle bugs, and improve client-facing error reporting.

**Task execution and event bus management:**

- Introduced `INTERRUPTED_STATE_LIST` to distinguish non-terminal task
states (such as `INPUT_REQUIRED` and `AUTH_REQUIRED`) that pause
execution but keep the task and event bus alive for follow-up actions.
The event bus is now only closed for truly terminal states, allowing
clients to resubscribe or continue tasks as specified in the A2A
protocol (§3.4.3).
- Added a `trackLatestTaskState` utility to reliably track the most
recent task state on the event bus, ensuring correct bus lifecycle
management even when consumer processing lags behind event publishing.

**Content type enforcement for API endpoints:**

- Added middleware to strictly enforce `application/json` for JSON-RPC
endpoints and either `application/json` or `application/a2a+json` for
REST endpoints. Requests with unsupported content types now return a
`ContentTypeNotSupportedError` mapped to HTTP 400, improving protocol
compliance and error clarity.

**Streaming and error handling improvements:**

- Improved SSE streaming in JSON-RPC: the first event is now "peeked"
before sending SSE headers, ensuring that errors occurring before the
stream starts are returned as proper JSON-RPC error responses (with the
correct HTTP status and format), rather than as misleading SSE error
events.
- Updated tests to assert that pre-stream errors result in JSON-RPC
error responses instead of SSE error streams, aligning with the improved
error handling logic.

**Workflow trigger refinement:**

- Updated GitHub workflow triggers to match all branches under `epic/**`
rather than just `epic`, ensuring workflows run for all relevant feature
branches.

Part of changes from #517
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

chore(compat): Enable TCK

2 participants