Skip to content

Add HTTP 499 to transient error codes for model fallback#41468

Merged
altaywtf merged 3 commits intoopenclaw:mainfrom
zeroasterisk:fix/transient-499-504
Mar 9, 2026
Merged

Add HTTP 499 to transient error codes for model fallback#41468
altaywtf merged 3 commits intoopenclaw:mainfrom
zeroasterisk:fix/transient-499-504

Conversation

@zeroasterisk
Copy link
Copy Markdown
Contributor

Adds 499 (Client Closed Request) to TRANSIENT_HTTP_ERROR_CODES. Anthropic commonly returns this during overload — without it in the set, these errors don't trigger model fallback.

Fixes #41467

@openclaw-barnacle openclaw-barnacle bot added agents Agent runtime and tooling size: S labels Mar 9, 2026
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Mar 9, 2026

Greptile Summary

This PR adds HTTP 499 ("Client Closed Request") to TRANSIENT_HTTP_ERROR_CODES, enabling Anthropic's 499 overload responses to trigger model fallback as intended. However, an unrelated personal sandbox Docker Compose file (docker-compose.sandbox.yaml) has been inadvertently included in the PR and contains a hardcoded authentication token.

Key changes:

  • src/agents/pi-embedded-helpers/errors.ts: Adds 499 to the transient error codes set (line 192). Import ordering for FailoverReason is also cleaned up (moved to line 3).
  • docker-compose.sandbox.yaml: A new 60-line personal sandbox configuration file that appears unrelated to the fix and should not be merged to main. It also contains a hardcoded authentication token in plain text (line 44).

Recommendation: Remove docker-compose.sandbox.yaml from this PR and add it to .gitignore, or rebase without it. The core error-handling change in errors.ts is correct and safe.

Confidence Score: 2/5

  • The core error-handling fix is safe, but the unrelated sandbox file with hardcoded secrets should not be merged to main.
  • The errors.ts change is correct and low-risk. However, the score is reduced significantly because docker-compose.sandbox.yaml — a personal development configuration with a hardcoded authentication token — was inadvertently included in the PR and must be removed before merging.
  • docker-compose.sandbox.yaml must be removed from this PR or added to .gitignore.

Last reviewed commit: c1daf4b

Comment on lines +1 to +3
# Sandbox OpenClaw instance for testing A2A channel experiments
# Managed by Zaf (main instance)
#
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file appears to be a personal development configuration specific to "Zaf" and is unrelated to the stated purpose of the PR ("Add HTTP 499 to transient error codes for model fallback"). It references personal host paths (${HOME}/.openclaw/workspace) and should not be merged into the main branch. Personal sandbox setups like this are typically better kept out of version control (e.g., added to .gitignore) rather than committed.

Prompt To Fix With AI
This is a comment left during a code review.
Path: docker-compose.sandbox.yaml
Line: 1-3

Comment:
This file appears to be a personal development configuration specific to "Zaf" and is unrelated to the stated purpose of the PR ("Add HTTP 499 to transient error codes for model fallback"). It references personal host paths (`${HOME}/.openclaw/workspace`) and should not be merged into the main branch. Personal sandbox setups like this are typically better kept out of version control (e.g., added to `.gitignore`) rather than committed.

How can I resolve this? If you propose a fix, please make it concise.

--gemini-api-key $${GOOGLE_API_KEY} \
--gateway-port 19789 \
--gateway-bind lan \
--gateway-auth token \
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A static authentication token is hardcoded in plain text on this line. Committing authentication tokens to version control is a security best practice violation — this token is now part of the repository's permanent git history. Source it from an environment variable instead:

            --gateway-token ${SANDBOX_GATEWAY_TOKEN}
Prompt To Fix With AI
This is a comment left during a code review.
Path: docker-compose.sandbox.yaml
Line: 44

Comment:
A static authentication token is hardcoded in plain text on this line. Committing authentication tokens to version control is a security best practice violation — this token is now part of the repository's permanent git history. Source it from an environment variable instead:

```yaml
            --gateway-token ${SANDBOX_GATEWAY_TOKEN}
```

How can I resolve this? If you propose a fix, please make it concise.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c1daf4b8fb

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

--gateway-port 19789 \
--gateway-bind lan \
--gateway-auth token \
--gateway-token sandbox-token-zaf-2026
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Externalize sandbox gateway token

This compose file hardcodes --gateway-token sandbox-token-zaf-2026 while also exposing the gateway port and binding to LAN, so anyone with network access to the host can authenticate with a publicly known credential. Even for sandbox environments, this creates an avoidable unauthorized-access path; the token should come from an environment variable (or generated secret) instead of being committed.

Useful? React with 👍 / 👎.

# First run: initialize if needed
if [ ! -f /data/.openclaw/openclaw.json ]; then
echo 'Initializing sandbox OpenClaw...'
node /app/openclaw.mjs onboard \
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Make sandbox compose runnable from a clean checkout

The documented usage suggests docker-compose -f docker-compose.sandbox.yaml up -d is sufficient, but this command path runs node /app/openclaw.mjs directly and that bootstrap requires local build output (dist/entry.(m)js), which is not tracked in git. On a clean clone, the container exits immediately unless users manually build first, so this setup should either build/install dependencies in-container or document/enforce the prerequisite explicitly.

Useful? React with 👍 / 👎.

Zaf (via OpenClaw) and others added 3 commits March 10, 2026 01:49
499 (Client Closed Request) is commonly returned by Anthropic during
overload but was missing from TRANSIENT_HTTP_ERROR_CODES, so it didn't
trigger model fallback.

Fixes openclaw#41467
@altaywtf altaywtf force-pushed the fix/transient-499-504 branch from 69f4c8b to 0053bae Compare March 9, 2026 22:54
@altaywtf altaywtf merged commit c9a6c54 into openclaw:main Mar 9, 2026
25 of 26 checks passed
@altaywtf
Copy link
Copy Markdown
Member

altaywtf commented Mar 9, 2026

Merged via squash.

Thanks @zeroasterisk!

mrosmarin added a commit to mrosmarin/openclaw that referenced this pull request Mar 9, 2026
* main: (33 commits)
  Exec: mark child command env with OPENCLAW_CLI (openclaw#41411)
  fix(plugins): expose model auth API to context-engine plugins (openclaw#41090)
  Add HTTP 499 to transient error codes for model fallback (openclaw#41468)
  Logging: harden probe suppression for observations (openclaw#41338)
  fix(discord): apply effective maxLinesPerMessage in live replies (openclaw#40133)
  build(protocol): regenerate Swift models after pending node work schemas (openclaw#41477)
  Agents: add fallback error observations (openclaw#41337)
  acp: harden follow-up reliability and attachments (openclaw#41464)
  fix(agents): probe single-provider billing cooldowns (openclaw#41422)
  acp: add regression coverage and smoke-test docs (openclaw#41456)
  acp: forward attachments into ACP runtime sessions (openclaw#41427)
  acp: enrich streaming updates for ide clients (openclaw#41442)
  Sandbox: import STATE_DIR from paths directly (openclaw#41439)
  acp: restore session context and controls (openclaw#41425)
  acp: fail honestly in bridge mode (openclaw#41424)
  Gateway: tighten node pending drain semantics (openclaw#41429)
  Gateway: add pending node work primitives (openclaw#41409)
  fix(auth): reset cooldown error counters on expiry to prevent infinite escalation (openclaw#41028)
  fix(cron): do not misclassify empty/NO_REPLY as interim acknowledgement (openclaw#41401)
  iOS: reconnect gateway on foreground return (openclaw#41384)
  ...
ademczuk pushed a commit to ademczuk/openclaw that referenced this pull request Mar 10, 2026
)

Merged via squash.

Prepared head SHA: 0053bae
Co-authored-by: zeroasterisk <[email protected]>
Co-authored-by: altaywtf <[email protected]>
Reviewed-by: @altaywtf
mukhtharcm pushed a commit to hnykda/openclaw that referenced this pull request Mar 10, 2026
)

Merged via squash.

Prepared head SHA: 0053bae
Co-authored-by: zeroasterisk <[email protected]>
Co-authored-by: altaywtf <[email protected]>
Reviewed-by: @altaywtf
jenawant pushed a commit to jenawant/openclaw that referenced this pull request Mar 10, 2026
)

Merged via squash.

Prepared head SHA: 0053bae
Co-authored-by: zeroasterisk <[email protected]>
Co-authored-by: altaywtf <[email protected]>
Reviewed-by: @altaywtf
aiwatching pushed a commit to aiwatching/openclaw that referenced this pull request Mar 10, 2026
)

Merged via squash.

Prepared head SHA: 0053bae
Co-authored-by: zeroasterisk <[email protected]>
Co-authored-by: altaywtf <[email protected]>
Reviewed-by: @altaywtf
Moshiii pushed a commit to Moshiii/openclaw that referenced this pull request Mar 11, 2026
)

Merged via squash.

Prepared head SHA: 0053bae
Co-authored-by: zeroasterisk <[email protected]>
Co-authored-by: altaywtf <[email protected]>
Reviewed-by: @altaywtf
Moshiii pushed a commit to Moshiii/openclaw that referenced this pull request Mar 11, 2026
)

Merged via squash.

Prepared head SHA: 0053bae
Co-authored-by: zeroasterisk <[email protected]>
Co-authored-by: altaywtf <[email protected]>
Reviewed-by: @altaywtf
dominicnunez pushed a commit to dominicnunez/openclaw that referenced this pull request Mar 11, 2026
)

Merged via squash.

Prepared head SHA: 0053bae
Co-authored-by: zeroasterisk <[email protected]>
Co-authored-by: altaywtf <[email protected]>
Reviewed-by: @altaywtf
dhoman pushed a commit to dhoman/chrono-claw that referenced this pull request Mar 11, 2026
)

Merged via squash.

Prepared head SHA: 0053bae
Co-authored-by: zeroasterisk <[email protected]>
Co-authored-by: altaywtf <[email protected]>
Reviewed-by: @altaywtf
Ruijie-Ysp pushed a commit to Ruijie-Ysp/clawdbot that referenced this pull request Mar 12, 2026
)

Merged via squash.

Prepared head SHA: 0053bae
Co-authored-by: zeroasterisk <[email protected]>
Co-authored-by: altaywtf <[email protected]>
Reviewed-by: @altaywtf
qipyle pushed a commit to qipyle/openclaw that referenced this pull request Mar 12, 2026
)

Merged via squash.

Prepared head SHA: 0053bae
Co-authored-by: zeroasterisk <[email protected]>
Co-authored-by: altaywtf <[email protected]>
Reviewed-by: @altaywtf
GGzili pushed a commit to GGzili/moltbot that referenced this pull request Mar 12, 2026
)

Merged via squash.

Prepared head SHA: 0053bae
Co-authored-by: zeroasterisk <[email protected]>
Co-authored-by: altaywtf <[email protected]>
Reviewed-by: @altaywtf
Interstellar-code pushed a commit to Interstellar-code/operator1 that referenced this pull request Mar 16, 2026
)

Merged via squash.

Prepared head SHA: 0053bae
Co-authored-by: zeroasterisk <[email protected]>
Co-authored-by: altaywtf <[email protected]>
Reviewed-by: @altaywtf

(cherry picked from commit c9a6c54)
senw-developers pushed a commit to senw-developers/va-openclaw that referenced this pull request Mar 17, 2026
)

Merged via squash.

Prepared head SHA: 0053bae
Co-authored-by: zeroasterisk <[email protected]>
Co-authored-by: altaywtf <[email protected]>
Reviewed-by: @altaywtf
V-Gutierrez pushed a commit to V-Gutierrez/openclaw-vendor that referenced this pull request Mar 17, 2026
)

Merged via squash.

Prepared head SHA: 0053bae
Co-authored-by: zeroasterisk <[email protected]>
Co-authored-by: altaywtf <[email protected]>
Reviewed-by: @altaywtf
alexey-pelykh pushed a commit to remoteclaw/remoteclaw that referenced this pull request Mar 22, 2026
alexey-pelykh pushed a commit to remoteclaw/remoteclaw that referenced this pull request Mar 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling size: XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add HTTP 499 and 504 to transient error codes for model fallback

2 participants