Skip to content

[Bug]: openai-codex provider fails with Cloudflare 403 on every request after upgrade from 2026.4.12 → 2026.4.14 #66633

Closed

Description

@harleymdsavage

Bug type

Regression (worked before, now fails)

Beta release blocker

No

Summary

After upgrading from 2026.4.12 to 2026.4.14, every openai-codex/gpt-5.4 agent turn fails because chatgpt.com/backend-api/v1 returns a Cloudflare bot-mitigation challenge page (HTTP 403, cf-mitigated: challenge) instead of an API response, with the failure misreported in logs as "DNS lookup for the provider endpoint failed."

Steps to reproduce

  1. Run OpenClaw 2026.4.12 with openai-codex/gpt-5.4 as the primary model and confirm agent turns succeed.
  2. Upgrade to 2026.4.14 with openclaw update. Do not change any config or re-authenticate.
  3. Send any message to an agent configured with openai-codex/gpt-5.4.
  4. Observe failure in the user journal:
    journalctl --user -u openclaw-gateway -n 50 --no-pager
  5. Confirm chatgpt.com is reachable and the block is at the Cloudflare layer, not DNS:
    curl -sI https://chatgpt.com/backend-api/v1

    Returns: HTTP/2 403, cf-mitigated: challenge

Expected behavior

openai-codex/gpt-5.4 completes agent turns successfully using the stored ChatGPT OAuth token, as observed on 2026.4.12 with the same config and credentials.

Actual behavior

Every request fails. Gateway logs show:

[agent/embedded] embedded run agent end: isError=true model=gpt-5.4 provider=openai-codex error=LLM request failed: DNS lookup for the provider endpoint failed. rawError= <style global>body{font-family:Arial...

The rawError is a Cloudflare JS challenge HTML page, not a DNS failure. The DNS lookup succeeds; chatgpt.com resolves to Cloudflare IPs. The "DNS lookup failed" message is a misclassification (see #64092).

On the first retry the log reports "API rate limit reached" before switching to the DNS error on subsequent retries — both are misclassifications of the same Cloudflare 403 HTML response.

OpenClaw version

2026.4.14

Operating system

Ubuntu 24.04 / Linux 6.8.0

Install method

No response

Model

openai-codex/gpt-5.4

Provider / routing chain

openclaw -> openai-codex (chatgpt.com/backend-api/v1)

Additional provider/model setup details

  • Auth method: ChatGPT OAuth (browser sign-in via openclaw models auth login --provider openai-codex)
  • Re-authenticating after the upgrade does not resolve the issue. The OAuth token is valid and not expired (~7 days remaining). The block is at the Cloudflare header-detection layer, not the token layer.
  • Fallback provider zai/glm-5.1 is confirmed working on the same machine and same network, ruling out a general connectivity issue.
  • Deployment: self-hosted headless server (no browser present at request time).
  • Config: agents.defaults.model.primary = openai-codex/gpt-5.4, fallback = zai/glm-5.1.

Logs, screenshots, and evidence

Gateway log (redacted):

[gateway] agent model: openai-codex/gpt-5.4
[agent/embedded] embedded run failover decision: decision=surface_error reason=timeout from=openai-codex/gpt-5.4
[errors] Long error truncated: <html>
[agent/embedded] embedded run agent end: isError=true model=gpt-5.4 provider=openai-codex error=<html>...
[agent/embedded] embedded run agent end: isError=true model=gpt-5.4 provider=openai-codex error=LLM request failed: DNS lookup for the provider endpoint failed. rawError=<html> <head> <meta name="viewport"...

Root cause traced in installed package:
File: node_modules/@mariozechner/pi-ai/dist/providers/openai-codex-responses.js (~line 715)

function buildBaseCodexHeaders(initHeaders, additionalHeaders, accountId, token) {
    ...
    headers.set("originator", "pi");
    const userAgent = _os ? `pi (${_os.platform()} ${_os.release()}; ${_os.arch()})` : "pi (browser)";
    headers.set("User-Agent", userAgent);
    return headers;
}

Cloudflare detects `originator: pi` and `User-Agent: pi (linux ...)` as non-browser traffic and issues a 403 challenge. This is the same root cause documented in #62142. The distinction from prior reports is that 2026.4.12 was not affected — something in 2026.4.14 changed the request code path so that it now consistently triggers this block.

Confirmed with curl:
$ curl -sI https://chatgpt.com/backend-api/v1
HTTP/2 403
cf-mitigated: challenge
content-type: text/html; charset=UTF-8

Impact and severity

Affected: all self-hosted deployments using openai-codex/gpt-5.4 as primary model on 2026.4.14, headless (no browser) environment.
Severity: blocks all agent workflow — primary model has 100% failure rate.
Frequency: every request, 100% reproducible since upgrading to 2026.4.14.
Consequence: agents produce no responses via any configured channel; fallback provider must be used as primary workaround.

Additional information

Last known good version: 2026.4.12
First known bad version: 2026.4.14

This is a distinct regression from #62142 (reported on 2026.4.5) and #64174 (reported on 2026.4.9). Those reports describe users who never had it working on recent versions. This report confirms 2026.4.12 works and 2026.4.14 does not, with no config changes between upgrades.

The 2026.4.14 release notes mention changes to Codex transport policy and transport-turn-state resolution. One of those changes likely shifted the request code path in a way that re-exposed the originator: pi / User-Agent: pi header issue for users who were unaffected on 2026.4.12.

Workaround: set agents.defaults.model.primary to a working provider (e.g. zai/glm-5.1) until fixed.

Related issues: #62142, #64174, #64092

Activity

  1. added
    bug
    on Apr 14, 2026
  2. wsjwong commented on Apr 14, 2026

    @wsjwong

    Tested rollback to 2026.4.12 and it does not fix this.

  3. Jpkovas commented on Apr 14, 2026

    @Jpkovas

    tried a rollback and got the same error too

  4. hlolli commented on Apr 14, 2026

    @hlolli

    I nuked my openclaw directory and tried starting over, then this issue started to happen.

  5. Gyvastis commented on Apr 14, 2026

    @Gyvastis

    Confirming fix from #62087 works for this issue too. Symptoms matched exactly: openai-codex/gpt-5.4 failing with Cloudflare challenge HTML misreported as "DNS lookup for the provider endpoint failed" / "API rate limit reached".

    Direct curl to chatgpt.com/backend-api/codex/responses with the stored OAuth token returned streaming responses fine. Only the codex-acp subprocess was getting 403'd.

    Adding explicit provider transport mapping to openclaw.json fixed it:

    "models": {
      "providers": {
        "openai-codex": {
          "api": "openai-codex-responses",
          "baseUrl": "https://chatgpt.com/backend-api",
          "models": [
            {"id": "gpt-5.4", "name": "gpt-5.4", "api": "openai-codex-responses"}
          ]
        }
      }
    }

    Huge thanks to @st4rnin3 for documenting this in #62087 — the misleading error messages made this a nightmare to diagnose.

  6. antonguzun commented on Apr 14, 2026

    @antonguzun

    @Gyvastis Thanks, it works for me

  7. dougbeard commented on Apr 15, 2026

    @dougbeard

    @Gyvastis Thanks a bunch! This solved it for me to. Until OpenClaw breaks it again.

  8. harleymdsavage commented on Apr 15, 2026

    @harleymdsavage
    Author

    @Gyvastis thank you so much — this fixed it immediately.

  9. iamgustav2 commented on Apr 15, 2026

    @iamgustav2

    @Gyvastis You're the best. Thanks!

  10. SunnyChan0621 commented on Apr 15, 2026

    @SunnyChan0621

    Can confirm the same issue on a different environment:

    • OpenClaw: 2026.4.14 (323493f)
    • OS: Ubuntu 24.04 / Linux 6.17.0 (arm64)
    • Host: Oracle Cloud ARM (Tokyo region, 4 OCPU / 24GB)
    • Install: npm global
    • Provider: openai-codex (ChatGPT OAuth)
    • Model: openai-codex/gpt-5.4
    • Config: no models.providers.openai-codex override, no stale 5.1 refs

    Same symptoms: Cloudflare 403 (cf-mitigated: challenge) from chatgpt.com/backend-api, misreported as DNS lookup for the provider endpoint failed.

    Confirmed with curl from the same host:

    $ curl -sI https://chatgpt.com/backend-api
    HTTP/2 403
    cf-mitigated: challenge
    

    The originator: pi / User-Agent: pi (linux ...) header theory from the OP matches what we see. Last known good version for us was also 2026.4.12.

    Workaround: using fallback providers (zai/glm-5-turbo) for now.

  11. tkarren commented on Apr 16, 2026

    @tkarren

    I had the same issue and was able to resolve it with #66633 (comment)

  12. Cocopuffs2390 commented on Apr 16, 2026

    @Cocopuffs2390

    Fixed with comment: #66633 (comment)

    Thanks!

  13. gardan commented on Apr 16, 2026

    @gardan

    Really frustrating, please resolve this ASAP. Make sure it is turned into Beta release blocker = YES. Many of us have codex subscriptions that cannot be used due to this. Downgrading to 2026.4.12 does not resolve it.

  14. sercada commented on Apr 16, 2026

    @sercada
    Contributor

    Confirming this fix works here too on a fresh FlowerAI/OpenClaw 2026.4.14 server.

    Symptoms matched exactly:

    • openai-codex/gpt-5.4 returned empty replies in chat
    • gateway logs showed Cloudflare HTML misclassified as DNS lookup for the provider endpoint failed and sometimes API rate limit reached
    • main had valid openai-codex OAuth, but agent turns still failed

    What fixed it was adding an explicit provider mapping for openai-codex in openclaw.json:

    "models": {
      "providers": {
        "openai-codex": {
          "api": "openai-codex-responses",
          "baseUrl": "https://chatgpt.com/backend-api",
          "models": [
            {
              "id": "gpt-5.4",
              "name": "gpt-5.4",
              "api": "openai-codex-responses"
            }
          ]
        }
      }
    }

    After restarting openclaw-gateway, direct gateway inference succeeded again:

    {
      "ok": true,
      "provider": "openai-codex",
      "model": "gpt-5.4",
      "outputs": [
        { "text": "PROVIDER_FIX_OK" }
      ]
    }

    So in our case this was not a bad OAuth login and not a Control UI problem. It was the provider path/config behavior on 2026.4.14.

    Thanks for documenting this workaround — it unblocked the new server immediately.

  15. steipete commented on Apr 21, 2026

    @steipete
    Contributor

    Fixed by #69336, landed on main as 8a2d7f2541e00879b3b9e4c712842cf49f1125a8.

    The built-in openai-codex route now uses the Codex backend path (/backend-api/codex) instead of the blocked legacy path. If this still reproduces after a build containing that commit, please open a fresh issue with the new request path and raw status/body.

  16. locked as resolved and limited conversation to collaborators on Apr 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions