[codex] fix OpenAI Codex OAuth transport#75111
Conversation
|
Codex review: needs maintainer review before merge. What this changes: The PR updates OpenAI Codex transport wrapping, native ChatGPT Codex Responses payload sanitization, and Codex OAuth credential metadata persistence with regression tests. Maintainer follow-up before merge: This is an active implementation PR that appears narrowly targeted; the remaining action is maintainer review, CI completion, and optional live OAuth validation rather than an automated replacement fix PR. Security review: Security review cleared: The diff touches OAuth metadata and request shaping but adds no dependency, workflow, script, package-resolution, secret-broadening, or new code-execution surface. Review detailsBest possible solution: Land a targeted provider/transport fix after maintainer review and green relevant checks, keeping the OAuth injection wrapper intact for embedded openai-codex runs while stripping only fields rejected by the native ChatGPT Codex backend. Do we have a high-confidence way to reproduce the issue? Yes. The high-confidence static reproduction path is current main resolving a boundary-aware OAuth-injecting Codex stream, then the attribution wrapper replacing that stream with a fresh Responses transport before the request is sent. Is this the best way to solve the issue? Yes. The PR appears to be the narrowest maintainable fix because it preserves an existing wrapped stream, creates a native Codex transport only for the no-wrapper case, and limits payload sanitization to recognized native ChatGPT Codex URLs. Acceptance criteria:
What I checked:
Likely related people:
Remaining risk / open question:
Codex review notes: model gpt-5.5, reasoning high; reviewed against 46888f5afbe9. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: debfb6d8f0
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
cdc6c35 to
b70bd31
Compare
8f6606a to
e764439
Compare
Preserve the existing wrapped OpenAI Codex stream so PI OAuth bearer injection reaches ChatGPT/Codex Responses, and scope native Codex payload sanitization to the ChatGPT backend.\n\nThanks @keshavbotagent.
Preserve the existing wrapped OpenAI Codex stream so PI OAuth bearer injection reaches ChatGPT/Codex Responses, and scope native Codex payload sanitization to the ChatGPT backend.\n\nThanks @keshavbotagent.
Preserve the existing wrapped OpenAI Codex stream so PI OAuth bearer injection reaches ChatGPT/Codex Responses, and scope native Codex payload sanitization to the ChatGPT backend.\n\nThanks @keshavbotagent.
Preserve the existing wrapped OpenAI Codex stream so PI OAuth bearer injection reaches ChatGPT/Codex Responses, and scope native Codex payload sanitization to the ChatGPT backend.\n\nThanks @keshavbotagent.
Preserve the existing wrapped OpenAI Codex stream so PI OAuth bearer injection reaches ChatGPT/Codex Responses, and scope native Codex payload sanitization to the ChatGPT backend.\n\nThanks @keshavbotagent.
Preserve the existing wrapped OpenAI Codex stream so PI OAuth bearer injection reaches ChatGPT/Codex Responses, and scope native Codex payload sanitization to the ChatGPT backend.\n\nThanks @keshavbotagent.
Summary
openai-codextrafficRoot Cause
Commit d1b2d81 switched
openai-codextraffic throughcreateOpenAIResponsesTransportStreamFn()inside the attribution wrapper. In the embedded runner path that created a fresh transport and bypassed the existing auth-injection wrapper, so the OAuth bearer was not passed into the Codex Responses request and the backend returned401 status code (no body).Fix
client.responses.createmax_output_tokens,temperature, and metadata for custom/proxy Codex-compatible endpointsaccountIdandchatgptPlanTypethrough Codex OAuth login/refresh profile storageValidation
node scripts/test-projects.mjs src/agents/pi-embedded-runner/openai-stream-wrappers.test.ts src/agents/pi-embedded-runner/stream-resolution.test.ts src/agents/openai-transport-stream.test.ts extensions/openai/openai-codex-provider.test.ts extensions/openai/openai-codex-auth-identity.test.tspnpm buildopenclaw agent --agent main --message "Reply with exactly: OK" --json --timeout 180returnedOKwith provideropenai-codexand modelgpt-5.5