Repository navigation
fix: #94432 classify Cloudflare challenge 403 as upstream_html instead of auth_html - #94440
Conversation
|
Codex review: needs maintainer review before merge. Reviewed July 1, 2026, 12:46 AM ET / 04:46 UTC. Summary PR surface: Source +14, Tests +68. Total +82 across 4 files. Reproducibility: yes. for the source-level classifier boundary: current main maps status-403 HTML to auth_html, and the PR changes matching Cloudflare challenge HTML to upstream_html. I did not reproduce a live Codex OAuth Cloudflare challenge in this read-only review. Review metrics: 1 noteworthy metric.
Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Merge the classifier-only diagnostic slice after maintainer acceptance, while keeping #94432 open for live-proven Codex OAuth transport work. Do we have a high-confidence way to reproduce the issue? Yes for the source-level classifier boundary: current main maps status-403 HTML to auth_html, and the PR changes matching Cloudflare challenge HTML to upstream_html. I did not reproduce a live Codex OAuth Cloudflare challenge in this read-only review. Is this the best way to solve the issue? Yes for the classifier-only diagnostic slice: the fix is narrow, preserves generic 403 HTML as auth_html, aligns with the shared Cloudflare marker set, and suppresses raw HTML console suffixes. It is not the full solution for #94432. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against d68ba5edc598. Label changesLabel justifications:
Evidence reviewedPR surface: Source +14, Tests +68. Total +82 across 4 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
@clawsweeper re-review |
1 similar comment
|
@clawsweeper re-review |
3d8e526 to
64a75a4
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
a565fa2 to
bca8813
Compare
72c349f to
6b7a819
Compare
…d of auth_html
Extend CLOUDFLARE_CHALLENGE_RE to also match cdn-cgi/challenge-platform and challenge-error-text — patterns already recognized by the shared STANDALONE_HTML_ERROR_HINT_RE in assistant-error-format.ts. Add regression tests for both new marker variants to ensure coverage.
…stream_html reclassification - Add upstream_html to RAW_ERROR_CONSOLE_SUPPRESSED_FAILURE_KINDS so Cloudflare challenge 403 pages classified as upstream_html do not leak raw HTML into lifecycle/failover console rawError= diagnostics - Add regression test verifying upstream_html suppression in failover observation console messages Re: #94432
6b7a819 to
69cd60f
Compare
Summary
Problem: When a provider URL is protected by Cloudflare's browser challenge page, OpenClaw receives an HTTP 403 response with HTML content like "Enable JavaScript and cookies to continue". The existing
classifyProviderRuntimeFailureKindfunction classified all 403 HTML responses asauth_html, displaying a misleading error message suggesting API key or authentication issues. In reality, the Cloudflare challenge is a CDN/gateway block at the network layer — the user needs to see "upstream_html" which already mentions "CDN or gateway (e.g. Cloudflare) blocked the request".Solution: Add
CLOUDFLARE_CHALLENGE_REregex detecting Cloudflare browser-challenge HTML patterns ("Enable JavaScript and cookies to continue", "cf-browser-verification", "__cf_challenge"). Whenstatus === 403and the HTML response matches, classify as"upstream_html"instead of"auth_html".What changed:
src/agents/embedded-agent-helpers/errors.ts: AddedCLOUDFLARE_CHALLENGE_REregex andisCloudflareChallengeResponse()helper; added Cloudflare check before the default auth_html classification inclassifyProviderRuntimeFailureKind(+13 lines)src/agents/embedded-agent-helpers/provider-error-patterns.test.ts: Added Cloudflare challenge HTML fixture and updated test classification assertion (+13 lines)src/agents/embedded-agent-error-observation.ts: Addedupstream_htmltoRAW_ERROR_CONSOLE_SUPPRESSED_FAILURE_KINDSso Cloudflare challenge HTML does not leak into lifecycle/failover consolerawError=diagnostics (+1 line)src/agents/embedded-agent-runner/run/failover-observation.test.ts: Added regression test verifying Cloudflare challenge upstream_html bodies stay out of console messages (+30 lines)What did NOT change: No changes to non-403 classifications, no changes to other error patterns, no new dependencies.
Re: #94432
Real behavior proof
Behavior addressed: Cloudflare 403 challenge responses now show "upstream_html" (CDN block) instead of "auth_html" (auth failure).
Real environment tested: Windows 11 Pro x64 / Node v22.19.0 / OpenClaw PR #94440 branch @ 64a75a4
Exact steps or command run after this patch:
Capture real Cloudflare HTTP 403 responses from production sites and run the production
classifyProviderRuntimeFailureKindmodule withnpx tsx.After-fix evidence: L3 evidence — production module execution with real HTTP response bodies from real Cloudflare-protected production sites.
Observed result after the fix:
upstream_html(wasauth_htmlbefore fix). User will see "CDN or gateway (e.g. Cloudflare) blocked the request" instead of misleading "re-authenticate" message.auth_htmlauth_htmlauth_html(403-only exception)What was not tested: Full end-to-end gateway request to a Cloudflare-protected Codex endpoint. The
classifyProviderRuntimeFailureKindfunction is the component responsible for the misclassification reported in #94432, and it is now verified with real Cloudflare challenge HTML from production sites. The end-to-end transport path (Codex app-server → chatgpt.com/backend-api) is a separate concern not changed by this PR.Tests and validation
Unit tests
L3 module verification
6/6 scenarios passed against production module with real Cloudflare HTTP responses. See
## Real behavior proofsection for full output.Risk checklist
Current review state