Skip to content

Conversation

@kiroo92
Copy link

@kiroo92 kiroo92 commented Feb 7, 2026

Problem

OpenClaw sends POST /v1/responses with input items referencing previous response IDs (rs_...). Since OAuth accounts force store=false, these items are never persisted on OpenAI's side, causing 404 errors. The proxy converts 404 to a generic 502, so the client keeps retrying the same broken request in an infinite loop.

Changes

  1. handleErrorResponse: Pass through 400/404/409/422 as invalid_request_error with the original upstream status code and message, instead of converting to generic 502.
  2. applyCodexOAuthTransform: When store=false (always true for OAuth accounts), force preserveReferences=false in filterCodexInput to remove item_reference entries and strip stale id fields from input items.

Result

  • Input items referencing non-persisted responses are cleaned before forwarding to upstream
  • Client errors are passed through transparently so callers can act on the real problem
  • Tool call continuation (call_id) still works correctly

Your Name added 2 commits February 7, 2026 16:19
…m references when store=false

- handleErrorResponse: pass through 400/404/409/422 as invalid_request_error instead of generic 502
- applyCodexOAuthTransform: force preserveReferences=false when store=false to remove item_reference and stale id fields
- Fixes OpenClaw 404 retry loop caused by referencing non-persisted response items (rs_...) under OAuth accounts
…messages endpoint

Add platform guard in GatewayService.Forward to reject non-Anthropic/Antigravity
accounts early. This prevents OpenAI OAuth tokens from being sent to Anthropic API
which causes 401 errors and triggers failover that disables all OpenAI accounts.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant