From 2802a28aae5e5476fb4196c2847acbe27fcf0e3d Mon Sep 17 00:00:00 2001 From: Revinand Date: Thu, 26 Nov 2026 16:27:41 +0100 Subject: [PATCH 1/5] feat(support): pin the A2A x402 extension and gate features on promotion --- README.md | 21 +-- config.example.yaml | 2 +- docs/protocols.md | 27 ++-- docs/protocols/a2a.md | 18 ++- scripts/support-record.ts | 173 ++++++++++++++++------- src/protocols/a2a/message-mapping.ts | 2 +- src/protocols/a2a/types.ts | 4 +- src/support/a2a.json | 99 ++++++++++++- tests/integration/support-record.test.ts | 117 ++++++++++++++- 9 files changed, 375 insertions(+), 88 deletions(-) diff --git a/README.md b/README.md index bf2527f..c5c6963 100644 --- a/README.md +++ b/README.md @@ -308,16 +308,17 @@ See [docs/configuration.md](docs/configuration.md). -| Protocol | Status | Pinned revision | Implemented subset | -| ------------ | ------------ | ----------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- | -| **HTTP** | Supported | native | resource routes and rail-specific payment headers | -| **MCP** | Supported | MCP `2026-07-28` and `2025-11-25`; `@modelcontextprotocol/server@2.3.0` | tool discovery, invocation, payment-required and error mapping | -| **x402** | Supported | x402 v2; `@x402/core@2.30.0`, `@x402/evm@2.30.0`, `@x402/svm@2.30.0`, `@x402/near@2.30.0` | `exact` on EVM through EIP-3009 or Permit2, on Solana, and on NEAR (partial): challenge, verification, settlement and replay binding | -| **MPP** | Experimental | drafts at `tempoxyz/mpp-specs@806fdb8`; `mppx@0.13.1` | `charge`/`evm`/EIP-3009 with USDC on Base Sepolia and Base, over HTTP, MCP and A2A | -| **A2A** | Supported | v1.0.1; negotiation `1.0`; `JSONRPC` binding | Agent Card, `SendMessage` with `returnImmediately`, `GetTask`, `ListTasks`, `CancelTask` and the paid flow; the x402 extension is experimental | -| **ACP** | Experimental | stable snapshot `2026-04-17`; REST binding | discovery and the five checkout operations | -| **AP2** | Experimental | v0.2.0, tag 2026-04-28, commit `b4587ac`; Direct mode; `jose@6.2.12`, `@sd-jwt/core@0.20.1`, `canonicalize@5.0.0` | closed Checkout Mandate verification before settlement | -| **ERC-8409** | Experimental | draft `SergeevDmitry/ERCs@0ee33230` | signed quotes on x402 EVM offers; issuer published in `/.well-known/agent-commerce` | +| Protocol | Status | Pinned revision | Implemented subset | +| ---------------------- | ------------ | ----------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| **HTTP** | Supported | native | resource routes and rail-specific payment headers | +| **MCP** | Supported | MCP `2026-07-28` and `2025-11-25`; `@modelcontextprotocol/server@2.3.0` | tool discovery, invocation, payment-required and error mapping | +| **x402** | Supported | x402 v2; `@x402/core@2.30.0`, `@x402/evm@2.30.0`, `@x402/svm@2.30.0`, `@x402/near@2.30.0` | `exact` on EVM through EIP-3009 or Permit2, on Solana, and on NEAR (partial): challenge, verification, settlement and replay binding | +| **MPP** | Experimental | drafts at `tempoxyz/mpp-specs@806fdb8`; `mppx@0.13.1` | `charge`/`evm`/EIP-3009 with USDC on Base Sepolia and Base, over HTTP, MCP and A2A | +| **A2A** | Supported | v1.0.1; negotiation `1.0`; `JSONRPC` binding | Agent Card, `SendMessage` with `returnImmediately`, `GetTask`, `ListTasks`, `CancelTask` and the paid flow; the x402 extension is experimental | +| **ACP** | Experimental | stable snapshot `2026-04-17`; REST binding | discovery and the five checkout operations | +| **AP2** | Experimental | v0.2.0, tag 2026-04-28, commit `b4587ac`; Direct mode; `jose@6.2.12`, `@sd-jwt/core@0.20.1`, `canonicalize@5.0.0` | closed Checkout Mandate verification before settlement | +| **ERC-8409** | Experimental | draft `SergeevDmitry/ERCs@0ee33230` | signed quotes on x402 EVM offers; issuer published in `/.well-known/agent-commerce` | +| **A2A x402 extension** | Experimental | v0.1.0, commit `a5590226` | `TASK_STATE_INPUT_REQUIRED` with x402 v2 requirements, payment by a follow-up message on the task, receipts in the final status; A2A 1.0 wire forms, x402 only | diff --git a/config.example.yaml b/config.example.yaml index 43bd22e..533fd31 100644 --- a/config.example.yaml +++ b/config.example.yaml @@ -51,7 +51,7 @@ protocols: # name: io.github.acme/weather # version: 1.0.0 # description: Weather forecasts, paid per call - # A2A (Agent2Agent) v1.0.1 is off by default; its x402 extension is experimental + # A2A (Agent2Agent) v1.0.1 is off by default; its x402 extension is experimental. # Serves JSON-RPC `SendMessage`, `GetTask`, `ListTasks` and `CancelTask` at # mountPath and the Agent Card at /.well-known/agent-card.json. Enable at # least one resource with `expose: [a2a]`. Clients send `A2A-Version: 1.0`. diff --git a/docs/protocols.md b/docs/protocols.md index b9cb763..5e33062 100644 --- a/docs/protocols.md +++ b/docs/protocols.md @@ -7,16 +7,17 @@ subset. Each protocol's page describes that subset in detail. -| Protocol | Status | Role | Revision | Implemented subset | -| ------------ | ------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- | -| **HTTP** | Supported | Transport that carries x402 and MPP payments on each resource's invoke route. | native | resource routes and rail-specific payment headers | -| **MCP** | Supported | Transport that carries x402 and MPP payments in tool calls. | MCP `2026-07-28` and `2025-11-25`; `@modelcontextprotocol/server@2.3.0` | tool discovery, invocation, payment-required and error mapping | -| **x402** | Supported | Payment rail, carried by HTTP, MCP and A2A. | x402 v2; `@x402/core@2.30.0`, `@x402/evm@2.30.0`, `@x402/svm@2.30.0`, `@x402/near@2.30.0` | `exact` on EVM through EIP-3009 or Permit2, on Solana, and on NEAR (partial): challenge, verification, settlement and replay binding | -| **MPP** | Experimental | Payment rail, carried by HTTP, MCP and A2A. | drafts at `tempoxyz/mpp-specs@806fdb8`; `mppx@0.13.1` | `charge`/`evm`/EIP-3009 with USDC on Base Sepolia and Base, over HTTP, MCP and A2A | -| **A2A** | Supported | Transport that carries x402 and MPP payments in `SendMessage`, including through the x402 extension. | v1.0.1; negotiation `1.0`; `JSONRPC` binding | Agent Card, `SendMessage` with `returnImmediately`, `GetTask`, `ListTasks`, `CancelTask` and the paid flow; the x402 extension is experimental | -| **ACP** | Experimental | Checkout API that forwards checkout operations to the merchant, whose payment handler receives `payment_data`. Gateway checkout routes are free and carry no x402 or MPP payment. | stable snapshot `2026-04-17`; REST binding | discovery and the five checkout operations | -| **AP2** | Experimental | Authorization method, not a payment rail: a paid resource can require a verified mandate in addition to its x402 or MPP payment, never instead of it. | v0.2.0, tag 2026-04-28, commit `b4587ac`; Direct mode; `jose@6.2.12`, `@sd-jwt/core@0.20.1`, `canonicalize@5.0.0` | closed Checkout Mandate verification before settlement | -| **ERC-8409** | Experimental | x402 feature: EIP-712 signed quotes on the EVM offers of a challenge. | draft `SergeevDmitry/ERCs@0ee33230` | signed quotes on x402 EVM offers; issuer published in `/.well-known/agent-commerce` | +| Protocol | Status | Role | Revision | Implemented subset | +| ---------------------- | ------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| **HTTP** | Supported | Transport that carries x402 and MPP payments on each resource's invoke route. | native | resource routes and rail-specific payment headers | +| **MCP** | Supported | Transport that carries x402 and MPP payments in tool calls. | MCP `2026-07-28` and `2025-11-25`; `@modelcontextprotocol/server@2.3.0` | tool discovery, invocation, payment-required and error mapping | +| **x402** | Supported | Payment rail, carried by HTTP, MCP and A2A. | x402 v2; `@x402/core@2.30.0`, `@x402/evm@2.30.0`, `@x402/svm@2.30.0`, `@x402/near@2.30.0` | `exact` on EVM through EIP-3009 or Permit2, on Solana, and on NEAR (partial): challenge, verification, settlement and replay binding | +| **MPP** | Experimental | Payment rail, carried by HTTP, MCP and A2A. | drafts at `tempoxyz/mpp-specs@806fdb8`; `mppx@0.13.1` | `charge`/`evm`/EIP-3009 with USDC on Base Sepolia and Base, over HTTP, MCP and A2A | +| **A2A** | Supported | Transport that carries x402 and MPP payments in `SendMessage`, including through the x402 extension. | v1.0.1; negotiation `1.0`; `JSONRPC` binding | Agent Card, `SendMessage` with `returnImmediately`, `GetTask`, `ListTasks`, `CancelTask` and the paid flow; the x402 extension is experimental | +| **ACP** | Experimental | Checkout API that forwards checkout operations to the merchant, whose payment handler receives `payment_data`. Gateway checkout routes are free and carry no x402 or MPP payment. | stable snapshot `2026-04-17`; REST binding | discovery and the five checkout operations | +| **AP2** | Experimental | Authorization method, not a payment rail: a paid resource can require a verified mandate in addition to its x402 or MPP payment, never instead of it. | v0.2.0, tag 2026-04-28, commit `b4587ac`; Direct mode; `jose@6.2.12`, `@sd-jwt/core@0.20.1`, `canonicalize@5.0.0` | closed Checkout Mandate verification before settlement | +| **ERC-8409** | Experimental | x402 feature: EIP-712 signed quotes on the EVM offers of a challenge. | draft `SergeevDmitry/ERCs@0ee33230` | signed quotes on x402 EVM offers; issuer published in `/.well-known/agent-commerce` | +| **A2A x402 extension** | Experimental | A2A feature: x402 payment inside a task, through status message metadata and a follow-up payment message. | v0.1.0, commit `a5590226` | `TASK_STATE_INPUT_REQUIRED` with x402 v2 requirements, payment by a follow-up message on the task, receipts in the final status; A2A 1.0 wire forms, x402 only | @@ -87,6 +88,12 @@ that status. Upstream does not label x402 v2 stable, and its record states that. For other supported profiles, `npm test` fails if `spec.stable` is not `true`, a gap is open, `conformance` is missing or `docs` is empty. +A feature with its own pinned revision, such as the A2A x402 extension or +ERC-8409 quotes, must meet the same criteria to become supported. Checks use +its `spec`, `conformance` and tagged gaps, plus the parent record's docs. +Feature checks apply even inside HTTP, MCP and x402 records. A tagged gap +affects only the named feature. + A2A is the first profile promoted under these criteria (2.9.0). CI runs the A2A TCK at MUST level and compares failures and skips with the record. diff --git a/docs/protocols/a2a.md b/docs/protocols/a2a.md index 8335e19..2e0f803 100644 --- a/docs/protocols/a2a.md +++ b/docs/protocols/a2a.md @@ -359,13 +359,17 @@ such as `VERSION_NOT_SUPPORTED` and the domain `a2a-protocol.org`. -| Pin | Value | -| ------------------------ | ------------------------------------------------------------------------------------------------------------ | -| Pinned revision | v1.0.1; negotiation `1.0`; `JSONRPC` binding | -| Upstream source | [`a2aproject/A2A@33035925`](https://github.com/a2aproject/A2A/tree/3303592588e388e62e0f69f701af531d2f4e3991) | -| Declared stable upstream | yes | -| Upstream wording | "the first stable, production-ready version" (read 2026-11-17) | -| `@a2a-js/sdk` | `1.3.0`, tests only | +| Pin | Value | +| ------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ | +| Pinned revision | v1.0.1; negotiation `1.0`; `JSONRPC` binding | +| Upstream source | [`a2aproject/A2A@33035925`](https://github.com/a2aproject/A2A/tree/3303592588e388e62e0f69f701af531d2f4e3991) | +| Declared stable upstream | yes | +| Upstream wording | "the first stable, production-ready version" (read 2026-11-17) | +| A2A x402 extension pinned revision | v0.1.0, commit `a5590226` | +| A2A x402 extension upstream source | [`google-agentic-commerce/a2a-x402@a5590226`](https://github.com/google-agentic-commerce/a2a-x402/tree/a5590226fc4190fe7a9d2c13ab70128714db3125) | +| A2A x402 extension declared stable upstream | not stated | +| A2A x402 extension upstream wording | "A2A Protocol: x402 Payments Extension v0.1" (read 2026-11-26) | +| `@a2a-js/sdk` | `1.3.0`, tests only | diff --git a/scripts/support-record.ts b/scripts/support-record.ts index b300140..28fb0af 100644 --- a/scripts/support-record.ts +++ b/scripts/support-record.ts @@ -38,7 +38,46 @@ const SpecSchema = z.strictObject({ checked: z.iso.date(), }); -const SupportRecordSchema = z +const ConformanceSchema = z.strictObject({ + suite: text, + tests: z.array(text).min(1), + skipped: z.array( + z.strictObject({ + test: text, + reason: text, + spec: text.optional(), + upstream: text.optional(), + }), + ), + // CI suite revision, expected failures and skips, and shared skip messages + upstream: z + .strictObject({ + repo: text, + commit: COMMIT, + command: text, + workflow: text, + job: text, + // Identify tests by the JUnit report's `classname::name`. Match + // `message` as a substring of the failure or skip message. + results: z.array( + z.strictObject({ + test: text, + id: text.optional(), + outcome: z.enum(['failed', 'skipped']), + message: text, + reason: text, + spec: text.optional(), + upstream: text.optional(), + }), + ), + // Group accepted skips by exact message, such as those for unsupported + // capabilities or transports + skipClasses: z.array(z.strictObject({ reason: text, messages: z.array(text).min(1) })), + }) + .optional(), +}); + +export const SupportRecordSchema = z .strictObject({ name: z.enum(SUPPORT_RECORD_NAMES), kind: z.enum(['protocol', 'payment', 'authorization']), @@ -62,6 +101,8 @@ const SupportRecordSchema = z title: text.optional(), role: text.optional(), subset: text.optional(), + // Evidence against the feature's own spec + conformance: ConformanceSchema.optional(), }), ), // `name` is the string the descriptor publishes in `unsupported` @@ -89,49 +130,15 @@ const SupportRecordSchema = z }), ) .optional(), - conformance: z - .strictObject({ - suite: text, - tests: z.array(text).min(1), - skipped: z.array( - z.strictObject({ - test: text, - reason: text, - spec: text.optional(), - upstream: text.optional(), - }), - ), - // CI suite revision, expected failures and skips, and shared skip messages - upstream: z - .strictObject({ - repo: text, - commit: COMMIT, - command: text, - workflow: text, - job: text, - // Identify tests by the JUnit report's `classname::name`. Match - // `message` as a substring of the failure or skip message. - results: z.array( - z.strictObject({ - test: text, - id: text.optional(), - outcome: z.enum(['failed', 'skipped']), - message: text, - reason: text, - spec: text.optional(), - upstream: text.optional(), - }), - ), - // Group accepted skips by exact message, such as those for unsupported - // capabilities or transports - skipClasses: z.array(z.strictObject({ reason: text, messages: z.array(text).min(1) })), - }) - .optional(), - }) - .optional(), - // Known MUST-level gaps against the pinned revision + conformance: ConformanceSchema.optional(), + // Known MUST-level gaps against the pinned revision, or against the spec + // of the feature named in `feature` gaps: z.array( - z.strictObject({ requirement: text, state: z.enum(['open', 'closed', 'excluded']) }), + z.strictObject({ + requirement: text, + state: z.enum(['open', 'closed', 'excluded']), + feature: text.optional(), + }), ), docs: z.array(text).min(1), }) @@ -167,6 +174,23 @@ const SupportRecordSchema = z message: `feature "${feature.name}" needs title, role and subset exactly when it has a spec`, }); } + if (feature.conformance !== undefined && feature.spec === undefined) { + ctx.addIssue({ + code: 'custom', + path: ['features'], + message: `feature "${feature.name}" has conformance evidence but no spec to hold it against`, + }); + } + } + const specified = record.features.filter((feature) => feature.spec !== undefined); + for (const gap of record.gaps) { + if (gap.feature !== undefined && !specified.some((feature) => feature.name === gap.feature)) { + ctx.addIssue({ + code: 'custom', + path: ['gaps'], + message: `gap "${gap.requirement}" names "${gap.feature}", which is not a feature with its own spec`, + }); + } } if (record.combinations !== undefined && record.kind !== 'payment') { ctx.addIssue({ @@ -197,15 +221,22 @@ export function readSupportRecord(name: SupportRecordName): SupportRecord { return parsed.data; } +type Conformance = z.infer; + +const conformancePaths = (conformance: Conformance | undefined) => [ + ...(conformance?.tests ?? []), + ...(conformance?.skipped ?? []).map((skipped) => skipped.test), + ...(conformance?.upstream !== undefined ? [conformance.upstream.workflow] : []), +]; + /** Evidence and documentation paths to check for existence, each once */ export function citedPaths(record: SupportRecord): string[] { return [ ...new Set([ ...record.artifacts.map((artifact) => artifact.path), ...(record.combinations ?? []).map((combination) => combination.evidence), - ...(record.conformance?.tests ?? []), - ...(record.conformance?.skipped ?? []).map((skipped) => skipped.test), - ...(record.conformance?.upstream !== undefined ? [record.conformance.upstream.workflow] : []), + ...conformancePaths(record.conformance), + ...record.features.flatMap((feature) => conformancePaths(feature.conformance)), ...record.deviations.flatMap((deviation) => deviation.tests), ...record.docs, ]), @@ -608,18 +639,50 @@ function handWrittenProblems(tree: SupportTree): string[] { const SUPPORTED_BEFORE_CRITERIA: ReadonlySet = new Set(['http', 'mcp', 'x402']); // Report unmet promotion checks from docs/protocols.md -function promotionProblems(record: SupportRecord): string[] { - if (record.status !== 'supported' || SUPPORTED_BEFORE_CRITERIA.has(record.name)) return []; - const open = record.gaps.filter((gap) => gap.state === 'open'); - const unmet = [ - ...(record.spec?.stable !== true +function unmetCriteria( + spec: Spec | undefined, + gaps: SupportRecord['gaps'], + conformance: Conformance | undefined, + docs: readonly string[], +): string[] { + return [ + ...(spec?.stable !== true ? ['criterion 1: upstream does not declare the pinned revision stable (spec.stable)'] : []), - ...open.map((gap) => `criterion 2: the gap "${gap.requirement}" is open`), - ...(record.conformance === undefined ? ['criterion 3: no conformance evidence'] : []), - ...(record.docs.length === 0 ? ['criterion 4: no operational docs'] : []), + ...gaps + .filter((gap) => gap.state === 'open') + .map((gap) => `criterion 2: the gap "${gap.requirement}" is open`), + ...(conformance === undefined ? ['criterion 3: no conformance evidence'] : []), + ...(docs.length === 0 ? ['criterion 4: no operational docs'] : []), ]; - return unmet.map((problem) => `src/support/${record.name}.json: supported, but ${problem}`); +} + +// Supported records use untagged gaps unless exempt from promotion checks. +// Supported features with their own specs use only their tagged gaps, even +// inside exempt records. +function promotionProblems(record: SupportRecord): string[] { + const source = `src/support/${record.name}.json`; + const tagged = (feature: string | undefined) => + record.gaps.filter((gap) => gap.feature === feature); + const problems = + record.status !== 'supported' || SUPPORTED_BEFORE_CRITERIA.has(record.name) + ? [] + : unmetCriteria(record.spec, tagged(undefined), record.conformance, record.docs).map( + (problem) => `${source}: supported, but ${problem}`, + ); + for (const feature of record.features) { + if (feature.spec === undefined || feature.status !== 'supported') continue; + const unmet = unmetCriteria( + feature.spec, + tagged(feature.name), + feature.conformance, + record.docs, + ); + problems.push( + ...unmet.map((problem) => `${source}: feature "${feature.name}" supported, but ${problem}`), + ); + } + return problems; } /** Every disagreement between the records, package.json and the docs, each naming its place */ diff --git a/src/protocols/a2a/message-mapping.ts b/src/protocols/a2a/message-mapping.ts index 73797b0..bf91d8b 100644 --- a/src/protocols/a2a/message-mapping.ts +++ b/src/protocols/a2a/message-mapping.ts @@ -92,7 +92,7 @@ export function readMessage(rawParams: unknown): A2aMessageParams { ); } const message = parsed.data.message; - // A2A requires a message id. This adapter also rejects an empty one. + // A2A requires a message id. This adapter also rejects an empty one if (message.messageId === undefined || message.messageId.length === 0) { throw invalid('Message must carry a non-empty "messageId".'); } diff --git a/src/protocols/a2a/types.ts b/src/protocols/a2a/types.ts index b20470e..73efcde 100644 --- a/src/protocols/a2a/types.ts +++ b/src/protocols/a2a/types.ts @@ -103,8 +103,8 @@ export interface A2aTaskStatus { } /** - * A task with no `history`. `GetTask` finds none; a pending x402 task can - * only be resumed with a payment message that names its id. + * A task with no `history`. A pending x402 task resumes only through a + * payment message that names its id. */ export interface A2aTask { readonly id: string; diff --git a/src/support/a2a.json b/src/support/a2a.json index 136a9b6..0793fb4 100644 --- a/src/support/a2a.json +++ b/src/support/a2a.json @@ -26,7 +26,34 @@ { "name": "ListTasks", "status": "supported" }, { "name": "CancelTask", "status": "supported" }, { "name": "returnImmediately", "status": "supported" }, - { "name": "x402-extension", "status": "experimental" } + { + "name": "x402-extension", + "status": "experimental", + "spec": { + "revisions": ["v0.1"], + "display": "v0.1.0, commit `a5590226`", + "source": { + "repo": "google-agentic-commerce/a2a-x402", + "commit": "a5590226fc4190fe7a9d2c13ab70128714db3125" + }, + "stable": null, + "statement": "A2A Protocol: x402 Payments Extension v0.1", + "checked": "2026-11-26" + }, + "title": "A2A x402 extension", + "role": "A2A feature: x402 payment inside a task, through status message metadata and a follow-up payment message.", + "subset": "`TASK_STATE_INPUT_REQUIRED` with x402 v2 requirements, payment by a follow-up message on the task, receipts in the final status; A2A 1.0 wire forms, x402 only", + "conformance": { + "suite": "Our tests against the MUST statements of a2a-x402 v0.1; upstream's tests cover only its Python library.", + "tests": [ + "tests/integration/a2a-x402-extension.test.ts", + "tests/unit/protocols-a2a/x402-extension.test.ts", + "tests/unit/protocols-a2a/payment-resume.test.ts", + "tests/unit/protocols-a2a/agent-card.test.ts" + ], + "skipped": [] + } + } ], "exclusions": [ { "name": "SendStreamingMessage" }, @@ -333,6 +360,76 @@ { "requirement": "§7.1: encrypted communication in production; config accepts an http merchant.publicBaseUrl, and doctor warns when its host is not loopback", "state": "closed" + }, + { + "requirement": "§2: use the extension URI to declare and activate the extension", + "state": "closed", + "feature": "x402-extension" + }, + { + "requirement": "§3: declare the extension in the Agent Card's capabilities.extensions, which the card does when a skill selects x402", + "state": "closed", + "feature": "x402-extension" + }, + { + "requirement": "§3.1: clients understand x402 when the extension is required; the card declares it optional, and clients without it pay with _payment", + "state": "closed", + "feature": "x402-extension" + }, + { + "requirement": "§4.5: the payment message carries taskId; the adapter finds the task by taskId alone, and an unknown id gets TaskNotFoundError", + "state": "closed", + "feature": "x402-extension" + }, + { + "requirement": "§4.5: the final status message carries every receipt of the task; a task allows one settlement attempt", + "state": "closed", + "feature": "x402-extension" + }, + { + "requirement": "§6: append each settlement attempt to x402.payment.receipts, never replace one", + "state": "closed", + "feature": "x402-extension" + }, + { + "requirement": "§7: clients activate with X-A2A-Extensions; the adapter also accepts A2A-Extensions", + "state": "closed", + "feature": "x402-extension" + }, + { + "requirement": "§7: echo the extension URI in the response headers of an activating request", + "state": "closed", + "feature": "x402-extension" + }, + { + "requirement": "§8: on failure, payment-failed and a reason in the status message text and metadata", + "state": "closed", + "feature": "x402-extension" + }, + { + "requirement": "§9: private keys stay with trusted entities, never an LLM; the gateway holds no buyer or merchant key and runs no model", + "state": "closed", + "feature": "x402-extension" + }, + { + "requirement": "§9: verify every signature before settlement", + "state": "closed", + "feature": "x402-extension" + }, + { + "requirement": "§9: validate all payment data structures", + "state": "closed", + "feature": "x402-extension" + }, + { + "requirement": "§9: track used nonces against replay", + "state": "closed", + "feature": "x402-extension" + }, + { + "requirement": "§9: all A2A traffic over HTTPS/TLS; TLS is the deployment's, and doctor warns on a public http base URL", + "state": "closed", + "feature": "x402-extension" } ], "docs": ["docs/protocols/a2a.md"] diff --git a/tests/integration/support-record.test.ts b/tests/integration/support-record.test.ts index 0408633..271d220 100644 --- a/tests/integration/support-record.test.ts +++ b/tests/integration/support-record.test.ts @@ -17,6 +17,7 @@ import { SUPPORT_RECORD_NAMES, type SupportRecord, type SupportRecordName, + SupportRecordSchema, type SupportTree, supportProblems, } from '../../scripts/support-record'; @@ -31,6 +32,7 @@ import { MPP_SPEC_COMMIT, MPP_SPEC_DRAFTS } from '../../src/payments/mpp/constan import { X402_VERSION } from '../../src/payments/x402/provider/constants'; import { A2A_SPEC_VERSION, A2A_UNSUPPORTED_METHODS } from '../../src/protocols/a2a/constants'; import { buildDescriptor as buildA2aDescriptor } from '../../src/protocols/a2a/descriptor'; +import { A2A_X402_EXTENSION_URI } from '../../src/protocols/a2a/x402-extension'; import { ACP_SPEC_VERSION } from '../../src/protocols/acp/constants'; import { buildDescriptor as buildAcpDescriptor } from '../../src/protocols/acp/descriptor'; import { MCP_MODERN_PROTOCOL_REVISION } from '../../src/protocols/mcp/constants'; @@ -55,6 +57,39 @@ describe('support records', () => { for (const name of SUPPORT_RECORD_NAMES) expect(records[name].name).toBe(name); }); + const schemaIssues = (change: (a2a: SupportRecord) => void) => { + const a2a = structuredClone(records.a2a); + change(a2a); + return SupportRecordSchema.safeParse(a2a).error?.issues.map((issue) => issue.message); + }; + + it('accepts the real a2a record', () => { + expect(schemaIssues(() => {})).toBeUndefined(); + }); + + it.each([ + ['a feature without a spec', 'GetTask'], + ['an unknown feature', 'x402-extensions'], + ])('refuses a gap tagged with %s', (_label, featureName) => { + expect( + schemaIssues((a2a) => { + a2a.gaps.push({ requirement: '§1: something', state: 'open', feature: featureName }); + }), + ).toEqual([ + `gap "§1: something" names "${featureName}", which is not a feature with its own spec`, + ]); + }); + + it('refuses conformance evidence on a feature without a spec', () => { + expect( + schemaIssues((a2a) => { + const getTask = a2a.features.find((entry) => entry.name === 'GetTask'); + if (getTask === undefined) throw new Error('no GetTask feature'); + getTask.conformance = { suite: 'ours', tests: ['tests/x.test.ts'], skipped: [] }; + }), + ).toEqual(['feature "GetTask" has conformance evidence but no spec to hold it against']); + }); + it('lists tested combinations on the payment records only', () => { expect(SUPPORT_RECORD_NAMES.filter((name) => records[name].combinations !== undefined)).toEqual( ['x402', 'mpp'], @@ -194,6 +229,11 @@ describe('revisions the records restate from code', () => { expect(records.x402.spec?.revisions).toEqual([`v${X402_VERSION}`]); }); + it('the a2a x402 extension: the version in its URI', () => { + const extension = records.a2a.features.find((feature) => feature.name === 'x402-extension'); + expect(extension?.spec?.revisions).toEqual([A2A_X402_EXTENSION_URI.split('/').pop()]); + }); + it('mpp: the three pinned drafts and their commit', () => { expect(records.mpp.spec?.revisions).toEqual(Object.values(MPP_SPEC_DRAFTS)); expect(records.mpp.spec?.source.commit).toBe(MPP_SPEC_COMMIT); @@ -245,6 +285,11 @@ describe('drift between the records, package.json and the docs', () => { if (found === undefined) throw new Error(`no ${name} record`); return found; }; + const feature = (records: SupportRecord[], name: SupportRecordName, featureName: string) => { + const found = record(records, name).features.find((entry) => entry.name === featureName); + if (found === undefined) throw new Error(`no ${featureName} feature in ${name}`); + return found; + }; const stale = (path: string, region: string, source: string) => `${path}: region "${region}" differs from ${source}; run npm run support:write`; @@ -258,7 +303,7 @@ describe('drift between the records, package.json and the docs', () => { const HAND_EDIT: Change = { edit: { 'README.md': (content) => - content.replace('| **MPP** | Experimental', '| **MPP** | Supported '), + content.replace(/(\| \*\*MPP\*\* +\| )Experimental/, '$1Supported '), }, }; const MARKERS_REMOVED: Change = { @@ -388,6 +433,76 @@ describe('drift between the records, package.json and the docs', () => { }, ['src/support/a2a.json: supported, but criterion 4: no operational docs'], ], + [ + 'a supported feature whose upstream revision is not stable', + { + records: (records) => { + feature(records, 'a2a', 'x402-extension').status = 'supported'; + }, + }, + [ + 'src/support/a2a.json: feature "x402-extension" supported, but criterion 1: upstream does not declare the pinned revision stable (spec.stable)', + stale('README.md', 'matrix', ALL), + stale('docs/protocols.md', 'matrix', ALL), + ], + ], + [ + 'a supported feature with an open gap of its own and no evidence', + { + records: (records) => { + const extension = feature(records, 'a2a', 'x402-extension'); + extension.status = 'supported'; + if (extension.spec !== undefined) extension.spec.stable = true; + delete extension.conformance; + record(records, 'a2a').gaps.push({ + requirement: '§9.9: something', + state: 'open', + feature: 'x402-extension', + }); + }, + }, + [ + 'src/support/a2a.json: feature "x402-extension" supported, but criterion 2: the gap "§9.9: something" is open', + 'src/support/a2a.json: feature "x402-extension" supported, but criterion 3: no conformance evidence', + stale('README.md', 'matrix', ALL), + stale('docs/protocols.md', 'matrix', ALL), + stale('docs/protocols/a2a.md', 'pins', 'src/support/a2a.json and package.json'), + ], + ], + [ + 'a supported profile with an open gap tagged with an experimental feature', + { + records: (records) => { + record(records, 'a2a').gaps.push({ + requirement: '§9.9: something', + state: 'open', + feature: 'x402-extension', + }); + }, + }, + [], + ], + [ + 'a supported feature with its own spec in a profile supported before the criteria', + { + records: (records) => { + feature(records, 'x402', 'erc-8409-quotes').status = 'supported'; + }, + }, + [ + 'src/support/x402.json: feature "erc-8409-quotes" supported, but criterion 1: upstream does not declare the pinned revision stable (spec.stable)', + 'src/support/x402.json: feature "erc-8409-quotes" supported, but criterion 3: no conformance evidence', + stale('README.md', 'matrix', ALL), + stale('docs/protocols.md', 'matrix', ALL), + ], + ], + [ + "a deleted test cited as a feature's conformance evidence", + { deleted: 'tests/unit/protocols-a2a/payment-resume.test.ts' }, + [ + 'src/support/a2a.json: cites tests/unit/protocols-a2a/payment-resume.test.ts, which does not exist', + ], + ], [ 'an open gap on a profile supported before the criteria', { From f7d81648946d6f177fda498d676db6a9d7ad4df6 Mon Sep 17 00:00:00 2001 From: Revinand Date: Thu, 26 Nov 2026 16:31:19 +0100 Subject: [PATCH 2/5] fix: correct the stated log levels for offer health and facilitator reasons --- README.md | 4 +++- docs/security.md | 7 ++++--- .../skills/agent-commerce/references/troubleshooting.md | 2 +- src/cli/commands/doctor/payments.ts | 2 +- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index c5c6963..ec8be14 100644 --- a/README.md +++ b/README.md @@ -538,7 +538,9 @@ Score: 10/10 checks passed `doctor` compares live settlement terms with local config for each rail and resource: offer order, network, token, payee and transfer method, plus decimals and payment flows when published. Mismatches fail the check. It also names -failing offers when health is published; reasons appear in gateway debug logs. +failing and degraded offers when health is published. The gateway logs +reported rail health details at warn when a rail starts failing, and at +debug otherwise. `Secrets` lists each config placeholder (`${VAR}`) as missing, set or defaulted. Config loading stops at the first missing variable; this check diff --git a/docs/security.md b/docs/security.md index a9e5347..720c30b 100644 --- a/docs/security.md +++ b/docs/security.md @@ -391,7 +391,7 @@ real funds. | **EVM token decimals that differ from `assetDecimals`** | health fails, naming both values | `tests/unit/payments-x402/provider-health-mocked.test.ts`, `tests/e2e/payment/x402-builtin-token.e2e.test.ts` | | **x402 options on two networks sharing one RPC endpoint, or mixing testnet and mainnet** | `CONFIG_INVALID` at load | `tests/unit/config/x402-options.test.ts` | | **a proof for an x402 offer absent from the resource's own list** | refused before the facilitator: `invalid_network` on another network, `invalid_payment_requirements` otherwise; balances unchanged | `tests/e2e/payment/x402-multichain.e2e.test.ts`, `tests/unit/payments-x402/provider-remote-facilitator.test.ts` | -| **the reason an x402 offer fails its health check, which can name an RPC host** | discovery publishes only each offer's `status`; the gateway logs the reason at debug level | `tests/unit/gateway/server.test.ts` | +| **the reason an x402 offer fails its health check, which can name an RPC host** | discovery publishes each offer's `status` without the diagnostic reason; the gateway logs reported rail health details at warn when the rail starts failing, and at debug otherwise | `tests/unit/gateway/server.test.ts`, `tests/unit/gateway/readiness.test.ts` | | replay, sequentially | refused, no second transfer | `tests/e2e/payment/x402-settlement.e2e.test.ts`, `tests/mainnet/x402.smoke.test.ts` | | **duplicate concurrent request** | settles once, other gets `PAYMENT_REPLAYED` | `tests/integration/adversarial-payment.test.ts` | | **replay after a gateway restart** | still refused - the reservation is in SQLite | same | @@ -646,8 +646,9 @@ nothing was sent. Facilitator rejection reasons reach clients and storage only after trimming and a 128-character, `[A-Za-z0-9_.-]` check. Other values become the fixed token -`invalid_payment` during verification or `settlement_failed` during settlement; -the raw value, with any URL cut to its origin, is available only in debug logs. +`invalid_payment` during verification or `settlement_failed` during settlement. +Raw reasons are logged at debug for rejections and at warn for uncertain +settlement outcomes, with URLs reduced to their origins. ## OpenAPI import diff --git a/plugins/agent-commerce-gateway/skills/agent-commerce/references/troubleshooting.md b/plugins/agent-commerce-gateway/skills/agent-commerce/references/troubleshooting.md index 061fb01..cac2e3b 100644 --- a/plugins/agent-commerce-gateway/skills/agent-commerce/references/troubleshooting.md +++ b/plugins/agent-commerce-gateway/skills/agent-commerce/references/troubleshooting.md @@ -93,5 +93,5 @@ appends `[not determined: ]`. | `Backend` | No HTTP response from some or all distinct configured URLs. Probes use GET without backend headers or a body, substitute `demo-check` for path parameters and accept any HTTP status as reachable. Check the API and `MERCHANT_API_BASE_URL`; a PASS does not verify the configured operation | | `Protocols` | The gateway's `/.well-known/agent-commerce` gave no answer or a non-2xx status | | `Payments`, `Payments (MPP)` | The running gateway's live offers or MPP setting differ from the config, usually because it runs an older config. Restart it | -| `Payments (offers)`, `Payments (MPP offers)` | `FAIL`: an offer's health check fails; `WARN`: one is degraded. `unreachable` means every failing or degraded offer has a recognized RPC or facilitator transport failure. Unmarked failures can indicate a bad response, a hostname that does not resolve, a TLS error, or a missing Solana, NEAR or CDP peer. Inspect `/ready`; the gateway logs each reason at debug level | +| `Payments (offers)`, `Payments (MPP offers)` | `FAIL`: an offer's health check fails; `WARN`: one is degraded. `unreachable` means every failing or degraded offer has a recognized RPC or facilitator transport failure. Unmarked failures can indicate a bad response, a hostname that does not resolve, a TLS error, or a missing Solana, NEAR or CDP peer. Inspect `/ready`; the gateway logs reported rail health details at warn when the rail starts failing, and at debug otherwise | | `Storage` | `WARN`: no receipts file at `storage.receipts.path` yet, or the running gateway uses another path. `FAIL`: the file cannot be opened | diff --git a/src/cli/commands/doctor/payments.ts b/src/cli/commands/doctor/payments.ts index e452d29..0f4ef58 100644 --- a/src/cli/commands/doctor/payments.ts +++ b/src/cli/commands/doctor/payments.ts @@ -336,7 +336,7 @@ function offerHealthCheck( return { name, status: failing.length > 0 ? 'FAIL' : 'WARN', - detail: `${problems.join('; ')}. The gateway logs each reason at debug level`, + detail: `${problems.join('; ')}. The gateway logs the reasons at warn when the rail starts failing, then at debug`, ...undeterminedField(unanswered ? 'unreachable' : undefined), }; } From 3df3fd4e7c3e3d0bd9f1237a3dd58aa8c4d9c2fd Mon Sep 17 00:00:00 2001 From: Revinand Date: Thu, 26 Nov 2026 17:39:24 +0100 Subject: [PATCH 3/5] fix(support): extend the status and promotion checks to features --- README.md | 10 ++- docs/protocols.md | 7 +- .../skills/agent-commerce/SKILL.md | 6 +- scripts/support-record.ts | 57 +++++++++--- src/support/a2a.json | 3 +- tests/integration/support-record.test.ts | 88 +++++++++++++++++++ 6 files changed, 148 insertions(+), 23 deletions(-) diff --git a/README.md b/README.md index ec8be14..cd8ec52 100644 --- a/README.md +++ b/README.md @@ -314,7 +314,7 @@ See [docs/configuration.md](docs/configuration.md). | **MCP** | Supported | MCP `2026-07-28` and `2025-11-25`; `@modelcontextprotocol/server@2.3.0` | tool discovery, invocation, payment-required and error mapping | | **x402** | Supported | x402 v2; `@x402/core@2.30.0`, `@x402/evm@2.30.0`, `@x402/svm@2.30.0`, `@x402/near@2.30.0` | `exact` on EVM through EIP-3009 or Permit2, on Solana, and on NEAR (partial): challenge, verification, settlement and replay binding | | **MPP** | Experimental | drafts at `tempoxyz/mpp-specs@806fdb8`; `mppx@0.13.1` | `charge`/`evm`/EIP-3009 with USDC on Base Sepolia and Base, over HTTP, MCP and A2A | -| **A2A** | Supported | v1.0.1; negotiation `1.0`; `JSONRPC` binding | Agent Card, `SendMessage` with `returnImmediately`, `GetTask`, `ListTasks`, `CancelTask` and the paid flow; the x402 extension is experimental | +| **A2A** | Supported | v1.0.1; negotiation `1.0`; `JSONRPC` binding | Agent Card, `SendMessage` with `returnImmediately`, `GetTask`, `ListTasks`, `CancelTask` and the paid flow | | **ACP** | Experimental | stable snapshot `2026-04-17`; REST binding | discovery and the five checkout operations | | **AP2** | Experimental | v0.2.0, tag 2026-04-28, commit `b4587ac`; Direct mode; `jose@6.2.12`, `@sd-jwt/core@0.20.1`, `canonicalize@5.0.0` | closed Checkout Mandate verification before settlement | | **ERC-8409** | Experimental | draft `SergeevDmitry/ERCs@0ee33230` | signed quotes on x402 EVM offers; issuer published in `/.well-known/agent-commerce` | @@ -328,9 +328,11 @@ UCP is planned and has no implementation. mandate before a paid resource settles; the gateway does not issue the mandate or its Checkout Receipt. -The experimental entries above ship off by default with documented subsets: -[A2A](docs/protocols/a2a.md), [ACP](docs/protocols/acp.md), -[AP2](docs/protocols/ap2.md#not-implemented), [MPP](docs/protocols/mpp.md) and +The experimental entries above are disabled by default and cover documented +subsets: +[ACP](docs/protocols/acp.md), [AP2](docs/protocols/ap2.md#not-implemented), +[MPP](docs/protocols/mpp.md), the +[a2a-x402 extension](docs/protocols/a2a.md#x402-extension) and [ERC-8409 quotes](docs/protocols/x402.md#erc-8409-signed-quotes). Supported [MCP](docs/protocols/mcp.md) and [x402](docs/protocols/x402.md) are also scoped. ACP exposes only its five checkout operations; merchant `payment_data` is never diff --git a/docs/protocols.md b/docs/protocols.md index 5e33062..995e397 100644 --- a/docs/protocols.md +++ b/docs/protocols.md @@ -13,7 +13,7 @@ subset. Each protocol's page describes that subset in detail. | **MCP** | Supported | Transport that carries x402 and MPP payments in tool calls. | MCP `2026-07-28` and `2025-11-25`; `@modelcontextprotocol/server@2.3.0` | tool discovery, invocation, payment-required and error mapping | | **x402** | Supported | Payment rail, carried by HTTP, MCP and A2A. | x402 v2; `@x402/core@2.30.0`, `@x402/evm@2.30.0`, `@x402/svm@2.30.0`, `@x402/near@2.30.0` | `exact` on EVM through EIP-3009 or Permit2, on Solana, and on NEAR (partial): challenge, verification, settlement and replay binding | | **MPP** | Experimental | Payment rail, carried by HTTP, MCP and A2A. | drafts at `tempoxyz/mpp-specs@806fdb8`; `mppx@0.13.1` | `charge`/`evm`/EIP-3009 with USDC on Base Sepolia and Base, over HTTP, MCP and A2A | -| **A2A** | Supported | Transport that carries x402 and MPP payments in `SendMessage`, including through the x402 extension. | v1.0.1; negotiation `1.0`; `JSONRPC` binding | Agent Card, `SendMessage` with `returnImmediately`, `GetTask`, `ListTasks`, `CancelTask` and the paid flow; the x402 extension is experimental | +| **A2A** | Supported | Transport that carries x402 and MPP payments in `SendMessage`, including through the x402 extension. | v1.0.1; negotiation `1.0`; `JSONRPC` binding | Agent Card, `SendMessage` with `returnImmediately`, `GetTask`, `ListTasks`, `CancelTask` and the paid flow | | **ACP** | Experimental | Checkout API that forwards checkout operations to the merchant, whose payment handler receives `payment_data`. Gateway checkout routes are free and carry no x402 or MPP payment. | stable snapshot `2026-04-17`; REST binding | discovery and the five checkout operations | | **AP2** | Experimental | Authorization method, not a payment rail: a paid resource can require a verified mandate in addition to its x402 or MPP payment, never instead of it. | v0.2.0, tag 2026-04-28, commit `b4587ac`; Direct mode; `jose@6.2.12`, `@sd-jwt/core@0.20.1`, `canonicalize@5.0.0` | closed Checkout Mandate verification before settlement | | **ERC-8409** | Experimental | x402 feature: EIP-712 signed quotes on the EVM offers of a challenge. | draft `SergeevDmitry/ERCs@0ee33230` | signed quotes on x402 EVM offers; issuer published in `/.well-known/agent-commerce` | @@ -89,8 +89,9 @@ For other supported profiles, `npm test` fails if `spec.stable` is not `true`, a gap is open, `conformance` is missing or `docs` is empty. A feature with its own pinned revision, such as the A2A x402 extension or -ERC-8409 quotes, must meet the same criteria to become supported. Checks use -its `spec`, `conformance` and tagged gaps, plus the parent record's docs. +ERC-8409 quotes, can be supported only if its parent profile is supported +and it meets the same promotion criteria. Checks use its `spec`, +`conformance` and tagged gaps, plus the parent record's docs. Feature checks apply even inside HTTP, MCP and x402 records. A tagged gap affects only the named feature. diff --git a/plugins/agent-commerce-gateway/skills/agent-commerce/SKILL.md b/plugins/agent-commerce-gateway/skills/agent-commerce/SKILL.md index 219c193..f010e90 100644 --- a/plugins/agent-commerce-gateway/skills/agent-commerce/SKILL.md +++ b/plugins/agent-commerce-gateway/skills/agent-commerce/SKILL.md @@ -21,9 +21,9 @@ metadata: The merchant's and buyer's wallet keys stay outside the gateway; some facilitators require separate API credentials. - **Fixed prices, x402 `exact`.** No dynamic pricing, refunds, orders or - custody. MPP, ACP, AP2 and the a2a-x402 extension exist but are experimental. - Use them only when the user asks, and read the upstream docs first. Say - plainly when a request is out of scope. + custody. MPP, ACP, AP2, the a2a-x402 extension and ERC-8409 quotes + exist but are experimental. Use them only when the user asks, and read the + upstream docs first. Say plainly when a request is out of scope. ## Rules diff --git a/scripts/support-record.ts b/scripts/support-record.ts index 28fb0af..9af6518 100644 --- a/scripts/support-record.ts +++ b/scripts/support-record.ts @@ -32,7 +32,7 @@ const SpecSchema = z.strictObject({ source: z.strictObject({ repo: text, commit: COMMIT }), // Whether upstream calls the pinned revision stable; null when unspecified stable: z.boolean().nullable(), - // Upstream's own words on the revision's status + // Upstream's status statement, or its version label if no status is stated statement: text, // The date `statement` was read checked: z.iso.date(), @@ -99,10 +99,13 @@ export const SupportRecordSchema = z // A feature with its own spec gets its own matrix row, under `title` spec: SpecSchema.optional(), title: text.optional(), + // Also recognize this name in status sentences for a feature with its own spec + alias: text.optional(), role: text.optional(), subset: text.optional(), - // Evidence against the feature's own spec - conformance: ConformanceSchema.optional(), + // Evidence for the feature's own spec. CI reads `upstream` from a record's + // conformance, so features cannot declare an upstream suite. + conformance: ConformanceSchema.omit({ upstream: true }).optional(), }), ), // `name` is the string the descriptor publishes in `unsupported` @@ -510,7 +513,12 @@ export function renderRegions( for (const record of records) { const source = `src/support/${record.name}.json`; const page = new Map(); - if (record.spec !== undefined || record.packages.length > 0 || record.artifacts.length > 0) { + if ( + record.spec !== undefined || + record.features.some((feature) => feature.spec !== undefined) || + record.packages.length > 0 || + record.artifacts.length > 0 + ) { page.set('pins', { body: block(pins(record, manifest)), source: `${source} and package.json`, @@ -562,13 +570,19 @@ function replaceRegions(content: string, rendered: ReadonlyMap new RegExp(`(^|[^\\w-])${title.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}(?![\\w-])`).test(text); -// Hand-written sentences that name the experimental profiles +// Hand-written sentences that name the experimental profiles and features. +// They are searched with link targets removed. const STATUS_SENTENCES = [ { path: 'README.md', place: 'Versioning sentence', find: (content: string) => /### Versioning\n\n([\s\S]*?)\n\n/.exec(content)?.[1], }, + { + path: 'README.md', + place: '"experimental entries above" sentence', + find: (content: string) => /The experimental entries above[^.]*\./.exec(content)?.[0], + }, { path: 'plugins/agent-commerce-gateway/skills/agent-commerce/SKILL.md', place: '"exist but are experimental" sentence', @@ -586,18 +600,34 @@ const X402_ROUTES: readonly [string, string][] = [ function handWrittenProblems(tree: SupportTree): string[] { const problems: string[] = []; - const experimental = tree.records.filter((record) => record.status === 'experimental'); + // Each record, followed by its features with their own matrix rows + const claims = tree.records.flatMap((record) => [ + { title: record.title, names: [record.title], status: record.status, record }, + ...record.features.flatMap((feature) => + feature.spec === undefined + ? [] + : [ + { + title: feature.title ?? feature.name, + names: [feature.title ?? feature.name, ...(feature.alias ? [feature.alias] : [])], + status: feature.status, + record, + }, + ], + ), + ]); for (const sentence of STATUS_SENTENCES) { - const text = sentence.find(tree.read(sentence.path) ?? ''); + const content = (tree.read(sentence.path) ?? '').replace(/\]\([^)]*\)/g, ']'); + const text = sentence.find(content); if (text === undefined) { problems.push(`${sentence.path}: ${sentence.place} not found`); continue; } - for (const record of tree.records) { - const named = titleNamed(text, record.title); - if (named !== experimental.includes(record)) { + for (const claim of claims) { + const named = claim.names.some((name) => titleNamed(text, name)); + if (named !== (claim.status === 'experimental')) { problems.push( - `${sentence.path}: the ${sentence.place} ${named ? 'names' : 'omits'} ${record.title}, which src/support/${record.name}.json records as ${record.status}`, + `${sentence.path}: the ${sentence.place} ${named ? 'names' : 'omits'} ${claim.title}, which src/support/${claim.record.name}.json records as ${claim.status}`, ); } } @@ -659,7 +689,7 @@ function unmetCriteria( // Supported records use untagged gaps unless exempt from promotion checks. // Supported features with their own specs use only their tagged gaps, even -// inside exempt records. +// inside exempt records. Their parent record must also be supported. function promotionProblems(record: SupportRecord): string[] { const source = `src/support/${record.name}.json`; const tagged = (feature: string | undefined) => @@ -672,6 +702,9 @@ function promotionProblems(record: SupportRecord): string[] { ); for (const feature of record.features) { if (feature.spec === undefined || feature.status !== 'supported') continue; + if (record.status !== 'supported') { + problems.push(`${source}: feature "${feature.name}" supported inside an experimental record`); + } const unmet = unmetCriteria( feature.spec, tagged(feature.name), diff --git a/src/support/a2a.json b/src/support/a2a.json index 0793fb4..d26d42d 100644 --- a/src/support/a2a.json +++ b/src/support/a2a.json @@ -4,7 +4,7 @@ "title": "A2A", "status": "supported", "role": "Transport that carries x402 and MPP payments in `SendMessage`, including through the x402 extension.", - "subset": "Agent Card, `SendMessage` with `returnImmediately`, `GetTask`, `ListTasks`, `CancelTask` and the paid flow; the x402 extension is experimental", + "subset": "Agent Card, `SendMessage` with `returnImmediately`, `GetTask`, `ListTasks`, `CancelTask` and the paid flow", "spec": { "revisions": ["1.0.1"], "display": "v1.0.1; negotiation `1.0`; `JSONRPC` binding", @@ -41,6 +41,7 @@ "checked": "2026-11-26" }, "title": "A2A x402 extension", + "alias": "a2a-x402 extension", "role": "A2A feature: x402 payment inside a task, through status message metadata and a follow-up payment message.", "subset": "`TASK_STATE_INPUT_REQUIRED` with x402 v2 requirements, payment by a follow-up message on the task, receipts in the final status; A2A 1.0 wire forms, x402 only", "conformance": { diff --git a/tests/integration/support-record.test.ts b/tests/integration/support-record.test.ts index 271d220..a445030 100644 --- a/tests/integration/support-record.test.ts +++ b/tests/integration/support-record.test.ts @@ -90,6 +90,16 @@ describe('support records', () => { ).toEqual(['feature "GetTask" has conformance evidence but no spec to hold it against']); }); + // CI runs only a record's upstream suite; one on a feature would pass criterion 3 unrun + it("refuses an upstream suite in a feature's conformance", () => { + expect( + schemaIssues((a2a) => { + const extension = a2a.features.find((entry) => entry.name === 'x402-extension'); + Object.assign(extension?.conformance ?? {}, { upstream: a2a.conformance?.upstream }); + }), + ).toEqual(['Unrecognized key: "upstream"']); + }); + it('lists tested combinations on the payment records only', () => { expect(SUPPORT_RECORD_NAMES.filter((name) => records[name].combinations !== undefined)).toEqual( ['x402', 'mpp'], @@ -291,6 +301,15 @@ describe('drift between the records, package.json and the docs', () => { return found; }; + // A feature promoted in its record alone, still experimental in hand-written prose + const stillCalledExperimental = (title: string, name: SupportRecordName) => + [ + 'README.md: the Versioning sentence', + 'README.md: the "experimental entries above" sentence', + 'plugins/agent-commerce-gateway/skills/agent-commerce/SKILL.md: the "exist but are experimental" sentence', + ].map( + (place) => `${place} names ${title}, which src/support/${name}.json records as supported`, + ); const stale = (path: string, region: string, source: string) => `${path}: region "${region}" differs from ${source}; run npm run support:write`; const ALL = 'src/support/*.json and package.json'; @@ -364,6 +383,7 @@ describe('drift between the records, package.json and the docs', () => { stale('README.md', 'matrix', ALL), stale('docs/protocols.md', 'matrix', ALL), 'README.md: the Versioning sentence names ACP, which src/support/acp.json records as supported', + 'README.md: the "experimental entries above" sentence names ACP, which src/support/acp.json records as supported', 'plugins/agent-commerce-gateway/skills/agent-commerce/SKILL.md: the "exist but are experimental" sentence names ACP, which src/support/acp.json records as supported', 'docs/protocols/acp.md: says **Experimental.**, but src/support/acp.json records supported', ], @@ -444,6 +464,7 @@ describe('drift between the records, package.json and the docs', () => { 'src/support/a2a.json: feature "x402-extension" supported, but criterion 1: upstream does not declare the pinned revision stable (spec.stable)', stale('README.md', 'matrix', ALL), stale('docs/protocols.md', 'matrix', ALL), + ...stillCalledExperimental('A2A x402 extension', 'a2a'), ], ], [ @@ -467,6 +488,7 @@ describe('drift between the records, package.json and the docs', () => { stale('README.md', 'matrix', ALL), stale('docs/protocols.md', 'matrix', ALL), stale('docs/protocols/a2a.md', 'pins', 'src/support/a2a.json and package.json'), + ...stillCalledExperimental('A2A x402 extension', 'a2a'), ], ], [ @@ -494,6 +516,72 @@ describe('drift between the records, package.json and the docs', () => { 'src/support/x402.json: feature "erc-8409-quotes" supported, but criterion 3: no conformance evidence', stale('README.md', 'matrix', ALL), stale('docs/protocols.md', 'matrix', ALL), + ...stillCalledExperimental('ERC-8409', 'x402'), + ], + ], + [ + 'a supported feature with its own spec inside an experimental record', + { + records: (records) => { + const copy = structuredClone(feature(records, 'a2a', 'x402-extension')); + delete copy.alias; + if (copy.spec !== undefined) copy.spec.stable = true; + record(records, 'mpp').features.push({ + ...copy, + name: 'mpp-extension', + title: 'MPP extension', + status: 'supported', + }); + }, + }, + [ + 'src/support/mpp.json: feature "mpp-extension" supported inside an experimental record', + stale('README.md', 'matrix', ALL), + stale('docs/protocols.md', 'matrix', ALL), + stale('docs/protocols/mpp.md', 'pins', 'src/support/mpp.json and package.json'), + ], + ], + [ + 'a feature with its own spec inside a record that pins nothing', + { + records: (records) => { + const copy = structuredClone(feature(records, 'a2a', 'x402-extension')); + delete copy.alias; + record(records, 'http').features.push({ + ...copy, + name: 'http-extension', + title: 'HTTP extension', + status: 'partial', + }); + }, + }, + [ + stale('README.md', 'matrix', ALL), + stale('docs/protocols.md', 'matrix', ALL), + 'docs/protocols/http.md: region "pins" appears 0 times, not once', + ], + ], + [ + 'an experimental feature missing from the "experimental entries above" sentence under its alias', + { + edit: { + 'README.md': (content) => + content.replace('[a2a-x402 extension](docs', '[payment extension](docs'), + }, + }, + [ + 'README.md: the "experimental entries above" sentence omits A2A x402 extension, which src/support/a2a.json records as experimental', + ], + ], + [ + 'an experimental feature missing from the Versioning sentence', + { + edit: { + 'README.md': (content) => content.replace('ERC-8409 quotes, the', 'the'), + }, + }, + [ + 'README.md: the Versioning sentence omits ERC-8409, which src/support/x402.json records as experimental', ], ], [ From df8a31499b62743dfb54f02160c10105d8c4cf93 Mon Sep 17 00:00:00 2001 From: Revinand Date: Thu, 26 Nov 2026 17:42:37 +0100 Subject: [PATCH 4/5] fix(support): correct the A2A x402 extension's gaps and deviations --- docs/protocols/a2a.md | 1 + src/support/a2a.json | 11 +++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/docs/protocols/a2a.md b/docs/protocols/a2a.md index 2e0f803..6459cdd 100644 --- a/docs/protocols/a2a.md +++ b/docs/protocols/a2a.md @@ -381,6 +381,7 @@ and the tests that verify the behavior. - **A2A 1.0.1 §5.7; `ListTasksResponse.tasks`**: A `ListTasks` page with no matching task has an empty `tasks` array. The proto marks `tasks` REQUIRED, and §5.7 requires a REQUIRED array to hold an element, but an empty result has none to return. Tests: `tests/conformance/a2a/tasks.test.ts`. +- **a2a-x402 v0.1 examples**: The x402 extension uses A2A 1.0 wire forms, such as `TASK_STATE_INPUT_REQUIRED` and `ROLE_USER`, not the A2A 0.3 forms of the v0.1 examples. A payment message with `role: "user"` gets `-32602`, and the task still waits for payment. Tests: `tests/integration/a2a-x402-extension.test.ts`. diff --git a/src/support/a2a.json b/src/support/a2a.json index d26d42d..d727115 100644 --- a/src/support/a2a.json +++ b/src/support/a2a.json @@ -50,7 +50,9 @@ "tests/integration/a2a-x402-extension.test.ts", "tests/unit/protocols-a2a/x402-extension.test.ts", "tests/unit/protocols-a2a/payment-resume.test.ts", - "tests/unit/protocols-a2a/agent-card.test.ts" + "tests/unit/protocols-a2a/agent-card.test.ts", + "tests/unit/core/execution/pipeline.test.ts", + "tests/unit/cli/doctor.test.ts" ], "skipped": [] } @@ -104,6 +106,11 @@ "summary": "A `ListTasks` page with no matching task has an empty `tasks` array. The proto marks `tasks` REQUIRED, and §5.7 requires a REQUIRED array to hold an element, but an empty result has none to return.", "spec": "A2A 1.0.1 §5.7; `ListTasksResponse.tasks`", "tests": ["tests/conformance/a2a/tasks.test.ts"] + }, + { + "summary": "The x402 extension uses A2A 1.0 wire forms, such as `TASK_STATE_INPUT_REQUIRED` and `ROLE_USER`, not the A2A 0.3 forms of the v0.1 examples. A payment message with `role: \"user\"` gets `-32602`, and the task still waits for payment.", + "spec": "a2a-x402 v0.1 examples", + "tests": ["tests/integration/a2a-x402-extension.test.ts"] } ], "conformance": { @@ -398,7 +405,7 @@ "feature": "x402-extension" }, { - "requirement": "§7: echo the extension URI in the response headers of an activating request", + "requirement": "§7: echo the extension URI in the response headers of an activating request; the adapter echoes it on every JSON-RPC result, never on a JSON-RPC error", "state": "closed", "feature": "x402-extension" }, From ae500712b895e942f1410d2c3cfaf108d8ce10d3 Mon Sep 17 00:00:00 2001 From: Revinand Date: Thu, 26 Nov 2026 17:45:10 +0100 Subject: [PATCH 5/5] fix: log unconfirmed x402 settlements and align stated log levels --- docs/security.md | 7 ++++--- .../references/troubleshooting.md | 18 +++++++++--------- src/cli/commands/doctor/payments.ts | 2 +- src/payments/x402/provider/settle.ts | 4 ++++ .../payments-x402/provider-sdk-mocked.test.ts | 15 +++++++++++---- 5 files changed, 29 insertions(+), 17 deletions(-) diff --git a/docs/security.md b/docs/security.md index 720c30b..8f3dc18 100644 --- a/docs/security.md +++ b/docs/security.md @@ -391,7 +391,7 @@ real funds. | **EVM token decimals that differ from `assetDecimals`** | health fails, naming both values | `tests/unit/payments-x402/provider-health-mocked.test.ts`, `tests/e2e/payment/x402-builtin-token.e2e.test.ts` | | **x402 options on two networks sharing one RPC endpoint, or mixing testnet and mainnet** | `CONFIG_INVALID` at load | `tests/unit/config/x402-options.test.ts` | | **a proof for an x402 offer absent from the resource's own list** | refused before the facilitator: `invalid_network` on another network, `invalid_payment_requirements` otherwise; balances unchanged | `tests/e2e/payment/x402-multichain.e2e.test.ts`, `tests/unit/payments-x402/provider-remote-facilitator.test.ts` | -| **the reason an x402 offer fails its health check, which can name an RPC host** | discovery publishes each offer's `status` without the diagnostic reason; the gateway logs reported rail health details at warn when the rail starts failing, and at debug otherwise | `tests/unit/gateway/server.test.ts`, `tests/unit/gateway/readiness.test.ts` | +| **the reason an x402 offer fails its health check, which can name an RPC host** | discovery publishes each offer's `status` without the diagnostic reason; the gateway logs reported rail health details at warn when the rail starts failing, and at debug otherwise | `tests/unit/gateway/server.test.ts`, `tests/unit/gateway/readiness.test.ts` | | replay, sequentially | refused, no second transfer | `tests/e2e/payment/x402-settlement.e2e.test.ts`, `tests/mainnet/x402.smoke.test.ts` | | **duplicate concurrent request** | settles once, other gets `PAYMENT_REPLAYED` | `tests/integration/adversarial-payment.test.ts` | | **replay after a gateway restart** | still refused - the reservation is in SQLite | same | @@ -647,8 +647,9 @@ nothing was sent. Facilitator rejection reasons reach clients and storage only after trimming and a 128-character, `[A-Za-z0-9_.-]` check. Other values become the fixed token `invalid_payment` during verification or `settlement_failed` during settlement. -Raw reasons are logged at debug for rejections and at warn for uncertain -settlement outcomes, with URLs reduced to their origins. +Raw reasons are logged at debug when the facilitator returns a rejection. +SDK revert exceptions and uncertain settlement outcomes are logged at warn. +URLs are reduced to their origins before logging. ## OpenAPI import diff --git a/plugins/agent-commerce-gateway/skills/agent-commerce/references/troubleshooting.md b/plugins/agent-commerce-gateway/skills/agent-commerce/references/troubleshooting.md index cac2e3b..4dc8142 100644 --- a/plugins/agent-commerce-gateway/skills/agent-commerce/references/troubleshooting.md +++ b/plugins/agent-commerce-gateway/skills/agent-commerce/references/troubleshooting.md @@ -85,13 +85,13 @@ network access. An unmarked failure naming `ENOTFOUND`, a certificate or `skipped` check, fix the failing `Config` or `Gateway` first. Text output appends `[not determined: ]`. -| Check | Not passing means | -| -------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `Config` | `validate` would fail; fix that first | -| `Secrets` | `FAIL`: a `${VAR}` placeholder in the config is unset; the detail lists all missing names, never values. Set them in the environment or in a file passed with `--env-file` | -| `Gateway` | `FAIL`: `/health` could not be checked or returned a non-2xx status. The `unreachable` marker identifies recognized transport failures. Check the URL derived from `server.host` and `server.port`, or pass `--gateway `. `WARN`: `/health` passed but `/ready` did not; inspect `/ready` for store, adapter or provider failures | -| `Backend` | No HTTP response from some or all distinct configured URLs. Probes use GET without backend headers or a body, substitute `demo-check` for path parameters and accept any HTTP status as reachable. Check the API and `MERCHANT_API_BASE_URL`; a PASS does not verify the configured operation | -| `Protocols` | The gateway's `/.well-known/agent-commerce` gave no answer or a non-2xx status | -| `Payments`, `Payments (MPP)` | The running gateway's live offers or MPP setting differ from the config, usually because it runs an older config. Restart it | +| Check | Not passing means | +| -------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `Config` | `validate` would fail; fix that first | +| `Secrets` | `FAIL`: a `${VAR}` placeholder in the config is unset; the detail lists all missing names, never values. Set them in the environment or in a file passed with `--env-file` | +| `Gateway` | `FAIL`: `/health` could not be checked or returned a non-2xx status. The `unreachable` marker identifies recognized transport failures. Check the URL derived from `server.host` and `server.port`, or pass `--gateway `. `WARN`: `/health` passed but `/ready` did not; inspect `/ready` for store, adapter or provider failures | +| `Backend` | No HTTP response from some or all distinct configured URLs. Probes use GET without backend headers or a body, substitute `demo-check` for path parameters and accept any HTTP status as reachable. Check the API and `MERCHANT_API_BASE_URL`; a PASS does not verify the configured operation | +| `Protocols` | The gateway's `/.well-known/agent-commerce` gave no answer or a non-2xx status | +| `Payments`, `Payments (MPP)` | The running gateway's live offers or MPP setting differ from the config, usually because it runs an older config. Restart it | | `Payments (offers)`, `Payments (MPP offers)` | `FAIL`: an offer's health check fails; `WARN`: one is degraded. `unreachable` means every failing or degraded offer has a recognized RPC or facilitator transport failure. Unmarked failures can indicate a bad response, a hostname that does not resolve, a TLS error, or a missing Solana, NEAR or CDP peer. Inspect `/ready`; the gateway logs reported rail health details at warn when the rail starts failing, and at debug otherwise | -| `Storage` | `WARN`: no receipts file at `storage.receipts.path` yet, or the running gateway uses another path. `FAIL`: the file cannot be opened | +| `Storage` | `WARN`: no receipts file at `storage.receipts.path` yet, or the running gateway uses another path. `FAIL`: the file cannot be opened | diff --git a/src/cli/commands/doctor/payments.ts b/src/cli/commands/doctor/payments.ts index 0f4ef58..a6671f5 100644 --- a/src/cli/commands/doctor/payments.ts +++ b/src/cli/commands/doctor/payments.ts @@ -336,7 +336,7 @@ function offerHealthCheck( return { name, status: failing.length > 0 ? 'FAIL' : 'WARN', - detail: `${problems.join('; ')}. The gateway logs the reasons at warn when the rail starts failing, then at debug`, + detail: `${problems.join('; ')}. The gateway logs the reasons at warn when the rail starts failing, and at debug otherwise`, ...undeterminedField(unanswered ? 'unreachable' : undefined), }; } diff --git a/src/payments/x402/provider/settle.ts b/src/payments/x402/provider/settle.ts index 70eb9e5..938ee3a 100644 --- a/src/payments/x402/provider/settle.ts +++ b/src/payments/x402/provider/settle.ts @@ -163,6 +163,10 @@ export function createSettle( NO_VERDICT_REASONS.has(sdkResult.errorReason ?? '') || scope.transportFailed() ) { + logger.warn( + { reportedReason: redactedErrorText(sdkResult.errorReason ?? '') }, + 'x402 settle(): settlement was broadcast but could not be confirmed; outcome unknown', + ); throw new CommerceError( 'PAYMENT_PROVIDER_UNAVAILABLE', 'x402 provider: settlement was broadcast but could not be confirmed', diff --git a/tests/unit/payments-x402/provider-sdk-mocked.test.ts b/tests/unit/payments-x402/provider-sdk-mocked.test.ts index 2c65e68..c4a5328 100644 --- a/tests/unit/payments-x402/provider-sdk-mocked.test.ts +++ b/tests/unit/payments-x402/provider-sdk-mocked.test.ts @@ -14,8 +14,8 @@ import { WaitForTransactionReceiptTimeoutError, } from 'viem'; import { beforeEach, describe, expect, it, vi } from 'vitest'; -import type { CommerceResource, PaymentContext } from '../../../src/core'; -import { isCommerceError } from '../../../src/core'; +import type { CommerceResource, Logger, PaymentContext } from '../../../src/core'; +import { isCommerceError, NOOP_LOGGER } from '../../../src/core'; import { createPaymentProof } from '../../../src/payments/x402/client'; import { createX402PaymentProvider } from '../../../src/payments/x402/provider'; import { computeReplayKey } from '../../../src/payments/x402/replay-key'; @@ -110,7 +110,7 @@ describe('provider - SDK-boundary branches (mocked x402/facilitator)', () => { settleMock.mockReset(); }); - function makeProvider() { + function makeProvider(logger: Logger = NOOP_LOGGER) { return createX402PaymentProvider({ network: 'eip155:31337', rpcUrl: RPC_URL, @@ -120,6 +120,7 @@ describe('provider - SDK-boundary branches (mocked x402/facilitator)', () => { assetDecimals: 6, payTo: PAY_TO, facilitator: { mode: 'local', signerPrivateKey: BUYER_PRIVATE_KEY }, + logger, }); } @@ -753,7 +754,8 @@ describe('provider - SDK-boundary branches (mocked x402/facilitator)', () => { // `settlement_pending` means the transfer was broadcast and may be on-chain, // so it becomes an unavailable provider carrying the hash, never a // rejection - const provider = makeProvider(); + const warn = vi.fn(); + const provider = makeProvider({ ...NOOP_LOGGER, warn }); const requirement = await provider.createRequirement(paymentContext()); const proof = await createPaymentProof({ buyerPrivateKey: BUYER_PRIVATE_KEY, @@ -783,6 +785,11 @@ describe('provider - SDK-boundary branches (mocked x402/facilitator)', () => { err.code === 'PAYMENT_PROVIDER_UNAVAILABLE' && err.details?.['transactionHash'] === BROADCAST_TX_HASH, ); + // Keep the reported reason at warn for settlement diagnostics + expect(warn).toHaveBeenCalledWith( + { reportedReason: 'settlement_pending' }, + 'x402 settle(): settlement was broadcast but could not be confirmed; outcome unknown', + ); }); it('settle() omits transactionHash from PAYMENT_PROVIDER_UNAVAILABLE when the broadcast itself never happened', async () => {