Skip to content

fix(a2a): return JSON 404 for unsupported /a2a/v1 paths - #193128

Open
jerome-queck wants to merge 7 commits into
openclaw:mainfrom
jerome-queck:cursor/a2a-namespace-json-404-1a96
Open

jerome-queck wants to merge 7 commits into
openclaw:mainfrom
jerome-queck:cursor/a2a-namespace-json-404-1a96

Conversation

@jerome-queck

@jerome-queck jerome-queck commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #193086

What Problem This Solves

Fixes an issue where a GET to /a2a/v1/agent-card returned HTTP 200 and the Control UI HTML document. Documented discovery and JSON-RPC routes already behaved correctly: GET /a2a/v1 is a JSON 404, /.well-known/agent-card.json and /.well-known/agent.json return agent cards, and POST /a2a/v1 is JSON-RPC.

Why This Change Was Made

The configured A2A plugin now claims /a2a/v1 through the existing prefix registration contract. Unsupported descendants reach the plugin's existing JSON 404. The well-known discovery routes stay exact matches. The generic Control UI router is unchanged.

User Impact

While the A2A account is running, unsupported paths under /a2a/v1 — including GET /a2a/v1/agent-card — return application/json with HTTP 404 and { "error": "Not found" }, for missing and wildcard Accept headers. Neighboring paths such as /a2a/v10 and ordinary Control UI routes still serve the SPA. After the account stops, the namespace is released.

Evidence

  • Before the fix, pnpm test src/gateway/server-http.a2a-namespace.test.ts failed with Control UI enabled and a real index.html: GET /a2a/v1/agent-card (absent Accept) expected 404 and received 200.
  • After the fix, that Gateway regression passed. It covers absent and */* Accept headers, exact GET /a2a/v1 JSON 404, both well-known agent cards, GET /a2a/v1/.well-known/agent-card.json JSON 404, unauthenticated POST /a2a/v1, SPA responses for /chat and /a2a/v10, and the descendant returning the SPA again after the account stops.
  • pnpm test extensions/a2a/src/gateway.test.ts extensions/a2a/src/http.test.ts passed (45 tests).

Live Gateway proof (Linux, isolated)

Built this branch (OpenClaw 2026.10.10 (ce3e7d9)), ran Gateway on loopback port 18991 with an isolated state directory, gateway.auth.mode=none, Control UI enabled, and the A2A plugin started (http server listening (1 plugin: a2a; [a2a] [default] starting account (reason: startup)). Synthetic/local only; no provider keys or non-public endpoints.

While A2A was running:

Request Result
GET /a2a/v1/agent-card (no Accept, and Accept: */*) 404 application/json; charset=utf-8 {"error":"Not found"}
GET /a2a/v1 same JSON 404
GET /a2a/v1/.well-known/agent-card.json same JSON 404
GET /.well-known/agent-card.json and GET /.well-known/agent.json 200 JSON agent cards; interface URL ends in /a2a/v1
POST /a2a/v1 with no bearer 401 JSON
GET /chat and GET /a2a/v10 200 text/html Control UI (<!doctype html>…)

After channels.stop for a2a / default ({"stopped":true}):

  • GET /a2a/v1/agent-card → 200 text/html (namespace released to Control UI)
  • GET /.well-known/agent-card.json → 404 text/plain Not Found
  • GET /chat stayed HTML

After channels.start ({"started":true}), GET /a2a/v1/agent-card was JSON 404 again. Gateway stopped afterward.

Exact registration left descendants to the root Control UI, which answered
GET /a2a/v1/agent-card with HTML 200. Prefix registration keeps the existing
plugin JSON 404 for that namespace.

Fixes openclaw#193086

Co-authored-by: Jerome <[email protected]>
@clawsweeper

clawsweeper Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. labels Nov 5, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. labels Nov 5, 2026
@clawsweeper

clawsweeper Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge.

What this changes

The A2A plugin claims the /a2a/v1 prefix so unsupported descendants return JSON 404 responses instead of Control UI HTML.

Example: GET /a2a/v1/agent-card while the configured A2A account is running.

  • Before: HTTP 200 with the Control UI HTML document.
  • After: HTTP 404 with application/json and {"error":"Not found"}.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The production repair is correct and supported by shipped-entry-point proof, but a proven open replacement already owns the same work.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): The PR body records an isolated running Linux Gateway serving JSON 404 for unsupported descendants, preserving discovery and RPC rejection, and releasing and reclaiming the namespace on account stop/start; subsequent commits change test infrastructure rather than production behavior.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: No · Fix scope: Complete
User problem: A client probing an unsupported A2A endpoint receives successful HTML instead of a JSON error.
Reason: The repair is useful, but merging a separate implementation adds no distinct capability beyond the proven replacement; this PR's broader regression and lifecycle evidence remain available by link.

Merge readiness

⛔ Blocked before merge - 2 items remain

Keep this PR open. PR close coverage proof kept this PR open against #193102: PR B carries the production repair, but the available evidence does not establish coverage of PR A's useful independent integration regression tests. Linking their evidence does not preserve that test coverage.

Priority: P2
Reviewed head: 6448220a918c460a6c77b7a520df3ccab17b9d6e

Before merge

  • Product: not worth merging - The repair is useful, but merging a separate implementation adds no distinct capability beyond the proven replacement; this PR's broader regression and lifecycle evidence remain available by link.
  • Maintainer: close or keep this PR - The review found that this PR may be superseded, but the close check did not confirm that the other PR covers all of its work. A maintainer must close this PR or confirm that it still has work to land.

Findings

None.

Agent review details

How this fits together

Gateway HTTP dispatch matches registered plugin routes before the Control UI fallback; the A2A account owns registration, JSON responses, and route removal on shutdown.

flowchart TD
  A[HTTP request] --> B[Gateway route matching]
  B --> C[A2A prefix handler]
  B --> D[Control UI fallback]
  C --> E[JSON 404 for unsupported paths]
  C --> F[Discovery and authenticated RPC]
Loading

Technical review

Best possible solution:

Keep this PR open until a linked canonical PR proves it covers this PR's unique work, or a maintainer confirms closure.

Do we have a high-confidence way to reproduce the issue?

Current-main exact registration excludes descendants from the existing JSON 404 handler, and both contributors supplied running-Gateway evidence; no target code was executed during this review.

Is this the best way to solve the issue?

Selecting existing prefix matching at the A2A registration owner is the smallest complete production fix, already provided by the replacement PR.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 6769a6931910.

Provenance checked

  • A2A HTTP registration changes intended behavior with a stated reason (59c74d5: The owner consolidation moved private registration and HTTP handling into the channel lifecycle without intended behavior changes.)
  • Gateway lifecycle regression keeps the original intent (ad1e946: The original A2A channel registered discovery and RPC routes and removed them when the account stopped.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

PR surface

Source +158, Tests +129, Docs 0, Config +3, Other +6. Total +296 across 11 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 3 165 7 +158
Tests 2 135 6 +129
Docs 1 1 1 0
Config 1 3 0 +3
Generated 0 0 0 0
Other 4 6 0 +6
Total 11 310 14 +296

Root-cause cluster

Relationship: duplicate
Canonical: #193102
Summary: The open PRs repair the same exact-registration fallthrough reported by the linked issue; the canonical replacement is proven and cleanly mergeable.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: Unsupported A2A paths return misleading successful HTML responses, while documented discovery and JSON-RPC routes remain usable.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • proof: sufficient: Contributor real behavior proof is sufficient.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (1 earlier review cycle)
  • reviewed 2026-11-05T02:12:36.587Z sha ce3e7d9 :: needs real behavior proof before merge. :: none

Reviewed November 5, 2026, 3:19 AM ET / 08:19 UTC (Revision 2).

The gateway test imported the bundled A2A plugin, so the core-test-gateway-server
tsgo graph included extension sources. The same JSON 404 proof now runs from
the plugin, and a 49-line test allocation covers the lines past the remaining
ceiling slack.

Receipt: oc-555-uplift-t1061
Co-authored-by: Jerome <[email protected]>
@openclaw-barnacle openclaw-barnacle Bot removed the gateway Gateway runtime label Nov 5, 2026
Extension tests cannot import the Gateway harness, and core type graphs
cannot import the bundled plugin. The same JSON 404 proof now lives under
test/. The test-line allocation is 129, matching this branch's delta.

Receipt: oc-555-uplift-t1061
Co-authored-by: Jerome <[email protected]>
Root tests cannot import the bundled plugin, and plugin tests cannot import
core Gateway files. A private plugin-sdk HTTP fixture keeps the JSON 404
proof next to A2A. The test-line allocation is 125, matching the delta.

Receipt: oc-555-uplift-t1061
Co-authored-by: Jerome <[email protected]>
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation scripts Repository scripts labels Nov 5, 2026
Stop re-exporting the core harness so plugin-sdk declaration emit does not
pull server-request-context.test-support. Register the package-boundary alias
and match the test-line allocation to this branch's delta.

Co-authored-by: Jerome <[email protected]>
Rename the plugin server helper so it does not collide with the gateway
test helper, drop the chained response assertions, and copy the new
package-boundary alias into the xai map.

Co-authored-by: Jerome <[email protected]>
The assertion-safety ratchet requires a SAFETY comment on the new
ServerResponse cast.

Co-authored-by: Jerome <[email protected]>
@jerome-queck

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. proof: sufficient ClawSweeper judged the real behavior proof convincing. and removed status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. clawsweeper:intake:bug Preliminary submission classification; full source review pending. labels Nov 5, 2026
@jerome-queck

Copy link
Copy Markdown
Contributor Author

Gateway regression suite ported onto HeMiaolin's canonical #193102 via HeMiaolin#1 (against their branch). Leaving this PR open until that lands / a maintainer wants it closed.

HeMiaolin pushed a commit to HeMiaolin/openclaw that referenced this pull request Nov 17, 2026
…3102

Port the table-driven Gateway suite and plugin-sdk HTTP helper from
openclaw#193128 onto this branch. No production-fix changes.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: a2a docs Improvements or additions to documentation extensions: xai P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. scripts Repository scripts size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: GET /a2a/v1/agent-card returns the Control-UI SPA with 200 instead of a JSON 404

1 participant