Repository navigation
fix(server): send push notifications for terminal states the SDK writes - #1394
Draft
mykytanetipa wants to merge 1 commit into
Draft
mykytanetipa wants to merge 1 commit into
mykytanetipa wants to merge 1 commit into
Conversation
Push notifications were only sent for events emitted by the agent. Three terminal states are written by the SDK itself, and none were pushed: - FAILED after an executor raises (EventConsumer._write_failed_status). - CANCELED when a cancel closes out a task the agent did not finish, e.g. one waiting for input (ActiveTask.cancel). - CANCELED written by a replica that is not running the task (DefaultRequestHandlerV2._write_cancel). A push-only client never learned that such a task had ended. Each of these writes now sends a push through one best-effort helper, which the consumer also uses for agent events.
🧪 Code Coverage (vs
|
| Base | PR | Delta | |
|---|---|---|---|
| src/a2a/server/agent_execution/active_task.py | 95.91% | 95.80% | 🔴 -0.12% |
| src/a2a/server/cluster/database_event_stream.py | 96.94% | 92.86% | 🔴 -4.08% |
| src/a2a/server/events/event_queue_v2.py | 92.27% | 91.79% | 🔴 -0.48% |
| src/a2a/server/request_handlers/default_request_handler_v2.py | 88.54% | 88.57% | 🟢 +0.03% |
| src/a2a/utils/telemetry.py | 91.47% | 90.70% | 🔴 -0.78% |
| Total | 93.24% | 93.18% | 🔴 -0.06% |
Generated by coverage-comment.yml
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Push notifications were only sent for events emitted by the agent, so terminal states written by the SDK itself never reached a push-only client. Found while working on #1324.
Example:
sequenceDiagram participant C as Client participant A as Replica A (runs agent) participant B as Replica B participant S as Shared store C->>A: SendMessage(T, push config) alt agent raises A->>S: save FAILED else client cancels through B C->>B: CancelTask(T) B->>S: save CANCELED else cancel of a task waiting for input C->>A: CancelTask(T) A->>S: save CANCELED end Note over C: no push in any case, T has ended but the client is never toldFix: these three writes now send a push through the same best-effort helper the consumer uses for agent events. A push sender that raises is logged and does not affect the write. In the example the client receives FAILED or CANCELED as soon as it is recorded.
Tested: handler and multi-replica tests for each of the three writes and for a raising push sender; full suite passes.