Skip to content

fix(a2a): run follow-up task messages in their own request contextvars - #693

Merged
jariy17 merged 2 commits into
mainfrom
fix/a2a-per-message-contextvars
Oct 27, 2026
Merged

jariy17 merged 2 commits into
mainfrom
fix/a2a-per-message-contextvars

Conversation

@tejaskash

@tejaskash tejaskash commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

What

  • Capture the sending request's contextvars for each A2A message.
  • Run the user executor in that message's captured context.
  • Cover both message/send and message/stream follow-up requests.
  • Consume the private snapshot before user code runs and fall back safely when it is unavailable.

How

The request-context builder captures a private contextvars snapshot for each message. The executor wrapper consumes that snapshot and starts the user executor within it, with a safe fallback when no snapshot is available.

Why

a2a-sdk 1.x processes later messages through the producer task created for the first request. Follow-up execution otherwise sees stale request values, including workload access tokens, request and session IDs, callback URLs, and forwarded headers.

Fixes #690

@github-actions

github-actions Bot commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

✅ No Breaking Changes Detected

No public API breaking changes found in this PR.

a2a-sdk 1.x runs every message of a task in one producer task created by
the first request, so follow-up messages saw the first request's
contextvars, including BedrockAgentCoreContext and the workload access
token. Snapshot contextvars per message in the request context builder
and run the executor in that snapshot.

Fixes #690
@jariy17
jariy17 force-pushed the fix/a2a-per-message-contextvars branch from e7665cc to 013d2df Compare October 27, 2026 16:34
@jariy17
jariy17 marked this pull request as draft October 27, 2026 16:34
@github-actions github-actions Bot added size/m PR size: M and removed size/m PR size: M labels Oct 27, 2026
@jariy17
jariy17 deployed to auto-approve October 27, 2026 16:57 — with GitHub Actions Active
@jariy17
jariy17 deployed to auto-approve October 27, 2026 16:57 — with GitHub Actions Active
@jariy17
jariy17 deployed to auto-approve October 27, 2026 16:57 — with GitHub Actions Active
@jariy17
jariy17 deployed to auto-approve October 27, 2026 16:57 — with GitHub Actions Active
@jariy17
jariy17 deployed to auto-approve October 27, 2026 16:57 — with GitHub Actions Active
@jariy17
jariy17 deployed to auto-approve October 27, 2026 16:57 — with GitHub Actions Active
@jariy17
jariy17 deployed to auto-approve October 27, 2026 16:57 — with GitHub Actions Active
@jariy17
jariy17 deployed to auto-approve October 27, 2026 16:57 — with GitHub Actions Active
@github-actions github-actions Bot removed the size/m PR size: M label Oct 27, 2026
@github-actions github-actions Bot added size/m PR size: M and removed size/m PR size: M labels Oct 27, 2026
@jariy17
jariy17 marked this pull request as ready for review October 27, 2026 17:04
@agentcore-devx-automation agentcore-devx-automation Bot added the claude-security-reviewing Claude Code /security-review in progress label Oct 27, 2026
@agentcore-devx-automation

Copy link
Copy Markdown
Contributor

Claude Security Review: no high-confidence findings. (run)

@agentcore-devx-automation agentcore-devx-automation Bot removed the claude-security-reviewing Claude Code /security-review in progress label Oct 27, 2026
@jariy17
jariy17 merged commit dcca518 into main Oct 27, 2026
45 of 51 checks passed

This branch was successfully deployed

1 active deployment
auto-approve — 64ec2ff4 Deployed Oct 27, 2026 by jariy17 via Test (services) #1669
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/m PR size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] A2A (a2a-sdk 1.x): follow-up messages on an existing task run the executor with the first request's contextvars

2 participants