Skip to content

fix(storyboard): send an A2A request when the protocol under test is A2A - #2964

Closed
KonstantinMirin wants to merge 2 commits into
adcontextprotocol:mainfrom
KonstantinMirin:fix/storyboard-a2a-vector-transport
Closed

KonstantinMirin wants to merge 2 commits into
adcontextprotocol:mainfrom
KonstantinMirin:fix/storyboard-a2a-vector-transport

Conversation

@KonstantinMirin

@KonstantinMirin KonstantinMirin commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

What the runner sends today

On an A2A run, signed_requests vectors are dispatched as MCP. resolveVectorTransport (request-signing/probe-dispatch.ts) returns 'mcp' without reading options.protocol, so the grader runs its MCP precondition: an initialize POSTed at the A2A agent URL with MCP framing and MCP version headers. The A2A endpoint answers 405 Method Not Allowed, and every vector errors in the precondition before one is graded.

That is a wrong request, not a coverage gap. Nothing about the agent's verifier is exercised, and the result is reported as a signing failure.

What it should send

The request an A2A buyer makes:

  1. The endpoint the agent card names, not an assumed one. /.well-known/agent-card.json — reached with the SDK's own buildCardUrls — names the interface: url, protocolBinding, protocolVersion. The grader resolves the JSONRPC interface and sends there. Scheme, host, port and path all come from the card; none is derived.
  2. A native SendMessage envelope. Built as a typed SendMessageRequest and serialized with the SDK's own SendMessageRequest.toJSON, carrying the AdCP invocation callA2ATool already sends in protocols/a2a.ts. Nothing about the proto-JSON encoding is hand-written, and the payload key follows the card's declared protocolVersion instead of being fixed at the call site. @a2a-js/sdk is a peer dependency, so the import is dynamic inside the A2A branch — grading MCP never loads it.
  3. A2A-Version: 1.0 on the wire, merged before the signature is computed. Content-Digest covers the body and the signature base covers the headers, so a header added after signing sits outside the base on a request the verifier reconstructs with it.

The patch

resolveVectorTransport reads options.protocol. BuildOptions.transport and GradeOptions.transport gain an 'a2a' member. The grader gains an A2A card-resolution precondition alongside its existing MCP initialize precondition, memoized per agent URL. applyTransport frames the vector for A2A. The positive canonicalization vectors skip on A2A for the reason they already skip on MCP: both route every vector to one endpoint, so the URL edge never reaches the wire.

Verification

Against a live A2A agent, the corrected request is accepted at the card-named endpoint, at the version that card declares, and every vector is graded; the request the runner sends today is answered 405 before grading.

Composes with #2958 — that PR makes resolveVectorTransport protocol-aware and returns no framing for A2A; this returns 'a2a'.


🤖 Generated with Claude Code

`resolveVectorTransport` returned 'mcp' without reading `options.protocol`, so
on an A2A run every `signed_requests` vector was framed as MCP: an `initialize`
with MCP framing and MCP version headers, POSTed at the A2A endpoint, answered
405 before a single vector was graded.

Adds an 'a2a' vector transport that sends the request an A2A buyer sends:

- the RPC endpoint resolved from the agent card's `supportedInterfaces`
  (JSONRPC binding) via the SDK's own `buildCardUrls` -- scheme, host, port and
  path all come from the card, none is derived, and a card naming no JSONRPC
  interface errors rather than falling back to a conventional mount
- a native `SendMessage` envelope built as a typed `SendMessageRequest` and
  serialized by `@a2a-js/sdk`'s own `toJSON`, carrying the AdCP invocation
  `callA2ATool` already sends; the payload key follows the card's declared
  `protocolVersion` instead of being fixed at the call site
- `A2A-Version` merged BEFORE the signature is computed, because Content-Digest
  covers the body and the signature base covers the headers

`@a2a-js/sdk` is a peer dependency, so it is imported dynamically inside the
A2A branch and awaited by the grader's A2A precondition alongside the card
resolution; grading MCP never loads it.

The positive canonicalization vectors skip on A2A for the reason they already
skip on MCP: both route every vector to one endpoint, so the URL edge never
reaches the wire.
resolveA2aInterface(agentUrl, { allowPrivateIp: options.allowPrivateIp, timeoutMs: options.timeoutMs }),
loadA2aEnvelopeCodec(),
]);
return iface.url;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Medium: iface.protocolVersion is resolved off the card (L279) and then dropped here — only iface.url is threaded. BuildOptions carries no protocolVersion, so wrapA2aEnvelope calls buildAdcpA2aInvocation(operation, args) with the default and headers['A2A-Version'] is the constant A2A_WIRE_VERSION ('1.0'). Net effect: an A2A card declaring protocolVersion: '0.x' is framed as 1.x (input, not parameters) and stamped A2A-Version: 1.0. That contradicts buildAdcpA2aInvocation's own doc — "SELECTED BY THE DECLARED PROTOCOL VERSION ... which is why no call site may fix it" — and reintroduces the wrong-framing-at-the-endpoint failure this PR fixes, narrowed to legacy 0.x agents. Thread iface.protocolVersion through to the invocation key and the version header, or drop the version-switch machinery and document A2A grading as 1.0-only.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in c1de802. prepareA2aTransport now returns the resolved A2aInterface whole, BuildOptions.a2aProtocolVersion carries the declared version, and it selects the A2A-Version header, the JSON-RPC method and the invocation's payload key through one isLegacyA2aWire predicate — the same test callA2ATool applies to client.protocolVersion.

Removed a second literal in the same path while here: resolveA2aInterface was substituting '1.0' when a card declared no version. It now passes the absence through, so a card that declares no version gets no version header, and the absence reads as 1.x exactly as it does in protocols/a2a.ts. A card declaring 0.x is refused with a named error rather than framed as 1.x.

aao-secretariat[bot]
aao-secretariat Bot previously approved these changes Sep 18, 2026

@aao-secretariat aao-secretariat Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ladon verdict: Approve

Approve — A2A vector transport for the request-signing grader.

Checked:

  • SSRF gating verified on both hops.
  • Changeset present and correctly scoped (.changeset/storyboard-a2a-vector-transport.md) for the src/lib/** changes.
  • Official-codec envelope serialization used; no HTTP/SSE reimplementation.
  • Preflight-skip extension reviewed.

Medium findings

  • src/lib/testing/storyboard/request-signing/probe-dispatch.ts — prepareA2aTransport drops the card's resolved protocolVersion, pinning A2A framing to 1.0 regardless of the card's declared version.

Decision rationale: No critical/high findings. gated_paths is false and high_risk is false, so rows 1–5 do not fire. No prior escalation, no no-auto-approve team match. Only 1 medium finding (< 3), so row 8 does not fire. Falls through to row 9 → approve. Note: review_decision is REVIEW_REQUIRED, but with gated_paths: false row 2 does not apply.

…iteral

`prepareA2aTransport` returned only the resolved interface's url and dropped
its `protocolVersion`, so the builder pinned the framing to a `'1.0'` constant
regardless of what the agent published — the assumption this transport exists
to remove, one field over from the endpoint.

The card is now the single source for all three values. `resolveA2aInterface`
returns the declared version alongside the url, `BuildOptions.a2aProtocolVersion`
carries it, and it selects the `A2A-Version` header, the JSON-RPC method and the
invocation's payload key through one `isLegacyA2aWire` predicate — the same test
`callA2ATool` applies to `client.protocolVersion`.

Two literals removed, not one: the card's `protocolVersion` is also passed
through verbatim including its ABSENCE. A card that declares no version gets no
version header from us, and the absence reads as 1.x exactly as it does in
`protocols/a2a.ts`. A card declaring 0.x is refused with a named error rather
than framed as 1.x, because the 0.x `message/send` family has its own params
shape and guessing it is the same defect again.
@aao-secretariat

Copy link
Copy Markdown

Ladon cannot review this PR until merge conflicts are resolved.

@KonstantinMirin

Copy link
Copy Markdown
Contributor Author

#2958 has merged, so this branch now conflicts with main on probe-dispatch.ts. Raising it here rather than picking a resolution, because the overlap is a design question that belongs to you.

The Medium finding from the review is separate and already fixed in c1de802 — the A2A protocol version now comes off the card and drives the A2A-Version header, the JSON-RPC method and the payload key. That one needs nothing further.

On the overlap: #2958 made resolveVectorTransport return no framing on an A2A run, so the vectors skip as signing_transport_unavailable → fixture_unavailable, with the guardrails around it that stop an all-unavailable track reading as a pass. That was the right call with no A2A framing available, and it is what this PR's body means by composing with it. This PR supplies the framing the stop-gap was standing in for, so the two now meet at the same function.

Two ways to reconcile, and we do not have a preference:

  • Replace the stop-gap as superseded. resolveVectorTransport returns 'a2a', and the signing_transport_unavailable path plus its tests come out. Cleanest single code path, but it removes behaviour you shipped deliberately.
  • Keep it reachable as a fallback. A2A frames normally, and the unavailable path remains for agents whose card cannot be resolved — no JSONRPC interface, or a card that does not fetch. Some redundancy between the two, but your fallback and its guardrails survive for the cases the framing cannot reach.

Happy to do either. We will hold off pushing anything else here until you say which, so the reconciliation lands the way you want rather than as a merge decision made in a contributor's branch.

KonstantinMirin added a commit to KonstantinMirin/prebid-salesagent that referenced this pull request Sep 18, 2026
… not from constants

Two defects in our local runner patch, both the same shape: a value the AGENT CARD
declares, hardcoded at the call site instead.

The endpoint. The patch defaulted a bare path to `/a2a` and carried a comment
admitting the ceiling -- "an agent serving A2A somewhere other than /a2a must pass
the endpoint as the storyboard's a2a agent url". A2A is card-first: scheme, host,
port AND path all belong to the card's `AgentInterface`, and a grader that derives
any of them is wrong for some agent. It now requires the card-resolved RPC endpoint
and throws without one, so the guess cannot be made silently.

The payload key. We sent `parameters` while declaring `A2A-Version: 1.0`.
`protocols/a2a.ts` selects it as `legacyWire ? { skill, parameters } : { skill, input }`,
keyed on the `protocolVersion` it read off the card -- so `input` is the only correct
spelling for a 1.0 frame. Ours passed only because our own dispatcher is lenient; a
strict 1.0 receiver would have refused every vector, which makes the patch correct
against exactly one implementation.

Re-measured after both fixes: signed_requests failures stay zero on mcp and a2a.

This is the local patch our storyboard numbers depend on. The upstream form is
adcontextprotocol/adcp-client#2964, which carries the same two rules as the
implementation rather than as a fix.

Copy link
Copy Markdown
Contributor

Closing after takeover review against current main and merged #2958.

#2958 already fixes the original false failure: an A2A run no longer sends MCP framing and instead reports the signed-vector transport as unavailable, fail-closed. This PR cannot safely replace that coverage gap yet:

  • SendMessageRequest.toJSON is only serialization; the branch still hand-builds and directly sends the JSON-RPC request instead of using the official @a2a-js/sdk client.
  • It defines a REST-vector-to-A2A signing scope that the upstream contract does not currently specify. That would make the SDK grade an invented binding.
  • Protocol-method vector 028 carries an MCP tasks/cancel envelope and cannot be treated as native A2A coverage.

The safe follow-up is upstream definition of the A2A request-signing binding plus an official-client interception/signing seam. Once those exist, this can return as a new implementation that signs requests emitted by the official client. No merge from this branch.

@bokelley bokelley closed this Sep 19, 2026
@bokelley

Copy link
Copy Markdown
Contributor

Acknowledged. The closure rationale is clear: #2958 already covers the original false-failure, and the safe A2A signing path requires upstream definition of the request-signing binding before this approach can return as a conformant implementation using the official @a2a-js/sdk client.


Generated by Claude Code

@KonstantinMirin

Copy link
Copy Markdown
Contributor Author

Reopened as #2967 — reimplemented rather than re-argued, because the first objection here was correct.

"It hand-builds the JSON-RPC request instead of using the official client." Fair, and that branch did. #2967 does not build an A2A envelope at all. ClientFactory resolves the card and builds the call; the request is captured at the SDK's own fetchImpl seam and those exact bytes are signed. The endpoint, the method name, the a2a-version header, the proto-JSON encoding and the payload key are all the official client's.

That also answers the stated blocker — "the safe follow-up is upstream definition of the A2A request-signing binding plus an official-client interception/signing seam. Once those exist…". The seam exists today: JsonRpcTransportFactoryOptions.fetchImpl (@a2a-js/sdk client/index.d.ts:194), which is the same shape as the StreamableHTTPClientTransport(url, { fetch }) this repo already uses for the MCP precondition in probe.ts:323.

Two points I'd ask you to re-check against this repo's own source, because I think they were applied to the branch in good faith but do not hold:

"Protocol-method vector 028 carries an MCP tasks/cancel envelope." tasks/cancel is an A2A method; MCP defines no such method. builder.ts:295-299 already states it: "The fixture body is already a JSON-RPC envelope with method: "tasks/cancel" — NOT a tools/call envelope." And probe-dispatch.ts:50: "@a2a-js/sdk issues the JSON-RPC methods these vectors target, tasks/cancel included." Measured against a 0.3 card, the official client emits {"method":"tasks/cancel"} with a2a-version: 0.3 for a plain cancelTask call — natively, nothing framed. 028 is the one vector that is most at home on A2A.

"It defines a REST-vector-to-A2A scope the upstream contract does not specify — the SDK would grade an invented binding." The shipped MCP path defines a REST-vector-to-MCP scope by exactly the same means: wrapMcpEnvelope (builder.ts:481) hand-builds a tools/call envelope with JSON.stringify and derives params.name from the fixture's URL path. If re-framing a REST fixture is inventing a binding, that one is invented too. On scope, the pinned spec is not silent — security.mdx @ 3.1.1 :1045 names A2A task-lifecycle methods as precisely what protocol_methods_* covers, :1043 makes operation names transport-neutral "so cross-transport verifiers agree", and :1142 names A2A skill invocation as a declared transport for a protocol-level AdCP call.

On the reconciliation question from my earlier comment, which never got an answer: #2967 takes the conservative branch of the two I offered. resolveVectorTransport still returns no framing for A2A, the availability decision moves to the async dispatcher, and an agent whose card does not resolve keeps signing_transport_unavailable and all of #2958's guardrails. All 44 tests in request-signing-vector-transport.test.js pass unchanged — nothing you shipped deliberately is deleted.

Happy to take it in a different direction if you'd rather; the measurements are in the PR either way.

bokelley added a commit that referenced this pull request Sep 20, 2026
* fix(storyboard): sign the request the official A2A client emits

An A2A run reports every request-signing vector as `signing_transport_unavailable`.
#2958 made that fail-closed, which was right — the previous behaviour POSTed an MCP
`initialize` at an A2A endpoint and graded the 405 as a signature failure. But it leaves no
A2A agent's verifier graded at all, and the gap is permanent unless the dispatch is wired.

This wires it, in the shape #2958's own comment described as the correct one: "signing a
request the official client issues — applying each vector's RFC 9421 headers to that
client's own request".

WHAT DECIDES THE WIRE. `@a2a-js/sdk`'s `ClientFactory` resolves the agent card and builds
the call; the request is captured at the SDK's own `fetchImpl` seam and those exact bytes
are signed. Nothing about the A2A wire is written down here:

  endpoint             <- the card's supportedInterfaces[]
  JSON-RPC method name <- the SDK, per the card's protocolVersion
  a2a-version header   <- the SDK, from that same version
  proto-JSON encoding  <- the SDK (role -> "ROLE_USER", not 1)
  payload key          <- the SDK (input on 1.x, parameters on 0.x)

Observed, not assumed, and asserted in tests: against a card declaring 1.0 the client emits
{"method":"SendMessage"} with `a2a-version: 1.0`; against 0.3.0 the same `cancelTask` call
emits {"method":"tasks/cancel"} with `a2a-version: 0.3`. That second one matters — it is the
method the AdCP spec's `protocol_methods_*` namespace names (security.mdx @ 3.1.1 :1045
cites "A2A 0.3.0 §7.x"), so vector 028 is graded by the official client issuing the
lifecycle call natively rather than by anyone framing an envelope.

ORDERING. Capture happens before signing, so `a2a-version` is inside the signature base. A
header added after signing sits outside the base the verifier reconstructs.

FAIL-CLOSED IS PRESERVED, NOT REPLACED. `resolveVectorTransport` still returns no framing
for A2A — it cannot answer the question, which is whether the card resolves, and that is a
fetch. The decision moved into the async dispatcher: when the card resolves to a JSONRPC
interface the vectors dispatch; when it does not, nothing is framed on a guess and the
vector keeps #2958's `signing_transport_unavailable` reporting and every guardrail around
it. All 44 tests in request-signing-vector-transport.test.js pass unchanged.

`@a2a-js/sdk` stays a peer dependency: the import is dynamic and inside the A2A path, so
grading an MCP agent never loads it.

Tests: 7 new, each asserting that a protocol decision was the SDK's. The availability gate
is graded both ways — a resolvable card makes dispatch available and names the endpoint it
resolved; an unreachable one stays unavailable rather than inventing an endpoint.

Supersedes #2964, which hand-built the envelope. That objection was fair and this does not
repeat it.

* fix(storyboard): merge A2A headers case-insensitively, so none is sent twice

Measured against a live agent on the box: 42 of 90 A2A vectors passed and 16 of the 27
failures were the agent answering `request_signature_header_malformed` — refusing at
checklist step 1, before it evaluated anything the vector grades.

The cause was here, not in the agent. `applyTransport` merged the fixture's recorded
headers with the client's using a plain object spread, and object keys are CASE-SENSITIVE
while HTTP header names are not. A fixture carrying `Content-Type` and a client emitting
`content-type` therefore both survived the merge, and the request went out carrying the
header twice.

That the agent under test is transport-independent is what localizes it: its verifier takes
no protocol argument and runs the same code on every transport, so a refusal that appears
on A2A and not on MCP has to come from the request, not from verification.

Regression test asserts the header appears exactly once, and is non-vacuous — with the
merge reverted it fails with `got ["Content-Type","content-type"]`.

* fix(storyboard): let the FIXTURE's headers win; the transport only fills gaps

Measured on the box after the case-insensitive merge landed: A2A went 42p/48f -> 66p/24f,
and of the six remaining failures exactly one was A2A-specific —
`negative-022-multi-valued-content-type`, answering `request_signature_window_invalid`
where the vector expects `request_signature_header_malformed`.

The precedence was backwards. 022 presents a deliberately MULTI-VALUED `Content-Type`, and
that header is the fault under test; letting the official client's clean `content-type`
override it destroys the vector, so the agent answers about a different defect and the run
grades a request nobody meant to send.

The client's headers now fill only what the fixture does not set — `a2a-version`, `accept`
— which is also what the implementation that scored 59 on this agent did: it took the
vector's headers and added the version header, nothing more.

The other five failures are not this transport: `negative-007` and `negative-018` fail
identically on MCP and A2A (the `agentCapability` fix in #2963, absent from this build),
and the sixth is a version-pin assertion in the harness used to run the experiment.

* fix(storyboard): skip URL-edge vectors on EVERY single-endpoint transport

Measured on the box: mcp graded 82 vectors and a2a graded 90, so the two cards were no
longer measuring the same thing and a2a's higher pass count (66 vs 59) was inflation rather
than coverage.

The canonicalization-edge positives (005-008) bake their edge into the vector URL's port,
path or query. Any transport that routes every vector to one endpoint neutralizes that
edge, so passing says nothing about it. The skip existed but was gated on `transport ===
'mcp'`, and A2A routes every vector to the one RPC endpoint its card names for exactly the
same reason — so on A2A those vectors were graded, and reported as PASSES. Coverage
claimed, not delivered.

The gate now reads "not raw", which is what the condition always meant: `raw` is the only
transport that preserves the vector's own URL, and it is where this edge is gradable.
adcp-client#2964 stated this property in its description; reimplementing lost it.

* test(storyboard): make the merge-order guard actually guard the merge order

Ladon's medium finding on c49689d was right: the test located vector 022 and then built
`loaded.positive[0]`, asserting only `a2a-version`/`accept`. Both of those are gap-fills
present under either merge order, so the test passed identically with the bug in place —
it guarded nothing.

It now hands the transport a `content-type` that differs from the fixture's and asserts the
FIXTURE's value survives, so only one order can satisfy it.

Non-vacuity checked rather than asserted: with the merge order flipped back the test fails
on "the fixture's Content-Type must survive", and passes again when restored.

* fix(storyboard): match brand.json on the PROTOCOL ENDPOINT, not the card base

An A2A agent that publishes a conformant brand.json was graded non-conformant for
publishing exactly what the spec asks for.

security.mdx @ 3.1.1 :1142 step 1 defines `A`: "invoke `get_adcp_capabilities` via the
agent's declared transport (MCP `tools/call` or A2A skill invocation) ... The agent URL is
the PROTOCOL ENDPOINT, not a JSON capabilities document." Step 5 (:1104) then byte-equals
`agents[].url` against that same `A`, explicitly without canonicalization.

`probeBrandJwks` passed the URL the runner was handed. On MCP that IS the protocol
endpoint, so this changed nothing there. On A2A it is not: the runner must be given the
card's BASE, because the card lives at `<base>/.well-known/agent-card.json` and passing the
RPC endpoint asks for `/a2a/.well-known/agent-card.json` (404). The endpoint `A` names is
what the card resolves to.

So a seller publishing `https://host/a2a` — the protocol endpoint, per the spec — got ZERO
byte-equal matches against the base, and `selectAgentByUrl` correctly reported
`agent_not_in_brand_json`. The resolver was right; it was being asked the wrong question.

The A2A branch now resolves the card-named endpoint before matching, reusing
`resolveA2aDispatchTarget` from this branch's dispatch path. It falls back to the handed
URL rather than throwing: an unresolvable card is already reported by the dispatch path
with its own reason, and raising here would relabel one failure as another.

Measured against a live seller: brand.json publishes `.../a2a` and `.../mcp/`; mcp matched
one entry, a2a matched none. The test asserts both directions — the base finds nothing, the
protocol endpoint finds exactly one.

* fix(storyboard): name the A2A legacy-compat policy, with the measurement behind it

`a2a-dispatch.ts` hardcoded `legacyCompat: { enabled: true }` at two call sites.
#2973 asked which of two things that means, and the answer decides whether the
value is a defect or the only correct one. MEASURED against `@a2a-js/sdk`, one
`cancelTask`, four combinations:

  | card    | enabled | method emitted | a2a-version |
  |---------|---------|----------------|-------------|
  | 1.0     | true    | CancelTask     | 1.0         |
  | 1.0     | false   | CancelTask     | 1.0         |
  | 0.3.0   | true    | tasks/cancel   | 0.3         |
  | 0.3.0   | false   | CancelTask     | 1.0         |

So `true` means "also accept 0.3", not "speak 0.3": a 1.0 card is never
downgraded — the first two rows are byte-identical — and a 0.3 card gets the
`tasks/*` family the AdCP spec names for it (security.mdx @ 3.1.1 :1045).
`false` is the value that ignores the card: the last row is a 1.0 frame sent
to an agent that published 0.3, silently.

A conformance runner grades the agent the card describes, so the card-following
policy is the only correct one at this layer, and it is deliberately not
operator-configurable here: a knob that selected framing the agent never
advertised would produce a verdict about an agent that does not exist.

The two literals become one frozen, named constant so they cannot drift, and a
test pins both directions of the measurement. #2973 keeps its broader scope —
the library-wide default in `createNativeA2AClientFromCardUrl`, a CLI flag, and
the runner guard.

* fix(storyboard): harden official A2A signing dispatch

* test(storyboard): expect actionable A2A dispatch remedy

---------

Co-authored-by: Brian O'Kelley <[email protected]>
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.

2 participants