Skip to content

fix(server): resubscribe a paused task from the shared stream - #1327

Open
SashaMIT wants to merge 1 commit into
a2aproject:mainfrom
SashaMIT:fix/paused-task-resubscribe
Open

SashaMIT wants to merge 1 commit into
a2aproject:mainfrom
SashaMIT:fix/paused-task-resubscribe

Conversation

@SashaMIT

@SashaMIT SashaMIT commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #1323.

A replica that finished an interrupted turn keeps the task in its registry. SubscribeToTask treated that entry as the live producer, yielded the cached snapshot, and closed. The turn running on another replica was on the shared stream.

The local tap now stays only while this replica holds the request lock. A parked entry follows the snapshot already read from the store and tails the shared stream. A turn that is executing here is still tapped locally. Single-process mode, where there is no shared stream, is unchanged.

The caller is resubscribing to their own task. The store already has the current snapshot. The parked registry entry was the stale one.

Restoring if local is not None makes test_paused_replica_resubscribe_follows_the_shared_stream time out on the parked tap. The in-flight test still receives the local task and leaves the shared stream untapped.

Test plan

  • pytest tests/server/request_handlers/test_default_request_handler_v2.py -k 'paused_replica or in_flight_replica'
  • pytest tests/server/request_handlers/test_default_request_handler_v2.py -k subscribe_to_task
  • Restoring the unguarded local tap times out the paused test

A replica that finished an interrupted turn keeps the task registered. Tapping that entry returned the old snapshot and never saw the turn running elsewhere. The local tap now stays for a turn this replica is executing.
@SashaMIT
SashaMIT requested a review from a team as a code owner October 9, 2026 06:43
@github-actions

github-actions Bot commented Oct 9, 2026

Copy link
Copy Markdown

🧪 Code Coverage (vs main)

⬇️ Download Full Report

Base PR Delta
src/a2a/server/agent_execution/active_task.py 95.02% 94.83% 🔴 -0.19%
src/a2a/server/request_handlers/default_request_handler_v2.py 87.46% 90.09% 🟢 +2.62%
Total 93.10% 93.18% 🟢 +0.08%

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.

[Bug]: Cluster mode: SubscribeToTask on a replica holding a paused ActiveTask returns a stale INPUT_REQUIRED snapshot and closes

2 participants