Skip to content

feat(server): make V2 event queue capacity configurable - #1378

Open
Boulea7 wants to merge 2 commits into
a2aproject:mainfrom
Boulea7:feat/v2-event-queue-capacity
Open

Boulea7 wants to merge 2 commits into
a2aproject:mainfrom
Boulea7:feat/v2-event-queue-capacity

Conversation

@Boulea7

@Boulea7 Boulea7 commented Oct 26, 2026

Copy link
Copy Markdown

Description

DefaultRequestHandlerV2 ignores the deprecated queue_manager option, so applications cannot configure its local event-buffer capacity. Add keyword-only max_event_queue_size, defaulting to 1024, to the handler, registry and ActiveTask. Forward it to both event sources, the agent's default sink and every local subscriber tap, and reject nonpositive values at construction.

The capacity counts events per buffer, including internal lifecycle markers. The default sink keeps backpressure and full subscriber taps keep eviction. Pending requests, shared storage and cross-replica streams are outside this setting.

Small capacities can evict a send request's subscription before it receives a direct Message. Preserve the validated Message and any consumer error or cancellation so the fallback completes correctly without waiting for producer cleanup. Task responses retain the existing stored-snapshot fallback, which can be non-terminal after eviction; the API docstrings explain this behavior.

Regressions cover capacity propagation, backpressure and recovery, slow-subscriber eviction with fast and late subscribers, direct-Message validation/error/cancellation paths, and local and cross-replica send/subscribe/cancel behavior.

Validation

On base e12d494b, Python 3.12.15:

  • The new capacity regressions fail on the unchanged base: 12 failed, 1 passed. The candidate's focused run passes all 29 cases.
  • ./scripts/lint.sh: passed, with three existing ty warnings in client files.
  • uv run pytest -p fixture_output_drain: 2358 passed, 199 skipped, 3 xfailed, 1 xpassed.
  • uv run pytest -p fixture_output_drain --cov=src --cov-report=term-missing --cov-fail-under=88: the same test counts, 93.19% coverage.

The temporary local fixture_output_drain plugin continuously drains stdout/stderr from the two cross-version fixture servers. On this host, undrained pipes caused four cross-version timeouts on the earlier unchanged base as well as the candidate; draining the pipes made all four pass without changing assertions or deadlines. The fixture and plugin are not changed or added by this PR.

The 199 skips are 99 PostgreSQL and 99 MySQL cases without test database DSNs, plus one SQLite row-lock case. The existing xfail/xpass cases reference #869.

  • Follow the CONTRIBUTING guide.
  • Use a Conventional Commits title.
  • Run the tests and linter, with the local fixture condition described above.
  • Update the relevant API documentation.

Fixes #1339

@Boulea7
Boulea7 requested a review from a team as a code owner October 26, 2026 02:06
@github-actions

github-actions Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

🧪 Code Coverage (vs main)

⬇️ Download Full Report

Base PR Delta
src/a2a/server/agent_execution/active_task.py 95.81% 96.04% 🟢 +0.23%
src/a2a/server/agent_execution/active_task_registry.py 97.78% 97.89% 🟢 +0.12%
Total 93.03% 93.06% 🟢 +0.03%

Generated by coverage-comment.yml

@Iwaniukooo11 Iwaniukooo11 self-assigned this Oct 26, 2026

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.

DefaultRequestHandler (v2) ignores queue_manager, so the per-task event queue bound (1,024) cannot be configured

2 participants