Skip to content

Keep OpenAI Codex migrations on automatic runtime routing#79238

Merged
pashpashpash merged 5 commits into
mainfrom
codex/doctor-openai-codex-auto-runtime
May 8, 2026
Merged

Keep OpenAI Codex migrations on automatic runtime routing#79238
pashpashpash merged 5 commits into
mainfrom
codex/doctor-openai-codex-auto-runtime

Conversation

@pashpashpash

@pashpashpash pashpashpash commented May 8, 2026

Copy link
Copy Markdown
Contributor

Legacy openai-codex/* repair had two jobs: move users to canonical openai/* model refs, and keep their Codex subscription auth path working. It accidentally made runtime selection too broad by writing whole-agent and session-level Codex pins.

That made mixed-provider agents brittle. OpenAI turns already choose the Codex harness automatically, so pinning the whole agent to Codex meant later MiniMax, Anthropic, or other non-OpenAI model switches could be sent through the Codex app-server and fail with provider-not-found errors.

This keeps the migration narrower. OpenAI agent turns stay on Codex by default, but runtime policy is now provider/model scoped. Legacy whole-agent runtime config, OPENCLAW_AGENT_RUNTIME, and stale session harness/runtime pins are ignored by live routing and cleaned by doctor. Explicit provider/model PI still works for OpenAI, including the openai-codex OAuth compatibility route through PI's legacy Codex-auth transport. Legacy CLI/runtime model refs are migrated to canonical provider/model refs with model-scoped runtime policy when that intent still needs to be preserved.

Real behavior proof

  • Behavior or issue addressed: openclaw doctor --fix should migrate openai-codex/* to canonical openai/* without adding a whole-agent agentRuntime.id: "codex" pin that breaks mixed-provider agents.
  • Real environment tested: Local OpenClaw CLI from this branch on macOS, using an isolated temporary OPENCLAW_CONFIG_PATH, OPENCLAW_HOME, and OPENCLAW_STATE_DIR so the run used a real config file without touching my normal gateway state.
  • Exact steps or command run after this patch: Created a temp config with agents.defaults.model = "openai-codex/gpt-5.5", then ran pnpm openclaw doctor --fix --non-interactive with OPENCLAW_CONFIG_PATH pointed at that temp config.
  • Evidence after fix: Terminal output from the real CLI proof script:
{
  "exitCode": 0,
  "model": "openai/gpt-5.5",
  "agentRuntime": null,
  "doctorMentionedCanonicalRoute": true
}
  • Observed result after fix: The actual CLI repair exited 0, rewrote the legacy route to openai/gpt-5.5, printed the canonical route repair, and left agents.defaults.agentRuntime absent instead of pinning Codex.
  • What was not tested: Full Discord/Gateway pod restart behavior was not retested in this PR; this proof covers the doctor migration that caused the bad runtime pin.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation commands Command implementations agents Agent runtime and tooling size: M maintainer Maintainer-authored PR labels May 8, 2026
@pashpashpash pashpashpash force-pushed the codex/doctor-openai-codex-auto-runtime branch 3 times, most recently from 636438c to 71fff29 Compare May 8, 2026 04:49
@clawsweeper

clawsweeper Bot commented May 8, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

Summary
The branch moves OpenAI Codex migration and runtime selection from whole-agent/session pins to provider/model-scoped policy, updates doctor/session cleanup, config schemas, status surfaces, docs, and tests.

Reproducibility: yes. Current-main source shows doctor can create whole-agent Codex pins and execution can reuse session pins, while #79279 provides 2026.5.7 MiniMax/Anthropic provider-not-found logs.

Real behavior proof
Sufficient (terminal): The PR body includes after-fix terminal output from a real isolated CLI doctor --fix run showing canonical migration and no whole-agent runtime pin.

Next step before merge
Maintainer review should decide the broad provider/model runtime-policy contract; no narrow automated repair remains after fe2dd61cef3f.

Security
Cleared: No concrete security or supply-chain regression was found in the diff; it changes runtime/config/docs/tests and does not alter workflows, dependencies, lockfiles, install scripts, or secret handling.

Review details

Best possible solution:

Land this branch after maintainer contract review and exact-head CI remain green, then resolve the linked mixed-provider Codex routing bug as implemented.

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

Yes. Current-main source shows doctor can create whole-agent Codex pins and execution can reuse session pins, while #79279 provides 2026.5.7 MiniMax/Anthropic provider-not-found logs.

Is this the best way to solve the issue?

Yes, pending maintainer approval. Provider/model-scoped runtime policy is the maintainable direction here, and fe2dd61cef3f fixes the prior gap by clearing stale session runtime keys during doctor repair.

What I checked:

Likely related people:

  • pashpashpash: Prior merged OpenAI Codex routing/plugin activation commits touch the same harness, execution, and doctor-routing behavior, beyond authorship of this PR. (role: recent maintainer and prior merged implementer; confidence: high; commits: 1c3399010815, c8f3fecad6fe, 3a901b5e9539; files: src/agents/harness/selection.ts, src/agents/command/attempt-execution.ts, src/commands/doctor/shared/codex-route-warnings.ts)
  • vincentkoc: Existing review history links this maintainer to legacy Codex route repair and provider runtime normalization in the affected doctor/config areas. (role: adjacent route-repair owner; confidence: medium; commits: bca670920362, aa27e27f3606; files: src/commands/doctor/shared/codex-route-warnings.ts, src/agents/harness/selection.ts, src/config/types.models.ts)
  • 100yenadmin: Existing review history links this maintainer to Codex harness extension seams that provider/model runtime policy builds on. (role: harness seam introducer; confidence: medium; commits: c13836804058; files: src/agents/harness/selection.ts, docs/plugins/sdk-agent-harness.md)

Remaining risk / open question:

  • The change intentionally alters public runtime-config semantics across CLI, Gateway, docs, generated schemas, and status surfaces, so maintainer contract review remains required.
  • The contributor proof covers isolated doctor CLI migration; a full Docker/Gateway mixed-provider live turn was not retested in the PR body.

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

@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label May 8, 2026
@pashpashpash pashpashpash force-pushed the codex/doctor-openai-codex-auto-runtime branch from 71fff29 to 76e5103 Compare May 8, 2026 05:42
@pashpashpash pashpashpash requested a review from a team as a code owner May 8, 2026 05:42
@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime size: XL and removed size: M labels May 8, 2026
@pashpashpash pashpashpash force-pushed the codex/doctor-openai-codex-auto-runtime branch from 76e5103 to 2633720 Compare May 8, 2026 05:45
@openclaw-barnacle openclaw-barnacle Bot added the app: web-ui App: web-ui label May 8, 2026
@pashpashpash pashpashpash force-pushed the codex/doctor-openai-codex-auto-runtime branch from d3a1422 to c2ffafc Compare May 8, 2026 06:24
@pashpashpash pashpashpash force-pushed the codex/doctor-openai-codex-auto-runtime branch from c2ffafc to 9feb331 Compare May 8, 2026 06:44
@pashpashpash

Copy link
Copy Markdown
Contributor Author

The P2 finding was valid and is fixed in fe2dd61.

doctor --fix now clears agentHarnessId and agentRuntimeOverride whenever it repairs legacy Codex session route state, while preserving the openai-codex:* auth profile override. Canonical OpenAI sessions without legacy Codex route state are still left alone.

Validation after the fix:

  • pnpm test src/commands/doctor/shared/codex-route-warnings.test.ts src/agents/command/attempt-execution.cli.test.ts src/agents/harness/selection.test.ts src/gateway/server.sessions.store-rpc.test.ts
  • pnpm config:docs:check (config:docs:gen/check is not a script on this branch; this is the repo's matching generated config-doc check)
  • pnpm check:changed
  • git diff --check

@pashpashpash

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented May 8, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

Re-review progress:

@pashpashpash pashpashpash merged commit 02fe0d8 into main May 8, 2026
111 checks passed
@pashpashpash pashpashpash deleted the codex/doctor-openai-codex-auto-runtime branch May 8, 2026 07:05
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 9, 2026
…9238)

* fix: keep migrated openai codex routes automatic

* scope runtime policy to providers and models

* fix runtime policy surfaces

* fix ci runtime policy checks

* fix doctor stale session runtime pins
rogerdigital pushed a commit to rogerdigital/openclaw that referenced this pull request May 9, 2026
…9238)

* fix: keep migrated openai codex routes automatic

* scope runtime policy to providers and models

* fix runtime policy surfaces

* fix ci runtime policy checks

* fix doctor stale session runtime pins
lykeion-dev pushed a commit to lykeion-dev/openclaw--rev that referenced this pull request May 14, 2026
…9238)

* fix: keep migrated openai codex routes automatic

* scope runtime policy to providers and models

* fix runtime policy surfaces

* fix ci runtime policy checks

* fix doctor stale session runtime pins
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 24, 2026
…9238)

* fix: keep migrated openai codex routes automatic

* scope runtime policy to providers and models

* fix runtime policy surfaces

* fix ci runtime policy checks

* fix doctor stale session runtime pins
jameslcowan pushed a commit to jameslcowan/openclaw that referenced this pull request Jun 2, 2026
…9238)

* fix: keep migrated openai codex routes automatic

* scope runtime policy to providers and models

* fix runtime policy surfaces

* fix ci runtime policy checks

* fix doctor stale session runtime pins
sablehead pushed a commit to sablehead/openclaw that referenced this pull request Jun 10, 2026
…9238)

* fix: keep migrated openai codex routes automatic

* scope runtime policy to providers and models

* fix runtime policy surfaces

* fix ci runtime policy checks

* fix doctor stale session runtime pins
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling app: web-ui App: web-ui commands Command implementations docs Improvements or additions to documentation gateway Gateway runtime maintainer Maintainer-authored PR proof: sufficient ClawSweeper judged the real behavior proof convincing. size: XL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant