Skip to content

fix(server): send push notifications for terminal states the SDK writes - #1394

Draft
mykytanetipa wants to merge 1 commit into
multiserver/fix-resumed-turn-single-savefrom
multiserver/fix-push-for-sdk-writes
Draft

mykytanetipa wants to merge 1 commit into
multiserver/fix-resumed-turn-single-savefrom
multiserver/fix-push-for-sdk-writes

Conversation

@mykytanetipa

Copy link
Copy Markdown
Collaborator

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 told
Loading

Fix: 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.

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.
@mykytanetipa
mykytanetipa added this pull request to stack #1393 October 27, 2026 12:57
@github-actions

Copy link
Copy Markdown

🧪 Code Coverage (vs multiserver/fix-resumed-turn-single-save)

⬇️ Download Full Report

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

No deployments
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.

1 participant