Repository navigation
fix(failover): classify edge/WAF HTML 429 as transient timeout, not model rate-limit - #86
Conversation
…odel rate-limit A Cloudflare/edge WAF in front of boon-llm-gateway intermittently returns a 429 with an HTML "Blocked" body. The gateway relays it on every model hop, so openclaw classified it as a provider rate_limit, exhausted the fallback chain, and surfaced a false "all models rate-limited" message on healthy low-volume traffic (the Arguijo incident). The 429 branch of classifyFailoverClassificationFromHttpStatus now detects an HTML/Cloudflare body (via the shared isEdgeBlockErrorBody helper composing the existing isHtmlErrorResponse + isCloudflareOrHtmlErrorPage) and classifies it as timeout instead of rate_limit. Billing 429s are checked first and still win. This makes an edge 429 observably distinct from a real provider rate-limit in the model.failover metric (reason=timeout vs rate_limit; observation path already tags upstream_html). To keep the already-shipped client-side ride-out retry firing after the reclassification, isPureTransientRateLimitSummary now also matches edge-block attempts by their preserved raw HTML body, so the transient-busy backoff loop still absorbs the blip while genuine model timeouts (no HTML body) stay excluded. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
|
I'll analyze this and get back to you. |
There was a problem hiding this comment.
All reported issues were addressed across 5 files
Reply with feedback, questions, or to request a fix.
Fix all with cubic | Re-trigger cubic
…TML test Address PR review + CI: - isPureTransientRateLimitSummary now gates the HTML-body edge-block check on reason === "timeout", so HTML auth (401/403 -> auth) and format (400/422 -> format) failures are not swept into the blind ride-out retry loop and keep their actionable copy. Real edge blocks (429/5xx HTML -> timeout) still ride out. - Update the pre-existing openclaw#67517 test that asserted 429 HTML -> rate_limit to the new canonical behavior (429 HTML -> timeout); plain JSON 429 stays rate_limit. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
There was a problem hiding this comment.
Approved — reviewed the full diff, verified the logic, and ran the tests locally on the PR branch.
Correctness
- HTML-429 →
timeoutis inserted in thestatus === 429branch after the billing check (billing 429 still wins) and before therate_limitfallthrough. Plain JSON 429 staysrate_limit. Ordering is right. isEdgeBlockErrorBodycleanly composes the existingisHtmlErrorResponse+isCloudflareOrHtmlErrorPage— reuse, no duplication.- The
isPureTransientRateLimitSummarywidening is correctly gated onreason === "timeout", so HTML auth (401/403→auth) and format (400/422→format) errors keep their actionable copy and are NOT swept into the blind ride-out loop. Only real edge blocks ride out.
Tests — ran all three touched suites on this branch:
- embedded-agent-helpers.isbillingerrormessage.test.ts — 155 passed
- agent-runner-execution.test.ts — 222 passed (incl. ride-out-vs-real-timeout cases)
- provider-error-patterns.test.ts — 39 passed (updated openclaw#67517 429-HTML assertion to timeout)
oxfmt clean on all touched files.
Ticket (ENG-14852) — this is the client-side classification slice: satisfies AC #3 (edge-429 observably distinct from provider rate_limit via reason=timeout / upstream_html) and AC #5 (no false all-models-rate-limited from an edge block). The WAF rule-tuning, egress allowlist, and edge-429 alerting ACs are correctly and explicitly deferred to ops as out-of-repo follow-up.
No secrets, no migrations, no breaking contract changes. Ship it.
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.
…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).

What Problem This Solves
A Cloudflare/edge WAF in front of
boon-llm-gatewayintermittently returns a 429 with an HTML "Blocked" body. The gateway relays that same 429 to every model hop, so openclaw classified it as a providerrate_limit, walked and exhausted the fallback chain, and surfaced a false "all models rate-limited" message on healthy, low-volume traffic (the Arguijo incident: ~67 req/day from one fixed IP, no model was actually rate-limited).Why This Change Was Made
The failover-decision classifier never inspected the 429 body for HTML. The existing HTML short-circuit in
classifyFailoverSignalonly fires for statuses 408/499/5xx (isTransportHtmlErrorStatus), so an HTML 429 fell straight through to thestatus === 429branch →rate_limit. As a result the transient external edge blip was indistinguishable from a real provider rate-limit in both behavior and metrics.This change makes the
status === 429branch ofclassifyFailoverClassificationFromHttpStatusdetect an HTML/Cloudflare body (new shared helperisEdgeBlockErrorBody, composing the existingisHtmlErrorResponse+isCloudflareOrHtmlErrorPage) and classify it astimeoutinstead ofrate_limit. Billing 429s are checked first and still win.To avoid regressing the already-shipped client-side ride-out retry — which keyed on
rate_limit/overloadedonly and would have dropped the now-timeoutedge 429 out of the loop —isPureTransientRateLimitSummarynow also matches edge-block attempts by their preserved raw HTML body (attempt.error). Genuine model timeouts (no HTML body) stay excluded.Scope is code only; the Cloudflare/EC2 WAF rule tuning, egress allowlisting, and external paging alerts are handled separately by ops.
User Impact
rate_limit: themodel.failovermetric carriesreason=timeout(vsrate_limit), and the observation path already tagsproviderRuntimeFailureKind=upstream_html— giving ops a scrapeable signal to alert on.rate_limit) or billing 429s (→ stillbilling).Evidence
Classifier (
src/agents/embedded-agent-helpers/errors.ts): newisEdgeBlockErrorBody; HTML-429 →timeoutin thestatus === 429branch (after billing).Retry continuity (
src/auto-reply/reply/agent-runner-execution.ts):isPureTransientRateLimitSummarywidened to match edge-block attempts by HTML body.Tests (run via
node scripts/run-vitest.mjs, linked-worktree path):src/agents/embedded-agent-helpers.isbillingerrormessage.test.ts— 155 passed, incl. new cases: HTML 429 →timeout, Cloudflare-challenge 429 →timeout, plain JSON 429 →rate_limit, billing 429 →billing,classifyProviderRuntimeFailureKind→upstream_html.src/auto-reply/reply/agent-runner-execution.test.ts— 222 passed, incl. new cases: an edge block classified astimeout(HTML body) still rides out and recovers; a genuine model timeout (no HTML body) does NOT trigger the edge-block backoff loop.Follow-up (out of repo): Cloudflare rule identification + EC2 egress allowlist (mirror Render's tweak) + edge-429 alert wiring, using the new
reason=timeout/upstream_htmlsignals.🤖 Generated with Claude Code
Summary by cubic
Fixes misclassification of edge/WAF HTML 429s in front of
boon-llm-gatewayby treating them as transient timeouts instead of provider rate limits, and keeps the ride‑out retry for these cases without retrying HTML auth/format errors. Metrics now reflect the true cause. (Linear ENG-14852)isEdgeBlockErrorBodyand used it in the 429 path to classify HTML-bodied/Cloudflare 429s astimeout(billing 429s →billing; JSON 429s →rate_limit).isPureTransientRateLimitSummaryto include edge blocks only whenreason === "timeout"using the preserved HTML body; genuine model timeouts (no HTML) remain excluded.reason=timeout;providerRuntimeFailureKind=upstream_html.timeout; plain JSON 429 →rate_limit; billing 429 →billing; updated prior 429-HTML assertion to the new behavior; added ride-out vs real-timeout cases.Written for commit e1afe5b. Summary will update on new commits.