fix(orb-broker): improve error handling for token exchange failures - #2710
Merged
Conversation
Codecov Report❌ Patch coverage is
❌ Your patch check has failed because the patch coverage (36.36%) is below the target coverage (99.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## main #2710 +/- ##
==========================================
- Coverage 96.13% 96.10% -0.03%
==========================================
Files 240 241 +1
Lines 26985 27042 +57
Branches 9792 9825 +33
==========================================
+ Hits 25941 25990 +49
- Misses 433 438 +5
- Partials 611 614 +3
🚀 New features to boost your workflow:
|
JSONbored
approved these changes
Jul 3, 2026
14 tasks
19 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR addresses the
orb_broker_unavailable: Orb broker token exchange failed (500)error by improving error handling and providing clearer diagnostics within the Orb broker.Changes Made:
src/api/routes.ts:brokerOrbTokencall in thePOST /v1/orb/tokenroute with a try/catch block. Unhandled exceptions during the token minting process now result in an HTTP 503 response with a generic{ error: "broker_error" }payload, preventing raw 500 errors and potential information leakage. The internal error message is logged server-side.broker_misconfigurederror type also correctly returns an HTTP 503 status.src/orb/broker.ts:ORB_GITHUB_APP_IDandORB_GITHUB_APP_PRIVATE_KEYat the beginning of thebrokerOrbTokenfunction. If these critical environment variables are missing, the function now returns a structured{ error: "broker_misconfigured" }result, allowing for a more graceful and informative error response.console.warn) ifTOKEN_ENCRYPTION_SECRETis not configured. This highlights that the Orb broker's token cache is disabled, which significantly increases the frequency of calls to GitHub's token endpoint and thus the risk of throttling.src/orb/broker-client.ts:.transientproperty to the error object. This property was identified as dead code, as there was no consuming logic to utilize it for retry differentiation.Scope
type(scope): short summaryConventional Commit format, for examplefix(api): restore profile access checks.CONTRIBUTING.mdand does not reintroduce GitHub Pages, VitePress,site/, orCNAME.Validation
git diff --checknpm run actionlintnpm run typechecknpm run test:coveragelocally;codecov/patchrequires ≥99% coverage of the lines AND branches you changed (aim for 100% on your diff so CI variance does not fail near the threshold). Global coverage is a non-blocking trend with a loose 90% backstop, not the gate.npm run test:workersnpm run build:mcpnpm run test:mcp-packnpm run ui:openapi:checknpm run ui:lintnpm run ui:typechecknpm run ui:buildnpm audit --audit-level=moderateIf any required check was skipped, explain why:
Safety
UI Evidence
Required for visible UI, frontend, docs, or extension changes. Attach GitHub-hosted JPG/JPEG or PNG screenshots here; SVG screenshots are not accepted as review evidence. Use a compact table/grid of clickable thumbnails with a short state/title such as "Loaded state", "Empty state", "Error state", "Mobile layout", or "PR sidebar". Prefer annotated screenshots with a colored box, outline, arrow, or highlighter showing what changed. Recordings can be supplemental, but screenshots are still expected for visual review. Do not commit review-only screenshots, recordings, or
docs/review-evidence/**files.<a href="FULL_URL.png"><img src="FULL_URL.png" alt="Loaded state" width="240"></a>Notes
Fixes GITTENSORY-J