Skip to content

Fix Codex binding OAuth provider routing - #76714

Merged
steipete merged 5 commits into
openclaw:mainfrom
keshavbotagent:fix/codex-binding-preserve-oauth-provider
May 4, 2026
Merged

steipete merged 5 commits into
openclaw:mainfrom
keshavbotagent:fix/codex-binding-preserve-oauth-provider

Conversation

@keshavbotagent

@keshavbotagent keshavbotagent commented May 3, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Preserve Codex-native OAuth auth/profile routing when /codex bind starts or resumes app-server threads.
  • Avoid downgrading Codex OAuth bindings to public OpenAI Responses routing by omitting incompatible modelProvider: "openai" persistence for Codex-native auth.
  • Keep app-server turn failures as clean user-visible replies instead of unhandled rejection crashes.

Root cause

Native Codex conversation binding could keep a sidecar with authProfileId: openai-codex:* while writing/resuming with public OpenAI provider semantics. Fresh or resumed bound turns could therefore call the public OpenAI Responses endpoint without the Codex OAuth transport and fail with 401 Missing bearer or basic authentication.

Tests

  • node scripts/check-changelog-attributions.mjs CHANGELOG.md
  • OPENCLAW_VITEST_MAX_WORKERS=1 node scripts/run-vitest.mjs run --config test/vitest/vitest.extensions.config.ts extensions/codex/src/conversation-binding.test.ts extensions/codex/src/app-server/session-binding.test.ts extensions/codex/src/app-server/auth-bridge.test.ts extensions/codex/src/app-server/thread-lifecycle.test.ts extensions/codex/src/commands.test.ts --maxWorkers=1

@clawsweeper

clawsweeper Bot commented May 3, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

Summary
The PR updates Codex app-server binding/auth routing to preserve selected Codex-native auth profiles, omit incompatible public OpenAI provider metadata for native OAuth bindings, return clean bound-turn failures, add regression tests, and add a changelog entry.

Reproducibility: yes. Source inspection of current main shows a saved Codex binding can carry authProfileId beside modelProvider: "openai", and thread start/resume uses provider-derived public routing without resolving the selected credential provider.

Next step before merge
No repair lane is needed from this review because the latest PR diff has no concrete actionable defect; remaining handling is normal review and CI gating.

Security
Cleared: The diff is limited to Codex plugin source/tests and CHANGELOG.md, with no dependency, workflow, lockfile, permission, secret logging, or downloaded-code path change.

Review details

Best possible solution:

Review and merge this PR after normal CI/maintainer gating; keep stale bound-thread recovery split to #76936.

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

Yes. Source inspection of current main shows a saved Codex binding can carry authProfileId beside modelProvider: "openai", and thread start/resume uses provider-derived public routing without resolving the selected credential provider.

Is this the best way to solve the issue?

Yes. The latest PR head keeps the fix plugin-local, resolves native routing from the selected credential provider, preserves public OpenAI routing for non-native profiles, and adds focused regressions for custom profile ids.

What I checked:

Likely related people:

  • steipete: Path history shows steipete introduced the Codex app-server protocol bridge, recently touched the central binding/auth/lifecycle files, and owns most local blame for these files. (role: introduced behavior and recent maintainer; confidence: high; commits: 69566e43cb8b, 2b7e8dacd3b4, 33a26cd80799; files: extensions/codex/src/app-server/session-binding.ts, extensions/codex/src/app-server/thread-lifecycle.ts, extensions/codex/src/app-server/auth-bridge.ts)
  • vincentkoc: GitHub path history links vincentkoc to the canonical Codex OAuth routing refactor and bound-turn authorization work near this behavior. (role: adjacent auth-routing owner; confidence: medium; commits: 859eb0666282, 346a72ddb913; files: extensions/codex/src/app-server/session-binding.ts, extensions/codex/src/conversation-binding.ts)
  • pashpashpash: Recent merged Codex thread-lifecycle and prompt snapshot work touched adjacent app-server surfaces, though not the auth/profile routing contract directly. (role: recent adjacent Codex lifecycle maintainer; confidence: low; commits: 5bcc3213434e, 563dca82f429; files: extensions/codex/src/app-server/thread-lifecycle.ts, extensions/codex/src/conversation-binding.ts)

Remaining risk / open question:

  • Exact-head CI still has unrelated Discord lint failures outside the PR diff, so merge readiness depends on normal maintainer CI gating even though no PR-introduced blocker was found.
  • I did not run local tests because this sweep is read-only; verification is from source inspection, PR diff review, PR-stated targeted tests, and exact-head CI metadata.

Codex review notes: model gpt-5.5, reasoning high; reviewed against 56de90e87677.

@keshavbotagent
keshavbotagent force-pushed the fix/codex-binding-preserve-oauth-provider branch 2 times, most recently from 3e20b79 to ac021d2 Compare May 3, 2026 18:30
@keshavbotagent
keshavbotagent marked this pull request as ready for review May 3, 2026 18:30
@keshavbotagent
keshavbotagent force-pushed the fix/codex-binding-preserve-oauth-provider branch 2 times, most recently from 57f74d0 to d13e3d4 Compare May 3, 2026 20:47
@keshavbotagent keshavbotagent changed the title Fix Codex binding OAuth provider routing Fix Codex binding OAuth routing and stale thread recovery May 3, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d13e3d4c73

ℹ️ 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".

@keshavbotagent
keshavbotagent force-pushed the fix/codex-binding-preserve-oauth-provider branch from d13e3d4 to 1c63f6d Compare May 3, 2026 20:59
@keshavbotagent keshavbotagent changed the title Fix Codex binding OAuth routing and stale thread recovery Fix Codex binding OAuth provider routing May 3, 2026
@keshavbotagent
keshavbotagent force-pushed the fix/codex-binding-preserve-oauth-provider branch 3 times, most recently from 9a6f5ac to 8c2a97e Compare May 3, 2026 21:59
@steipete
steipete force-pushed the fix/codex-binding-preserve-oauth-provider branch from 8c2a97e to 37aeb96 Compare May 4, 2026 00:05
@steipete
steipete force-pushed the fix/codex-binding-preserve-oauth-provider branch from 37aeb96 to f564b4f Compare May 4, 2026 00:05
@steipete
steipete merged commit c308d04 into openclaw:main May 4, 2026
86 checks passed
@steipete

steipete commented May 4, 2026

Copy link
Copy Markdown
Contributor

Landed via rebase onto current main.

Verification:

  • pnpm test extensions/codex/src/app-server/session-binding.test.ts extensions/codex/src/app-server/thread-lifecycle.test.ts extensions/codex/src/app-server/auth-bridge.test.ts extensions/codex/src/conversation-binding.test.ts extensions/codex/src/conversation-control.test.ts extensions/codex/src/commands.test.ts --maxWorkers=1
  • pnpm exec oxfmt --check --threads=1 CHANGELOG.md extensions/codex/src/app-server/auth-bridge.ts extensions/codex/src/app-server/auth-bridge.test.ts extensions/codex/src/app-server/run-attempt.ts extensions/codex/src/app-server/session-binding.ts extensions/codex/src/app-server/session-binding.test.ts extensions/codex/src/app-server/thread-lifecycle.ts extensions/codex/src/app-server/thread-lifecycle.test.ts extensions/codex/src/command-handlers.ts extensions/codex/src/commands.test.ts extensions/codex/src/conversation-binding.ts extensions/codex/src/conversation-binding.test.ts extensions/codex/src/conversation-control.test.ts
  • git diff --check
  • node scripts/check-changelog-attributions.mjs CHANGELOG.md
  • Blacksmith Testbox: pnpm check:changed (tbx_01kqr4r3170x65bnxd6yejm5ng)
  • GitHub PR checks green on head f564b4f74f38e3fede5052faf4b01a283cfba8d5

Landed commit: c308d04

Thanks @keshavbotagent!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants