openclaw - ✅(Solved) Fix [Bug]: OpenAI Codex attribution transport causes ChatGPT auth 401 [1 pull requests, 3 comments, 3 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#75240Fetched 2026-05-01 05:36:21
View on GitHub
Comments
3
Participants
3
Timeline
5
Reactions
2
Author
Timeline (top)
commented ×3closed ×1cross-referenced ×1

OpenAI-Codex requests fail with 401 We got your request, but your ChatGPT login did not make it to this service. after the OpenClaw attribution wrapper routes Codex traffic through the generic OpenAI Responses SDK transport.

Root Cause

Impact and severity

Affected: OpenAI-Codex users on commits including d1b2d81752b8b613620affd5dec42461e178792b. Severity: High for affected users because Codex turns fail authentication. Frequency: Reproduced consistently on the bad transport path. Consequence: ChatGPT-backed Codex requests cannot complete.

Fix Action

Fixed

PR fix notes

PR #75241: fix(openai): keep Codex attribution on provider transport

Description (problem / solution / changelog)

Summary

  • Problem: OpenAI-Codex hidden attribution currently reroutes Codex traffic through the generic OpenAI Responses SDK transport.
  • Why it matters: The ChatGPT-backed Codex endpoint rejects that transport path with 401 We got your request, but your ChatGPT login did not make it to this service.
  • What changed: Keep Codex traffic on the underlying provider transport while still applying the resolved OpenClaw attribution headers.
  • What did NOT change (scope boundary): OpenAI/OpenAI-Codex attribution remains enabled; no provider auth/profile selection, model catalog, channel behavior, or public API contract changes.

Change Type (select all)

  • Bug fix
  • Feature
  • Refactor required for the fix
  • Docs
  • Security hardening
  • Chore/infra

Scope (select all touched areas)

  • Gateway / orchestration
  • Skills / tool execution
  • Auth / tokens
  • Memory / storage
  • Integrations
  • API / contracts
  • UI / DX
  • CI/CD / infra

Linked Issue/PR

  • Closes #75240
  • Related #
  • This PR fixes a bug or regression

Root Cause (if applicable)

  • Root cause: createOpenAIAttributionHeadersWrapper treated openai-codex attribution by selecting createOpenAIResponsesTransportStreamFn() instead of the provider/underlying Codex stream function.
  • Missing detection / guardrail: The wrapper test asserted that native Codex traffic was rerouted to the generic OpenAI transport instead of asserting that the working Codex provider transport is preserved while headers are added.
  • Contributing context (if known): Header isolation showed the attribution headers were not the cause when sent through the existing Codex transport; the failing behavior followed the transport swap.

Regression Test Plan (if applicable)

  • Coverage level that should have caught this:
    • Unit test
    • Seam / integration test
    • End-to-end test
    • Existing coverage already sufficient
  • Target test or file: src/agents/pi-embedded-runner/openai-stream-wrappers.test.ts
  • Scenario the test should lock in: openai-codex attribution adds the resolved OpenClaw headers but still invokes the provider transport supplied by the runner.
  • Why this is the smallest reliable guardrail: It covers the exact wrapper branch that selected the wrong stream function without requiring a live ChatGPT auth profile.
  • Existing test that already covers this (if any): src/agents/provider-attribution.test.ts and src/agents/openai-transport-stream.test.ts continue to cover header policy and OpenAI transport behavior.
  • If no new test is added, why not: N/A

User-visible / Behavior Changes

OpenAI-Codex requests with OpenClaw attribution should no longer fail authentication due to being routed through the generic OpenAI Responses SDK transport.

Diagram (if applicable)

Before:
openai-codex attribution -> generic OpenAI Responses SDK transport -> ChatGPT Codex 401

After:
openai-codex attribution -> existing Codex provider transport + OpenClaw headers -> successful Codex turn

Security Impact (required)

  • New permissions/capabilities? (Yes/No) No
  • Secrets/tokens handling changed? (Yes/No) No
  • New/changed network calls? (Yes/No) No new destination or capability; this preserves the existing OpenAI-Codex provider transport instead of switching to the generic OpenAI transport.
  • Command/tool execution surface changed? (Yes/No) No
  • Data access scope changed? (Yes/No) No
  • If any Yes, explain risk + mitigation: N/A

Repro + Verification

Environment

  • OS: Fedora Linux 43 (Cloud Edition), Linux 6.19.9-200.fc43.x86_64
  • Runtime/container: Node 22 source checkout / systemd gateway
  • Model/provider: openai-codex/gpt-5.4
  • Integration/channel (if any): OpenAI-Codex provider path
  • Relevant config (redacted): ChatGPT-backed auth profile with account id/token; secrets redacted

Steps

  1. Run an OpenAI-Codex turn on a commit including d1b2d81752b8b613620affd5dec42461e178792b.
  2. Confirm the attribution wrapper selects the generic OpenAI Responses SDK transport for openai-codex.
  3. Observe the request fail with the 401 message from #75240.
  4. Apply this PR and run the same OpenAI-Codex smoke path.

Expected

  • OpenAI-Codex traffic keeps using the provider transport, includes OpenClaw attribution headers, and completes successfully.

Actual

  • Before this PR, the generic SDK transport path returned 401 We got your request, but your ChatGPT login did not make it to this service.
  • After this PR, the rebuilt local smoke returned OPENCLAW_AUTH_TEST_OK.

Evidence

  • Failing test/log before + passing after
  • Trace/log snippets
  • Screenshot/recording
  • Perf numbers (if relevant)

Human Verification (required)

What you personally verified (not just CI), and how:

  • Verified scenarios:
    • pnpm test src/agents/provider-attribution.test.ts src/agents/openai-transport-stream.test.ts src/agents/pi-embedded-runner/openai-stream-wrappers.test.ts
    • pnpm build
    • Rebuilt local OpenAI-Codex smoke returned OPENCLAW_AUTH_TEST_OK with no 401.
  • Edge cases checked:
    • Attribution headers originator, version, and User-Agent were sent through the existing Codex transport without causing the 401.
    • Generic OpenAI SDK transport still failed after attribution headers were removed, so the issue was not isolated to one bad attribution header.
  • What you did not verify:
    • Full suite/Testbox was not run for this minimal draft PR.
    • A clean through-gateway model turn was not counted as proof because one CLI attempt fell back to embedded after the gateway WebSocket closed; gateway deep status was checked separately.

Review Conversations

  • I replied to or resolved every bot review conversation I addressed in this PR.
  • I left unresolved only the conversations that still need reviewer or maintainer judgment.

If a bot review conversation is addressed by this PR, resolve that conversation yourself. Do not leave bot review conversation cleanup for maintainers.

Compatibility / Migration

  • Backward compatible? (Yes/No) Yes
  • Config/env changes? (Yes/No) No
  • Migration needed? (Yes/No) No
  • If yes, exact upgrade steps: N/A

Risks and Mitigations

  • Risk: A future OpenAI-Codex path could require generic SDK-specific handling.
    • Mitigation: This PR preserves the previously working provider transport and adds a focused regression test for the attribution wrapper branch.

Changed files

Code Example

401 We got your request, but your ChatGPT login did not make it to this service.
RAW_BUFFERClick to expand / collapse

Bug type

Regression (worked before, now fails)

Beta release blocker

No

Summary

OpenAI-Codex requests fail with 401 We got your request, but your ChatGPT login did not make it to this service. after the OpenClaw attribution wrapper routes Codex traffic through the generic OpenAI Responses SDK transport.

Steps to reproduce

  1. Start from a commit that includes d1b2d81752b8b613620affd5dec42461e178792b (fix: send OpenClaw attribution to OpenAI).
  2. Configure a valid ChatGPT-backed openai-codex/gpt-5.4 auth profile/account.
  3. Run an OpenAI-Codex turn with hidden attribution enabled.
  4. Observe the request fail with the 401 message above.

Expected behavior

OpenAI-Codex turns should keep using the working Codex provider transport and complete successfully while still sending OpenClaw attribution headers.

Actual behavior

The attribution wrapper selects the generic OpenAI Responses SDK transport for openai-codex, and the ChatGPT-backed Codex endpoint rejects the request with the 401 message.

OpenClaw version

2026.4.27 at adc20fed0d15c370cc36b8648636112a3c0efcf0; first bad commit isolated to d1b2d81752b8b613620affd5dec42461e178792b.

Operating system

Fedora Linux 43 (Cloud Edition), Linux 6.19.9-200.fc43.x86_64.

Install method

Source checkout / systemd gateway.

Model

openai-codex/gpt-5.4

Provider / routing chain

OpenClaw -> openai-codex -> ChatGPT-backed Codex responses endpoint.

Additional provider/model setup details

Redacted live profile contained a valid ChatGPT account id/token. The same auth worked through the existing Codex/pi transport.

Logs, screenshots, and evidence

401 We got your request, but your ChatGPT login did not make it to this service.

Additional evidence from local isolation:

  • originator, version, and User-Agent attribution headers do not cause the failure when sent through the existing Codex transport.
  • The generic OpenAI SDK transport still failed after removing attribution headers.
  • The generic OpenAI SDK transport still failed after adding Codex-like OpenAI-Beta, session_id, x-client-request-id, and pi-style User-Agent headers.
  • A rebuilt local smoke after keeping Codex on the provider transport returned OPENCLAW_AUTH_TEST_OK with no 401.

Impact and severity

Affected: OpenAI-Codex users on commits including d1b2d81752b8b613620affd5dec42461e178792b. Severity: High for affected users because Codex turns fail authentication. Frequency: Reproduced consistently on the bad transport path. Consequence: ChatGPT-backed Codex requests cannot complete.

Additional information

The minimal fix is not to disable OpenClaw attribution. Keep attribution enabled and apply the headers to the existing Codex provider transport instead of rerouting openai-codex through createOpenAIResponsesTransportStreamFn().

Last known good live checkout was the v2026.4.23 rollback target. First known bad was isolated by bisect to d1b2d81752b8b613620affd5dec42461e178792b.

extent analysis

TL;DR

Apply the OpenClaw attribution headers to the existing Codex provider transport instead of using the generic OpenAI Responses SDK transport for openai-codex requests.

Guidance

  • Verify that the OpenClaw attribution headers are correctly set and applied to the existing Codex provider transport.
  • Check the createOpenAIResponsesTransportStreamFn() function to ensure it is not modifying the authentication headers.
  • Test the OpenAI-Codex requests with the modified transport to confirm the 401 error is resolved.
  • Consider reverting the changes introduced in commit d1b2d81752b8b613620affd5dec42461e178792b to restore the previous working behavior.

Example

No code snippet is provided as the issue does not contain sufficient information about the specific code changes required.

Notes

The issue seems to be related to the introduction of OpenClaw attribution headers and the routing of openai-codex requests through the generic OpenAI Responses SDK transport. The exact cause of the 401 error is not clear, but applying the attribution headers to the existing Codex provider transport may resolve the issue.

Recommendation

Apply the workaround by modifying the transport to use the existing Codex provider transport with OpenClaw attribution headers, as this approach has been confirmed to work in the past and does not disable attribution.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

OpenAI-Codex turns should keep using the working Codex provider transport and complete successfully while still sending OpenClaw attribution headers.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING