-
-
Notifications
You must be signed in to change notification settings - Fork 79.1k
[Bug]: doctor --fix silently migrates intentional openai-codex/ config to openai/, breaking PI+OAuth runtime and causing 3-4x token inflation #84038
Copy link
Copy link
Closed
Labels
P1High-priority user-facing bug, regression, or broken workflow.High-priority user-facing bug, regression, or broken workflow.bugSomething isn't workingSomething isn't workingclawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.ClawSweeper found an open linked pull request for this issue.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:auth-providerAuth, provider routing, model choice, or SecretRef resolution may break.Auth, provider routing, model choice, or SecretRef resolution may break.impact:data-lossCan lose, corrupt, or silently drop user/session/config data.Can lose, corrupt, or silently drop user/session/config data.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.
Metadata
Metadata
Assignees
Labels
P1High-priority user-facing bug, regression, or broken workflow.High-priority user-facing bug, regression, or broken workflow.bugSomething isn't workingSomething isn't workingclawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.ClawSweeper found an open linked pull request for this issue.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:auth-providerAuth, provider routing, model choice, or SecretRef resolution may break.Auth, provider routing, model choice, or SecretRef resolution may break.impact:data-lossCan lose, corrupt, or silently drop user/session/config data.Can lose, corrupt, or silently drop user/session/config data.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Bug type
Regression (worked before, now fails)
Beta release blocker
No
Summary
The native Codex runtime produces 3–4× higher token usage compared to the
OpenClaw PI runtime for the same GPT-5.x requests. This is a known upstream
issue that OpenClaw cannot fix — but
doctor --fixsilently forces users ontothe broken runtime by migrating intentional
openai-codex/configs toopenai/, removing theagentRuntime: { id: "pi" }override in the process.Users have no way to opt out of this migration short of manually reverting
after every doctor run.
Steps to reproduce
{ "agents": { "defaults": { "model": { "primary": "openai-codex/gpt-5.4" }, "models": { "openai-codex/gpt-5.4": { "agentRuntime": { "id": "pi" } } } } }, "auth": { "order": { "openai-codex": ["openai-codex:user@example.com"] } }, "plugins": { "entries": { "codex": { "enabled": false } } } }Repaired Codex model routes:
openclaw models status
Expected behavior
- Doctor respects an explicitly configured openai-codex/ primary and
agentRuntime: { id: "pi" } override. If the user has deliberately opted
out of the native Codex runtime (because buggy/token-burn), doctor should not re-enroll them.
agentRuntime config from the old entry and copy it to the new one.
similar to how it already shows interactive summaries for other migrations.
Actual behavior
is removed entirely
(observed with GPT-5.4; even worse with GPT-5.5)
instead of openai-codex/gpt-5.4 · oauth — auth path also silently switched
OpenClaw version
from 2026.5.12 onwards
Operating system
macOS 26.5
Install method
No response
Model
openai-codex/gpt-5.x
Provider / routing chain
Desired (PI runtime, working): User message → openai-codex/gpt-5.4 → auth: oauth (openai-codex:user@example.com) → runtime: OpenClaw PI → tokens_prompt: baseline (1×)
Additional provider/model setup details
Provider / Routing Chain
Desired (PI runtime, working):
User message
→ openai-codex/gpt-5.4
→ auth: oauth (openai-codex:user@example.com)
→ runtime: OpenClaw PI
→ tokens_prompt: baseline (1×)
Actual after doctor (native Codex runtime, broken):
User message
→ openai/gpt-5.4
→ auth: api-key (env: OPENAI_API_KEY) ← wrong auth path
→ runtime: native Codex harness ← broken runtime
→ tokens_prompt: 3–4× baseline ← token inflation
The OPENAI_API_KEY is present in this environment for unrelated features
(Talk/Voice). With primary: openai/gpt-5.4, OpenClaw silently prefers the
direct API key path even when auth.order.openai-codex is configured — this
auth-path ambiguity is the original reason for adopting the explicit
openai-codex/ namespace
Logs, screenshots, and evidence
Impact and severity
No response
Additional information
Proposed Fix / Feature Request
The root issue is the native Codex runtime itself — it is producing
significantly inflated token counts compared to the PI runtime for equivalent
workloads. This appears to be an upstream Codex issue that OpenClaw cannot
directly fix at the provider level.
Until that is resolved, users need a stable way to opt out. Specifically:
Doctor should not overwrite a model entry that carries this key without
at minimum a warning.
path that doctor steers users toward. Users should be able to choose
whether they want the native Codex harness or the PI runtime — and that
choice should survive doctor --fix.
forward to the new model ref automatically.
Workaround
Manually reapply after every doctor --fix:
openclaw config set agents.defaults.model.primary "openai-codex/gpt-5.4"
openclaw config set agents.defaults.models["openai-codex/gpt-5.4"].agentRuntime.id "pi"
openclaw gateway restart --force