Repository navigation
feat(sentry-monitor): classify gateway-relayed upstream 5xx vs gateway-origin 5xx (ENG-16922) - #89
Merged
Conversation
…y-origin 5xx (ENG-16922) The Rohan "Boon Agent 5xx error(s) detected" alert (openclaw-fleet Sentry project) pages with blanket "5xx = our infra. Investigate." copy — but the fleet runs single-hop, where boon-llm-gateway relays an upstream Bedrock 5xx verbatim and never self-captures. The page comes from this plugin's model_call_ended hook, which had no HTTP status to tell a relayed provider outage from a gateway-origin fault. Thread the numeric HTTP status (available on the thrown error post-#83) and a status-derived source class through the model_call_ended hook, and tag the Sentry capture with it so the alert can split/rate-gate the two: - classify5xxSource() in diagnostic-error-metadata.ts: status-driven (no message regex), 500/503/529 -> upstream_provider_5xx, 502/other-5xx -> gateway_origin_5xx, with a recognized api_error/overloaded provider error.type as an ambiguous-status tie-break. - Add httpStatus + errorClass to PluginHookModelCallEndedEvent and the model.call.error diagnostic event; populate both in modelCallErrorFields. - Tag error_class + extra.http_status in buildModelCallEndedCapture; lead the Sentry title with them so the two classes fingerprint into separate issues. - Tests for classify5xxSource + the capture; docs/gateway/sentry-monitor.md tag table + note. The alert threshold/rate-gate/copy are Sentry-UI-configured and land after this ships fleet-wide (see gandalf-manager spec docs/specs/2026-07-29-eng16922-5xx-source-classification.md). tsgo:prod clean; oxlint clean; 57 targeted tests pass. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
|
Claude encountered an error —— View job I'll analyze this and get back to you. |
There was a problem hiding this comment.
cubic analysis
All reported issues were addressed across 9 files
Linked issue analysis
Linked issue: ENG-16922: Rohan 5xx alert: distinguish upstream-provider (Bedrock) 5xx from gateway-origin 5xx
| Status | Acceptance criteria | Notes |
|---|---|---|
| ✅ | Add classify5xxSource() that maps 500/503/529 → upstream_provider_5xx, 502/other 5xx → gateway_origin_5xx, uses provider error.type (api_error/overloaded*) as tie-break, and returns undefined for non-5xx. | Function implemented with status bands, provider-type tie-break, own-data-property reads, and non-5xx returns undefined. |
| ✅ | Thread httpStatus and errorClass into diagnostic model-call error fields and plugin hook (so downstream observers can read them). | Diagnostic event types and plugin hook types were extended and modelCallErrorFields now extracts and populates httpStatus and errorClass. |
| ✅ | Tag Sentry captures with error_class and include extra.http_status; lead the Sentry message/title with class + status so they fingerprint separately. | buildModelCallEndedCapture now includes error_class in tags and http_status in extra; describeModelCallError composes message parts with errorClass/httpStatus. |
| ✅ | Provide unit tests verifying classify5xxSource behavior and that captures carry tags/extra/message for upstream vs gateway 5xx and omit the class when absent. | New tests cover status bands, tie-breaks, getter-safety, and capture expectations (tags/extra/message) and an omission case. |
| ✅ | Update docs to mention error_class and http_status and explain intended alert behavior for upstream vs gateway 5xx. | The sentry-monitor docs were updated to list error_class in the model_call_ended tags and describe classification purpose and usage. |
Reply with feedback, questions, or to request a fix.
Fix all with cubic | Re-trigger cubic
…eak types (ENG-16922) Address cubic review P3: the classify5xxSource tie-break matches api_error/overloaded/overloaded_error (UPSTREAM_PROVIDER_ERROR_TYPES), but the doc listed only api_error/overloaded. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
There was a problem hiding this comment.
Approving — clean, well-scoped fix for ENG-16922.
Verified live:
- Ran the targeted suites on the PR branch: 47/47 pass (
classify5xxSourcestatus-bands/tie-break/getter-safety/non-5xx +buildModelCallEndedCapturerelayed-503/synth-502/non-5xx tag+title). - CI
check-prod-types+check-lint+ all boundary/quality checks green.
What I like:
- Status-driven classification with no message regex — respects the fragility ENG-16815 deliberately removed.
- Getter-safe throughout (
readOwnDataPropertyreads own data descriptors only; the getter-safety test proves it). - Tie-break recurses into
error/causeso a relayed providerapi_errorbody wins over the synthesized-502 heuristic — internally consistent with the single-hop model. - Conservative default (unknown 5xx →
gateway_origin_5xx) is the right bias: page on our infra, rate-gate provider blips. - Fields are additive + optional; no change to failover behavior; docs tag-table updated (incl. the
overloaded_errorP3 follow-up).
No blocking issues.
convyusboy
added a commit
that referenced
this pull request
Jul 30, 2026
Version-bump release carrying the 3 commits merged onto boon since boon.11: - #86: edge/WAF HTML 429 now classifies as transient timeout (not model rate_limit), so a Cloudflare-relayed 429 no longer surfaces a false 'all models rate-limited'; the client-side ride-out retry still absorbs it. - #88: DEBUG-level trace of the Slack thread-resolution decision on the agent message-send tool path (sendMessage/uploadFile); observability only, no behavior change, message content never logged. - #89: sentry-monitor classifies gateway-relayed upstream (Bedrock) 5xx vs gateway-origin 5xx via classify5xxSource(), tagging error_class + http_status on the model_call_ended capture so the Rohan alert can split/rate-gate them. Bumps the gateway + @openclaw/slack + @openclaw/msteams to 2026.6.11-boon.12 in lockstep (7 files: 3 package.json, 3 npm-shrinkwrap.json, CHANGELOG.md). Tagging v2026.6.11-boon.12 after merge triggers boon-release.yml to publish the 6 assets.
convyusboy
added a commit
that referenced
this pull request
Jul 31, 2026
…ease asset (ENG-15788) (#94) * release: 2026.6.11-boon.12 Version-bump release carrying the 3 commits merged onto boon since boon.11: - #86: edge/WAF HTML 429 now classifies as transient timeout (not model rate_limit), so a Cloudflare-relayed 429 no longer surfaces a false 'all models rate-limited'; the client-side ride-out retry still absorbs it. - #88: DEBUG-level trace of the Slack thread-resolution decision on the agent message-send tool path (sendMessage/uploadFile); observability only, no behavior change, message content never logged. - #89: sentry-monitor classifies gateway-relayed upstream (Bedrock) 5xx vs gateway-origin 5xx via classify5xxSource(), tagging error_class + http_status on the model_call_ended capture so the Rohan alert can split/rate-gate them. Bumps the gateway + @openclaw/slack + @openclaw/msteams to 2026.6.11-boon.12 in lockstep (7 files: 3 package.json, 3 npm-shrinkwrap.json, CHANGELOG.md). Tagging v2026.6.11-boon.12 after merge triggers boon-release.yml to publish the 6 assets. * feat(release): publish @openclaw/diagnostics-prometheus as a fork release asset (ENG-15788) The diagnostics-prometheus plugin's dist is excluded from the published gateway package (`!dist/extensions/diagnostics-prometheus/**`), so a fleet host has no way to run the Prometheus exporter unless the plugin is installed separately — and gandalf-manager's Alloy scrape (job boon-agent-openclaw, ENG-15788 step 2) has nothing to read until it is. There was no release tarball for it. - Pin extensions/diagnostics-prometheus/package.json + npm-shrinkwrap.json to 2026.6.11-boon.12 in lockstep with the gateway (same contract as slack/msteams — the pack step asserts TAG == v<version>). - Add a 'Pack diagnostics-prometheus plugin tarball + compute sha256' step to boon-release.yml mirroring the slack/msteams steps (runtime-build + manifest overlay pack), and wire the new asset + its .sha256 into the Publish step (both create and upload --clobber arms) so it ships on the same v*-boon.N tag. Asset contract: openclaw-diagnostics-prometheus-<version>.tgz + .tgz.sha256 Unlike slack/msteams this plugin does NOT use openKeyedStore (no trust-gate), so a bare install wouldn't crash-loop — but the npm-pack: trusted path is used for install-shape consistency across the fork's plugins. Version must advance in lockstep on every future release, same as slack/msteams. actionlint clean; YAML valid. Pack machinery validated by CI on the release run (no node_modules in this worktree to pack locally).
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.
Related: ENG-16922 (builds on #83 / ENG-16815)
What Problem This Solves
The Rohan "Boon Agent 5xx error(s) detected" Sentry alert (
openclaw-fleetproject →#engineering-rohan-urgent-alert) pages with blanket copy "5xx = our infra. Investigate." In the 2026-07-28 incident, every alerted correlation ID was an AWS Bedrock 5xx relayed verbatim byboon-llm-gateway(status=500/503 error_type="api_error") — a self-recovering provider blip, not Boon infra. Every such page sent on-call down a host-triage path for something no host action can fix.The fleet runs single-hop, where the gateway relays the upstream error verbatim and never self-captures to Sentry — so the page comes from this plugin's
model_call_endedhook, which had no HTTP status to tell a relayed provider outage from a gateway-origin fault.Why This Change Was Made
The classification data exists in the runtime post-#83 (the numeric HTTP status is preserved on the thrown error), but it was never threaded into the
model_call_endedhook thesentry-monitorplugin consumes. This PR closes that gap so the alert can distinguish — and later rate-gate — the two classes.classify5xxSource()(src/infra/diagnostic-error-metadata.ts) — status-driven, no free-text message regex (the fragility fix: transient upstream 5xx (gateway-relayed Bedrock 503) now fails over instead of blocking the customer #83 deliberately removed):500/503/529→upstream_provider_5xx(Bedrock/Anthropic relayed)502/ other 5xx →gateway_origin_5xx(gateway-synthesized: chain exhausted, WAF/HTML block, no-response transport fault)api_error/overloadedprovidererror.typeforces the upstream class on an ambiguous status (tie-break, own-data-prop read only — no userland getters)undefinedfor a missing or non-5xx statusThe split mirrors the gateway's single-hop behavior: a real upstream 5xx is relayed verbatim, and the gateway only synthesizes 502 for its own faults.
httpStatus+errorClasstoPluginHookModelCallEndedEventand themodel.call.errordiagnostic event; populate both inmodelCallErrorFields.error_class+extra.http_statusinbuildModelCallEndedCapture, and lead the Sentry title with them so the two classes fingerprint into separate issues.User / Operator Impact
An operator (and the Sentry alert rule) can now split a relayed Bedrock outage from a genuine gateway fault — page tightly on
gateway_origin_5xx, rate-gate a low background ofupstream_provider_5xx. Additive, optional fields; no change to failover behavior. The alert threshold/rate-gate/copy are Sentry-UI-configured and land after this ships fleet-wide (sequencing + Sentry steps in the gandalf-manager specdocs/specs/2026-07-29-eng16922-5xx-source-classification.md).Verification
classify5xxSource(status bands, tie-break, getter-safety, non-5xx → undefined) andbuildModelCallEndedCapture(relayed-503 ⇒upstream_provider_5xx, synthesized-502 ⇒gateway_origin_5xx, non-5xx ⇒ tag absent, title reflects the class).pnpm tsgo:prodclean (EXIT 0); oxlint clean on touched files; 57 targeted tests pass.🤖 Generated with Claude Code
Summary by cubic
Classifies 5xx errors as
upstream_provider_5xxvsgateway_origin_5xxand threadshttpStatus+errorClassthroughmodel_call_endedso Sentry tags, titles, and fingerprints split by source. This lets the Rohan 5xx alert page on gateway faults and rate‑gate relayed Bedrock outages (ENG-16922).classify5xxSource(status, err):upstream_provider_5xx; 502/other 5xx →gateway_origin_5xxerror.typein{api_error, overloaded, overloaded_error}→ upstreamhttpStatusanderrorClassin diagnostic and hook events; tag Sentryerror_classandextra.http_status, and lead the title with them to split issues.sentry-monitordocs with the tag table and tie-break types; add targeted tests for classification and capture output.Written for commit ce9b094. Summary will update on new commits.