Skip to content

fix(discovery): full upstream OpenAPI + per-origin agent-registration#777

Open
bussyjd wants to merge 1 commit into
mainfrom
feat/discovery-host-openapi-registration
Open

fix(discovery): full upstream OpenAPI + per-origin agent-registration#777
bussyjd wants to merge 1 commit into
mainfrom
feat/discovery-host-openapi-registration

Conversation

@bussyjd

@bussyjd bussyjd commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes two related production issues on dedicated offer origins (validated against x402scan DISCOVERY.md):

  1. Discovery incompleteness — hostname /openapi.json was a thin route-table doc (often ~8 free paths). x402scan is OpenAPI-first at /openapi.json, so multi-route products (e.g. hl-intel, 95+ paths) were under-indexed.
  2. Registration bleed/.well-known/agent-registration.json had no host-scoped route, so every origin returned the cluster-global AgentIdentity mega-doc (Hyperliquid-data + solar + predictfun + …).

Changes

Surface Before After
GET /openapi.json (hostname) Route-table only Upstream full OAS when available (/v1/openapi.json or metadata openapiPath)
GET /.well-known/x402 One catch-all resource Expanded paid resources from OAS x-payment-info / 402 ops
GET /.well-known/agent-registration.json Global mega-doc Single-offer ERC-8004 doc for that origin

Implementation

  • upstream_openapi.go — fetch + rewrite servers + x402 fan-out + per-offer registration
  • buildOfferBundles — prefer upstream OAS; always emit agent-registration.json
  • buildHostHTTPRoute — Exact match for /.well-known/agent-registration.json (wins over global AgentIdentity route)
  • Tests for host route rule count, upstream OAS injection, registration isolation

Live verification (silvernuc3)

Origin openapi paths x402 resources registration
hyperliquid-data.v1337.org 96 88 Hyperliquid-data only (no bleed)
hyperliquid-analyst.v1337.org 1 1 HyperAnalyst only (no bleed)

Free samples still 200; paid leaderboard still 402.

Test plan

  • go test ./internal/serviceoffercontroller/
  • Live hyperliquid-data/analyst discovery + registration
  • Rebuild/redeploy controller on other stacks
  • Spot-check another multi-route http offer (e.g. marketkit) after rollout

Related: discovery completeness + registration bleed from Hyperliquid health review.

Hostname-bound offers previously advertised a thin route-table OpenAPI
(under-selling multi-route products like hl-intel) and fell through to the
cluster-global AgentIdentity mega-doc for /.well-known/agent-registration.json
(registration bleed across origins).

- Prefer full upstream OAS (/v1/openapi.json) in host openapi.json bundles
  (x402scan OpenAPI-first; see Merit-Systems/x402scan docs/DISCOVERY.md)
- Expand /.well-known/x402 paid resources from that OAS when available
- Publish single-offer ERC-8004 agent-registration.json per dedicated origin
  and Exact-route it so it wins over the global well-known route

Live-verified on hyperliquid-data (96 paths, 88 x402 resources, no bleed)
and hyperliquid-analyst (HyperAnalyst identity only).
bussyjd added a commit that referenced this pull request Jul 16, 2026
…/v0.14.0-rc0

Resolved with #767 hostRouteRules + chat widget: keep hostRouteRules helper,
add /.well-known/agent-registration.json as fourth discovery Exact rule,
and retain both chat-widget and upstream-OpenAPI test suites.
@bussyjd

bussyjd commented Jul 16, 2026

Copy link
Copy Markdown
Contributor Author

Merged into integration/v0.14.0-rc0 (merge commit 8e7d369b). Conflict with #767's hostRouteRules resolved by keeping the helper and adding /.well-known/agent-registration.json as the fourth discovery Exact rule; chat-widget rule counts updated (agent host routes are now 7 rules). Leaving this PR open against main so it can land via the integration train (#756).

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