feat(server): wire versioned store and event stream into v2 handler - #1245
Open
mykytanetipa wants to merge 1 commit into
Open
mykytanetipa wants to merge 1 commit into
mykytanetipa wants to merge 1 commit into
Conversation
mykytanetipa
added this pull request to stack #1246
September 17, 2026 08:45
🧪 Code Coverage (vs
|
| Base | PR | Delta | |
|---|---|---|---|
| src/a2a/server/agent_execution/active_task.py | 95.18% | 94.18% | 🔴 -1.00% |
| src/a2a/server/agent_execution/active_task_registry.py | 97.01% | 97.37% | 🟢 +0.35% |
| src/a2a/server/request_handlers/default_request_handler_v2.py | 92.53% | 87.20% | 🔴 -5.34% |
| src/a2a/server/tasks/task_manager.py | 98.68% | 98.86% | 🟢 +0.18% |
| Total | 93.04% | 92.83% | 🔴 -0.21% |
Generated by coverage-comment.yml
mykytanetipa
force-pushed
the
multiserver/handler-integration
branch
from
September 17, 2026 09:57
c35ee03 to
40da31e
Compare
mykytanetipa
force-pushed
the
multiserver/handler-integration
branch
from
September 17, 2026 10:36
40da31e to
9ef150d
Compare
mykytanetipa
marked this pull request as ready for review
September 17, 2026 10:51
mykytanetipa
force-pushed
the
multiserver/handler-integration
branch
from
September 22, 2026 22:46
9ef150d to
d87a6a2
Compare
…ndler Makes DefaultRequestHandlerV2 multi-replica capable while staying fully backward compatible: with event_stream=None and a plain TaskStore, behaviour is byte-identical to today. * Optional `event_stream` constructor param. `task_store` accepts a plain TaskStore or a VersionedTaskStore and is exposed unchanged as `self.task_store`; internal cluster reads/writes go through a private versioned view (the store itself, or a LegacyTaskStoreAdapter for a plain one), whose `get` returns a `StoredTask`. * Version-aware TaskManager (CAS saves, request-boundary cache invalidation). * ActiveTask/ActiveTaskRegistry publish applied events to the stream when one is configured. * The presence of a shared stream selects the deployment mode. Without one the handler is single-process: on_subscribe_to_task serves the resubscription from the in-process ActiveTaskRegistry (get_or_create), exactly as before cluster support. With a shared stream, on_cancel_task and on_subscribe_to_task route across replicas via the shared store and stream (cancel-via-CAS with bounded retries; resubscribe tails the stream and serves a store snapshot). * A VersionedTaskStore configured without an event stream warns once at construction: it signals cluster intent, but cross-replica streaming is disabled until a shared stream is supplied. task_manager keeps its cluster imports under TYPE_CHECKING (with lazy function-level imports for runtime use) so importing a2a.server.cluster first does not hit an import cycle. Adds multi-replica behavioural tests (send, resubscribe, cancel, wiring) sharing one store+stream across two handler instances. The in-memory VersionedTaskStore and TaskEventStream doubles used by those tests live in the cluster tests' conftest, since the shipped package provides only interfaces and database-backed implementations.
mykytanetipa
force-pushed
the
multiserver/handler-integration
branch
from
September 22, 2026 23:20
d87a6a2 to
53bcb60
Compare
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.
Lets DefaultRequestHandlerV2 use the shared store and event stream from #1244, so any replica can serve any request for a remote task. Opt-in and backward compatible: with no event stream and a plain TaskStore, behaviour is exactly as before.
Key changes:
Tested:
Design discussion: #1224