Skip to content

Pi/native runtime routes openai-chatgpt-responses to boundary-aware transport and fails on ChatGPT Codex endpoint #90086

Closed

Description

@richardmqq

Summary

On OpenClaw 2026.6.1, an OpenAI OAuth-backed ChatGPT/Codex provider configured for the Pi/native runtime (agentRuntime.id = openclaw, i.e. the pi alias) is routed to the new boundary-aware unified OpenAI transport instead of the existing ChatGPT Codex stream.

That unified path fails against https://chatgpt.com/backend-api/codex/responses with a provider response that looks like HTTP 200 but has an empty content-type and a raw/normalized Connection error.. The agent then fails with FailoverError: LLM request failed: network connection error.

Environment

  • OpenClaw: 2026.6.1 (openclaw --version reported OpenClaw 2026.6.1 (2e08f0f))
  • OS: macOS 26.4.1 arm64
  • Node: 25.9.0
  • Provider auth: OpenAI OAuth profile (openai:<redacted-email>)
  • Model provider: openai
  • Runtime: Pi/native (agentRuntime.id = openclaw; pi normalizes to openclaw)

Redacted config shape

{
  "models": {
    "providers": {
      "openai": {
        "api": "openai-chatgpt-responses",
        "baseUrl": "https://chatgpt.com/backend-api/codex",
        "agentRuntime": { "id": "openclaw" },
        "request": { "allowPrivateNetwork": true }
      }
    }
  },
  "agents": {
    "defaults": {
      "model": { "primary": "openai/gpt-5.5", "fallbacks": [] },
      "models": {
        "openai/gpt-5.5": {
          "agentRuntime": { "id": "openclaw" },
          "params": { "thinking": "xhigh", "transport": "sse" }
        }
      }
    }
  }
}

Reproduction

With the above shape and an OpenAI OAuth profile:

openclaw agent --agent main --session-key agent:main:repro --message 'Reply with exactly OK.' --timeout 180

Actual behavior without local patch

The run fails:

GatewayClientRequestError: FailoverError: LLM request failed: network connection error.

Trajectory shows the run being routed to the boundary-aware unified path:

context.compiled: streamStrategy=boundary-aware:openai-chatgpt-responses transport=sse
model.completed: stopReason=error errorMessage="Connection error." usage=input=0/output=0
session.ended: status=error terminalError=non_deliverable_terminal_turn

Local debug of the same native path showed the internal transport alias and invalid response framing:

[openai-transport] [responses] start provider=openai api=openclaw-openai-responses-transport model=gpt-5.5 baseUrl=https://chatgpt.com/backend-api/codex
[provider-transport-fetch] response status=200 contentType=
[openai-transport] [responses] error causeName=ProviderHttpError causeCode=invalid_provider_content_type message=Connection error.

Expected behavior

For openai + openai-chatgpt-responses + ChatGPT Codex baseUrl + OpenAI OAuth + Pi/native runtime, the embedded agent should use the existing ChatGPT Codex native stream strategy (observed as openclaw-native-codex-responses) or otherwise send/parse the ChatGPT Codex endpoint with the correct protocol/headers.

Evidence that this is a transport regression

Using the same OAuth profile, same baseUrl, same model config, and same network/TUN setup, forcing the embedded agent back to the old ChatGPT Codex stream succeeds:

context.compiled: streamStrategy=openclaw-native-codex-responses transport=sse
model.completed: stopReason=stop errorMessage=None
assistant output: OK

Both main and system-architect smoke tests returned OK after the workaround.

Local workaround used

A local dist workaround was needed to prevent the ChatGPT Codex provider from being captured by the unified boundary-aware transport:

  1. Skip provider stream registration for model.provider === "openai" && model.api === "openai-chatgpt-responses".
  2. Force resolveOpenClawNativeCodexResponsesStreamFn(...) to return streamSimple for openai-chatgpt-responses.
  3. Prevent createOpenAIAttributionHeadersWrapper(...) from swapping the ChatGPT stream into createOpenAIResponsesTransportStreamFn().

This workaround is intentionally narrow to openai-chatgpt-responses; ordinary OpenAI API-key openai-responses, Anthropic, and Codex app-server runtime paths are not the target.

Why this looks like an upstream bug

There appears to already be a special openclaw-native-codex-responses path for this provider/API combination, but in 2026.6.1 the provider stream / OpenAI wrapper / boundary-aware selection path wins first and sends the request through openclaw-openai-responses-transport, which does not currently handle the ChatGPT Codex endpoint response correctly.

Activity

  1. clawsweeper commented on Jun 4, 2026

    @clawsweeper
    Contributor

    Codex review: keeping this open for maintainer follow-up; there is still a little grit to resolve. Reviewed June 3, 2026, 9:10 PM ET / 01:10 UTC.

    Summary
    Codex review failed: timeout.

    Reproducibility: unclear. The review failed before ClawSweeper could establish a reproduction path.

    Ways to help us reproduce this

    • Add a screenshot or short recording showing the behavior.
    • Add expected vs actual behavior.
    • Include redacted logs or terminal output.

    Next step
    Review did not complete, so no work-lane recommendation was made.

    Review details

    Best possible solution:

    Retry the Codex review after fixing the execution failure.

    Do we have a high-confidence way to reproduce the issue?

    Unclear. The review failed before ClawSweeper could establish a reproduction path.

    Is this the best way to solve the issue?

    Unclear. Retry the review first so ClawSweeper can evaluate the actual issue and fix direction.

    AGENTS.md: unclear because the file could not be read completely.

    Remaining risk / open question:

    • No close action taken because the review did not complete.

    Codex review notes: model gpt-5.5, reasoning high; reviewed against 4fbc318e307f.

    Label changes

    Label changes:

    • add issue-rating: 🦪 silver shellfish: Current issue advisory state selects this label.
    • add clawsweeper:needs-info: Current issue advisory state selects this label.
    Evidence reviewed

    What I checked:

    • failure reason: timeout.
    • codex failure detail: Codex review failed for this issue: spawnSync codex ETIMEDOUT.
    • codex stdout: Per-item Codex failure; continuing with the rest of the shard.

    Likely related people:

    • unknown: Codex failed before it could trace repository history. (role: review did not complete; confidence: low)
    How this review workflow works
    • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
    • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
    • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
    • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
    • Maintainers can also comment @clawsweeper review to request a fresh review only.
    • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
    • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
    • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.
  2. aaajiao commented on Jun 6, 2026

    @aaajiao
    Contributor

    Fixed by #90205 (merged in ab0a633), which tolerates a missing content-type header on streamed Codex/ChatGPT Responses replies by sniffing the body and only fast-failing on actual HTML — so valid SSE/JSON with no header now passes through instead of hitting invalid_provider_content_type.

    Note: the fix is not in stable v2026.6.1 yet; it first lands in the v2026.6.5-beta.1 prerelease. This can be closed once that ships to stable (or now, as already-fixed-on-main).

  3. richardmqq commented on Jun 13, 2026

    @richardmqq
    Author

    Verified fixed on stable 2026.6.6 (OpenClaw 2026.6.6 (8c802aa)).

    Post-upgrade validation on macOS:

    • openclaw status --deep --require-rpc reports gateway app 2026.6.6, LaunchAgent loaded/running, update up to date.
    • Native/OpenClaw-runtime openai/gpt-5.4 no-delivery smoke passed for main:
      • turn 1 returned OPENAI_NATIVE_TURN1_OK
      • turn 2 returned OPENAI_NATIVE_TURN2_OK
      • agentHarnessId=openclaw
    • Native/OpenClaw-runtime openai/gpt-5.4 no-delivery smoke passed for system-architect:
      • returned SA_OPENAI_NATIVE_OK
      • agentHarnessId=openclaw

    This confirms the Pi/OpenClaw native ChatGPT Responses transport no longer fails before useful model output on the stable build that includes the upstream fix noted above.

  4. locked as resolved and limited conversation to collaborators on Jun 25, 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

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions