fix(vault): inject tokens for A2A-backed tools invoked via MCP - #6410
Closed
chengwudi1 wants to merge 1 commit into
Closed
fix(vault): inject tokens for A2A-backed tools invoked via MCP#6410chengwudi1 wants to merge 1 commit into
chengwudi1 wants to merge 1 commit into
Conversation
chengwudi1
requested review from
Lang-Akshay,
brian-hussey,
crivetimihai,
ja8zyjits and
msureshkumar88
as code owners
August 25, 2026 16:26
Signed-off-by: chengwudi1 <chengwudi1@users.noreply.github.com>
chengwudi1
force-pushed
the
fix/vault-a2a-tool-token-injection
branch
from
August 26, 2026 11:37
8354f82 to
2f844c6
Compare
Collaborator
|
Closing in favour of #6395, which addresses the same Vault plugin A2A token injection gap with a significantly more complete implementation: full e2e test suite, defence-in-depth header stripping, A2A metadata loading, and it is already approved. This PR's focused plugin-only fix is superseded by #6395. |
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
Fixes #6394 — the Vault plugin did not inject vault tokens when an A2A agent wrapped as an MCP tool was invoked
through the MCP protocol (
tools/call). Token injection only worked via the direct/a2a/{name}/invokepath(
agent_pre_invoke).Root cause:
tool_pre_invokeresolved the system tag only from the gateway metadata. A2A-backed tools carry ana2a_agent_idannotation (and replicate the agent's tags, e.g.system:<host>), but that metadata was neverconsulted.
🔧 Changes
plugins/vault/vault_plugin.py: intool_pre_invoke, when the tool metadata carries thea2a_agent_idannotation,the system/auth-header tags are resolved from the tool metadata (which carries the agent's tags) instead of the
gateway metadata. Non-A2A tools keep the existing gateway-metadata resolution behavior.
✅ Tests
Added 2 unit tests in
tests/unit/.../test_vault_plugin.py:test_a2a_backed_tool_injects_token_from_tool_metadata— A2A-backed tool with asystem:tag on the tool metadatagets the Bearer token injected (fails on the unpatched code).
test_regular_tool_ignores_tool_metadata— non-A2A tools still resolve from the gateway metadata only (regressionguard).
All 39 unit tests pass;
ruff checkandruff formatclean.