fix: refresh idle ActiveTask snapshots on reuse - #1189
Open
KirschBluteX wants to merge 3 commits into
Open
Conversation
🧪 Code Coverage (vs
|
| Base | PR | Delta | |
|---|---|---|---|
| src/a2a/server/agent_execution/active_task.py | 95.09% | 95.88% | 🟢 +0.80% |
| src/a2a/server/agent_execution/active_task_registry.py | 96.61% | 95.77% | 🔴 -0.84% |
| src/a2a/server/request_handlers/default_request_handler_v2.py | 94.17% | 94.07% | 🔴 -0.10% |
| Total | 93.00% | 93.04% | 🟢 +0.04% |
Generated by coverage-comment.yml
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.
Summary
ActiveTasksnapshot only when an actual new request enters an idle task boundary.Root cause
ActiveTaskRegistryretained anActiveTaskacrossinput_requiredinterruptions. ItsTaskManagertherefore reused an old_current_tasksnapshot even after another server replica persisted newer artifacts, history, and status to the sharedTaskStore. The next request could save that stale snapshot and silently overwrite the newer state.The registry now asks an existing
ActiveTaskto invalidate its cached task only at a real request boundary while its reference count is idle (<= 1), under the task lifecycle lock. Active subscribers and streaming requests are not refreshed mid-stream, and concurrent close/reuse paths share the same synchronization boundary.Tests
Fixes #1188