fix(server): yield Task snapshot on resubscribe when bus is inactive - #542
Conversation
There was a problem hiding this comment.
Code Review
This pull request updates the resubscribe behavior in DefaultRequestHandler to comply with spec §3.1.6. Instead of throwing an UnsupportedOperationError when no active event bus exists, the handler now yields the current Task snapshot first and then closes the stream cleanly. This allows clients to reconnect to long-running tasks after server restarts or executor pauses. The PR also updates existing tests and introduces a comprehensive new test suite to verify this behavior across various scenarios, including terminal tasks, unknown tasks, and active event buses. There are no review comments, so I have no feedback to provide.
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.
🧪 Code CoverageNo coverage changes. Generated by coverage-comment.yml |
7891838 to
307883a
Compare
🤖 I have created a release *beep* *boop* --- ## [1.0.0-beta.0](v1.0.0-alpha.0...v1.0.0-beta.0) (2026-07-01) The v0.3 backward-compatibility layer is now complete, marking this release as the first one bringing v1.0 and v0.3 support together. Backward compatibility with v0.3 was implemented across all three transports (JSON-RPC, REST, gRPC), agent-card resolution, and push notifications — closing [#452](#452). A v1.0 server can transparently accept v0.3 clients (and a v1.0 client can talk to v0.3 servers) by opting in with `legacyCompat: { enabled: true }` on the relevant transport. See the [v0.3 → v1.0 migration guide](https://github.com/a2aproject/a2a-js/blob/v1.0.0-beta.0/docs/migration-guide.md) and the [end-user v0.3 compatibility guide](https://github.com/a2aproject/a2a-js/blob/v1.0.0-beta.0/docs/compatibility-v0_3.md). ### Features * add compat-v1 client and server samples to demonstrate A2A v0.3 backward compatibility ([#520](#520)) ([fce0b3f](fce0b3f)) * add opt-in legacy v0.3 compatibility to JSON-RPC handler and improve extension header support ([#501](#501)) ([f707350](f707350)) * add v0.3 compatibility layer for client and server agent-card handling ([#504](#504)) ([75685f2](75685f2)) * add v0.3 gRPC compat layer ([#505](#505)) ([314d9e3](314d9e3)) * default to v0.3 if version not provided ([#511](#511)) ([ad7f772](ad7f772)) * defined compat-specific consts and mappings ([#478](#478)) ([db0c595](db0c595)) * implement legacy v0.3 JSON-RPC transport handler ([#493](#493)) ([d191d91](d191d91)) * implement legacy v0.3 REST support with compatible transport handler and middleware routing ([#495](#495)) ([da9a968](da9a968)) * implement v0.3 ITK cross-SDK validation workflows ([#513](#513)) ([c9385f3](c9385f3)) * implement v0.3 JSON-RPC client transport ([#499](#499)) ([46aa5d6](46aa5d6)) * implement v0.3 protocol compatibility for RestTransportFactory ([#503](#503)) ([b172482](b172482)) * implement versioned push notification serializers with legacy v0.3 compatibility support ([#507](#507)) ([0261be8](0261be8)) * normalize extension headers based on negotiated protocol version ([#510](#510)) ([74a51ee](74a51ee)) * replace automatic v0.3 agent card synthesis with explicit per-interface advertisement ([#560](#560)) ([60ad3b2](60ad3b2)) ### Bug Fixes * **compat:** wrap primitive Part.data values instead of throwing ([#537](#537)) ([7647db5](7647db5)) * **server/rest:** handle undefined historyLength to return full task history ([#527](#527)) ([fa9ebce](fa9ebce)), closes [#535](#535) * **server:** handle AUTH_REQUIRED lifecycle per spec ([#523](#523)) ([68826c2](68826c2)) * **server:** make cancelTask idempotent on the canceled state ([#545](#545)) ([1d17a78](1d17a78)) * **server:** make push notification config id optional with server-side UUID ([#543](#543)) ([83af8c3](83af8c3)) * **server:** merge Task history in ResultManager instead of overwriting ([#524](#524)) ([4e1d4f7](4e1d4f7)), closes [#532](#532) * **server:** preserve activated extensions in response header ([#544](#544)) ([26184b4](26184b4)) * **server:** propagate return to SSE generators to prevent listener leaks ([#526](#526)) ([a690734](a690734)), closes [#534](#534) * **server:** synthesize correct error Task id in blocking and streaming paths ([#525](#525)) ([a3dd703](a3dd703)), closes [#533](#533) * **server:** yield Task snapshot on resubscribe when bus is inactive ([#542](#542)) ([cd8f8fc](cd8f8fc)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --------- Co-authored-by: JakubWorek <worekkuba@gmail.com>
Description
What
When
resubscribeis called on a non-terminal task with no active event bus,yield the Task snapshot from store and close the stream — instead of throwing
UnsupportedOperationError.Why
Spec §3.1.6 mandates a Task snapshot as the first event. Throwing on an
inactive bus made long-running task reconnection impossible (after server
restart, executor pause, or INPUT_REQUIRED bus-sleep).
Terminal-state and task-not-found cases still throw per §3.1.6 errors list.
Fixes #540 🦕