feat: Send current task as the first event after subscribing to it#418
Conversation
…bgralewicz/enable_itk_tests
…bgralewicz/use_stream_response_as_push_notif_payload
…bgralewicz/use_stream_response_as_push_notif_payload
…tEventStream to StreamResponse.
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
🧪 Code Coverage
Generated by coverage-comment.yml |
There was a problem hiding this comment.
Code Review
This pull request refactors the resubscribe method to prevent race conditions by initializing the event queue before loading the task, and adds validation to prevent resubscribing to tasks in terminal states. It also updates push notification handling to a fire-and-forget pattern and expands test coverage. Review feedback suggests replacing a risky non-null assertion with optional chaining and removing a redundant Promise.resolve wrapper.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request refactors the resubscribe method in DefaultRequestHandler to eliminate a race condition by attaching to the event bus before loading the task from the store. It also updates the logic to throw an UnsupportedOperationError for tasks in terminal states and includes new unit tests for various resubscription scenarios. Feedback suggests that the console.warn for non-terminal tasks without an active event bus may be unnecessary as this is a valid state.
🤖 I have created a release *beep* *boop* --- ## 1.0.0-alpha.0 (2026-05-11) See the [v0.3 -> v1.0-alpha.0 migration guide](https://github.com/a2aproject/a2a-js/blob/v1.0.0-alpha.0/docs/migration-guide.md). **Note**: Enabling backward compatibility with v0.3 is tracked in [#452](#452). ### ⚠ BREAKING CHANGES * Drop support for node 18 ([#368](#368)) * Make ServerCallContext parameter mandatory across all places ([#405](#405)) * Remove JSON-RPC client ([#353](#353)) * Remove transport-specific exports ([#404](#404)) * Update codebase to use A2A 1.0.0 data model ([#375](#375)) * Remove A2AExpressApp ([#363](#363)) ### Features * Add A2A Version Header ([#422](#422)) ([b5f3db7](b5f3db7)) * Add cache-headers logic to the agent card handler ([#435](#435)) ([955b52b](955b52b)) * Add resource scoping ([#450](#450)) ([c527086](c527086)) * Add support for custom authentication scheme and credentials in auth-headers ([#430](#430)) ([5a4389b](5a4389b)) * AgentCardSignature support ([#448](#448)) ([4a41a8c](4a41a8c)) * Enforce events ordering ([#437](#437)) ([157cf48](157cf48)) * Enriched Error Model ([#427](#427)) ([c130778](c130778)) * Implement listTasks method ([#383](#383)) ([7d4c472](7d4c472)) * Send current task as the first event after subscribing to it ([#418](#418)) ([4bfcf5f](4bfcf5f)) * Support multi-tenancy ([#419](#419)) ([1877877](1877877)) ### Code Refactoring * remove A2AExpressApp ([#363](#363)) ([0b84728](0b84728)) --- 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: bartek-gralewicz <bgralewicz@google.com> Co-authored-by: Ivan Shymko <ishymko@google.com>
Description
Sending a
Taskobject as the first event after subscribing to it.Additionally, throwing an
UnsupportedOperationErrorerror if aTaskin terminal state was used for subscribing. This behavior is aligned with spec requirements: https://a2a-protocol.org/latest/specification/#1046-subscribetotaskFixes #323 🦕