Repository navigation
fix(registry): probe the A2A agent card at /.well-known/agent-card.json - #8978
Conversation
The health check and both discover-agent endpoints fetched only /.well-known/agent.json, so an agent that serves its card at the A2A well-known URI showed "A2A agent card not found" and was never listed as A2A. Probe /.well-known/agent-card.json only, through one shared helper, and point the wrong_path hint at the same path. Part of adcontextprotocol#7875.
Preview approval requiredThis pull request comes from a fork, so Mintlify won't build a preview until someone with write access approves commit |
There was a problem hiding this comment.
Ladon verdict: Approve
Approve — clean server-only refactor with no blocking findings.
This PR consolidates three duplicated inline A2A agent-card probes into a single hasA2AAgentCard helper and corrects the probed well-known URI from the pre-1.0 /.well-known/agent.json to the A2A §8.2 standard /.well-known/agent-card.json (#7875). Migration is complete across health.ts/http.ts/registry-api.ts; URL resolution, the 3s timeout, SSRF-safe sdkSafeFetch, and fail-closed error handling are all preserved. No schema/dist artifacts touched, and no changeset is correctly omitted (server-only change, out of published protocol surface). Tests cover all three call sites plus the helper.
Decision table walk-through:
- Rows 1: no critical/high findings.
- Row 2: gated_paths is false — does not fire despite review_decision being REVIEW_REQUIRED.
- Row 3: high_risk is true but the only matching reason is a (modified) file, not (deleted).
- Rows 4-5: no medium findings at all.
- Rows 6-8: no prior escalation, no no-auto-approve team match, zero medium findings.
- Row 9: approve.
The high_risk flag fires on server/src/routes/registry-api.ts (modified, matching server/src/routes/**), but the reviewer found no medium-or-higher concerns on that modification, so it is presumed safe. No breaking-class protocol change, no spec/docs surface touched — the breaking-change hard gate does not apply.
Part of #7875.
The well-known location of the A2A agent card is
/.well-known/agent-card.json(A2A §8.2). Agents don't serve/.well-known/agent.json, and clients don't need to probe it. The registry server fetched onlyagent.json, so an agent that serves its card at the A2A path showed "A2A agent card not found" on its health check and was never listed as A2A by the discovery endpoints.Changes
server/src/lib/a2a-agent-card.ts:A2A_AGENT_CARD_PATHandhasA2AAgentCard(url), which fetches the card at the origin ofurlthroughsdkSafeFetchand returns whether it answered 2xx.server/src/http.ts(/api/discover-agent) andserver/src/routes/registry-api.ts(/api/public/discover-agent) each had the same inlineagent.jsonprobe. Both now callhasA2AAgentCard, the same way they shareinferDiagnosticAgentType.server/src/health.ts: the A2A health check fetches${agent.url}/.well-known/agent-card.json, and thewrong_pathhint names that path. The health check still resolves the path against the agent URL, as before; only the file name changed.tests/sdk-safe-fetch-callsites.test.ts: the guard that A2A probes don't use ambient fetch now checks that both endpoints callhasA2AAgentCardand that the helper callssdkSafeFetch.No other code under
server/probesagent.json.adagents-manager.tsalready usesagent-card.json. No changeset: the change is server-only.Tests
Each new test fails for one reason:
server/tests/unit/a2a-agent-card.test.ts: the helper requests only/.well-known/agent-card.jsonat the origin, returns true on 2xx, false on a non-2xx answer, and false when the request fails.server/tests/unit/health-fallback.test.ts: an A2A agent that serves its card only atagent-card.jsonprobes as online; the probe requests only that URL; thewrong_pathhint names/.well-known/agent-card.json.server/tests/unit/discover-agent-serializer.test.ts:/api/public/discover-agentlists["mcp", "a2a"]when the origin servesagent-card.json.Testing
All run in a clean worktree off
origin/mainat a2a7d20, on Node 24.21.0:npx vitest run --config server/vitest.config.ts server/tests/unit/a2a-agent-card.test.ts server/tests/unit/health-fallback.test.ts server/tests/unit/discover-agent-serializer.test.ts: 30 of 30 pass.health.tsandregistry-api.tsreverted to main and the tests kept, the four new health and discover-agent tests fail and the 22 existing ones pass.npm run typecheck: passes.node scripts/check-changeset-protocol-scope.cjs origin/main: passes, no protocol-scoped changes.