openclaw - 💡(How to fix) Fix Codex runtime persists openai-codex as session modelProvider, causing recurring legacy route doctor warning

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…

When using the canonical OpenAI model route with Codex runtime authentication, OpenClaw persists openai-codex into the session's top-level modelProvider after a normal agent run.

This causes openclaw doctor to repeatedly report:

Legacy openai-codex/* session route state detected

Running openclaw doctor --fix clears the warning temporarily, but the warning returns after the next successful agent run.

Root Cause

When using the canonical OpenAI model route with Codex runtime authentication, OpenClaw persists openai-codex into the session's top-level modelProvider after a normal agent run.

This causes openclaw doctor to repeatedly report:

Legacy openai-codex/* session route state detected

Running openclaw doctor --fix clears the warning temporarily, but the warning returns after the next successful agent run.

RAW_BUFFERClick to expand / collapse

Bug type

Doctor / session routing / Codex runtime

Summary

When using the canonical OpenAI model route with Codex runtime authentication, OpenClaw persists openai-codex into the session's top-level modelProvider after a normal agent run.

This causes openclaw doctor to repeatedly report:

Legacy openai-codex/* session route state detected

Running openclaw doctor --fix clears the warning temporarily, but the warning returns after the next successful agent run.

Steps to reproduce

  1. Configure an agent to use a canonical OpenAI model route:

    • primary model: openai/gpt-5.5
    • fallback model: openai/gpt-5.4
    • no explicit agents.defaults.modelProvider
  2. Configure OpenAI auth to use a Codex OAuth profile:

    • routing chain observed as: openai -> codex runtime -> openai-codex auth provider
  3. Run: openclaw config validate

  4. Confirm config is valid and runtime auth is usable.

  5. Run: openclaw doctor --fix --non-interactive

  6. Run a normal agent turn through Telegram/TUI.

  7. Run: openclaw doctor --non-interactive

  8. Inspect the affected session entry in sessions.json.

Expected behavior

The session's top-level modelProvider should remain the user-facing/canonical provider, e.g. openai.

The Codex OAuth auth provider may remain represented separately as an auth profile, e.g. openai-codex:*, but it should not be persisted as the top-level session modelProvider.

After doctor --fix, the legacy route warning should not reappear after a normal successful run.

Actual behavior

After a normal successful run, affected session entries are persisted with:

modelProvider: "openai-codex" model: "gpt-5.5"

The auth profile is also Codex OAuth based, which is expected, but the top-level modelProvider being openai-codex causes doctor to report:

Legacy openai-codex/* session route state detected

The warning returns after each normal run, even after /new, restart, and doctor --fix.

OpenClaw version

OpenClaw 2026.5.27 (27ae826)

OS

Ubuntu 26.04 LTS

Install method

Global npm install

[email protected]

Model

Primary: openai/gpt-5.5 Fallback: openai/gpt-5.4

Provider / routing chain

Configured/user-facing model route:

openai/gpt-5.5

Runtime/auth route observed:

openai -> codex runtime -> openai-codex auth provider

The Codex OAuth auth provider appears usable and valid. This does not look like an auth failure.

Logs / evidence

openclaw config validate passes.

openclaw doctor --non-interactive reports:

Legacy openai-codex/* session route state detected Affected sessions: 2

Affected session entries include top-level:

modelProvider: "openai-codex" model: "gpt-5.5"

The warning reappears after normal agent execution even after running:

openclaw doctor --fix --non-interactive

Local code-path inspection suggests the run result provider is being persisted into the session's top-level runtime model:

  • runner derives providerUsed from runResult.meta.agentMeta.provider
  • session usage persistence writes that provider through persistRunSessionUsage(...)
  • session runtime model storage writes it into top-level entry.modelProvider
  • doctor flags entry.modelProvider === "openai-codex" as legacy session route state

So this appears to be a mismatch between execution/auth provider and user-facing session route provider.

Impact / severity

Low to medium.

This does not appear to break agent execution, but it makes doctor report a recurring warning that cannot be durably fixed with doctor --fix. It also makes Codex recovery/session route state look stale even when the configured model route is already canonical.

Related issues

Related but not identical:

  • #78407
  • #79461
  • #79440

Those appear to cover doctor/migration rewriting or handling openai-codex/* routes. This report is about a normal successful Codex-runtime run persisting openai-codex back into the session's top-level modelProvider, causing the doctor warning to recur.

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

The session's top-level modelProvider should remain the user-facing/canonical provider, e.g. openai.

The Codex OAuth auth provider may remain represented separately as an auth profile, e.g. openai-codex:*, but it should not be persisted as the top-level session modelProvider.

After doctor --fix, the legacy route warning should not reappear after a normal successful run.

Still need to ship something?

×6

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

Back to top recommendations

TRENDING

openclaw - 💡(How to fix) Fix Codex runtime persists openai-codex as session modelProvider, causing recurring legacy route doctor warning