Skip to content

fix(orb): /v1/orb/token still returns 500 after the #orb-broker-500 fix (95 Sentry events) #5000

Description

@JSONbored

Summary

POST /v1/orb/token (the Orb token-broker exchange) returns a bare HTTP 500 — 95 events over 10+ days.

Evidence (Sentry)

GITTENSORY-Jorb_broker_unavailable: Orb broker token exchange failed (500). First seen 2026-06-29, last seen 2026-07-09.

Root cause — already investigated, this is NOT a simple "wrap in try-catch" fix

Sentry Seer's summary ("Wrap the entire /v1/orb/token handler in a top-level try-catch so unhandled stream/DB errors return 503 instead of a framework 500") does not match the current code and must not be blindly applied:

  • The handler (src/api/routes.ts:3311) already wraps its brokerOrbToken call in try/catch, returning 503 on any thrown error.
  • readOrbRelayRegisterBody (src/orb/relay.ts:175), the one call in this handler made before that try/catch, was already hardened for exactly this failure mode in commit 65de78ec6e7bf5350e217bc3aa4c62dda9911c88 (2026-07-05, tagged #orb-broker-500 in its own doc comment) — its own comment literally describes fixing "a bare framework 500 instead of the route's own clean 4xx/503 JSON error response."
  • That fix commit is confirmed to be an ancestor of every commit that has run on the self-host box since (verified via git merge-base --is-ancestor).
  • Yet this Sentry issue's last occurrence (2026-07-09) is 4 days after that fix was live in production.

This means the 2026-06-29–07-03 events are likely the original, already-understood bug. The 2026-07-05–07-09 events (after the fix deployed) are either a regression, an incomplete fix (a different unhandled-throw path in brokerOrbToken itself, or in Hono's own routing/middleware layer before this handler is even reached), or evidence the fix's deploy didn't reach production as early as the commit timestamp suggests. Needs to be distinguished by re-checking Sentry's event timestamps against exact deploy windows, not assumed.

Requirements

  1. Confirm precisely which events (by timestamp) occurred before vs. after the 07-05 fix actually went live on the box.
  2. If post-fix events remain: find the actual remaining unhandled-throw path (check brokerOrbToken itself and anything Hono-level ahead of this route) rather than re-applying the same already-shipped fix.
  3. Do not just re-wrap the outer handler again without first confirming that isn't already sufficient.

Deliverables

  • A clear determination of whether this is a regression, an incomplete fix, or stale/resolved data — documented in the PR (or issue comment, if it turns out no code change is needed).
  • If a real remaining gap is found: a fix + regression test for it specifically.

Metadata

Metadata

Assignees

Labels

maintainer-onlyOwner-only work — yields no Gittensor points.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions