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 --fix silently forces users onto
the broken runtime by migrating intentional openai-codex/ configs to
openai/, removing the agentRuntime: { 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
- Configure an explicit PI-runtime setup to avoid the broken Codex runtime:
{
"agents": {
"defaults": {
"model": {
"primary": "openai-codex/gpt-5.4"
},
"models": {
"openai-codex/gpt-5.4": {
"agentRuntime": { "id": "pi" }
}
}
}
},
"auth": {
"order": {
"openai-codex": ["openai-codex:[email protected]"]
}
},
"plugins": {
"entries": { "codex": { "enabled": false } }
}
}
- Run openclaw doctor --fix (e.g. as part of a version update)
- Observe doctor output:
Repaired Codex model routes:
- agents.defaults.model.primary: openai-codex/gpt-5.4 -> openai/gpt-5.4
- agents.defaults.models.openai-codex/gpt-5.4: openai-codex/gpt-5.4 -> openai/gpt-5.4
- Restart the gateway
- Send any message to the agent and observe token usage or check
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.
- If doctor must migrate model references, it should at minimum preserve the
agentRuntime config from the old entry and copy it to the new one.
- Ideally: doctor warns and asks before applying breaking model-route changes,
similar to how it already shows interactive summaries for other migrations.
Actual behavior
- primary is silently changed to openai/gpt-5.4
- The models["openai-codex/gpt-5.4"] entry — including agentRuntime: { id: "pi" } —
is removed entirely
- All model aliases pointing to openai-codex/gpt-5.4 are dropped
- The gateway starts with the native Codex runtime active
- Token usage per turn is 3–4× higher than before the migration
(observed with GPT-5.4; even worse with GPT-5.5)
- openclaw models status shows openai/gpt-5.4 · api-key (env: OPENAI_API_KEY)
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:[email protected]) → 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:[email protected])
→ 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:
- Respect agentRuntime: { id: "pi" } as an explicit opt-out signal.
Doctor should not overwrite a model entry that carries this key without
at minimum a warning.
- Surface the Codex runtime as experimental / opt-in, not the default
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.
- If migration is unavoidable, carry agentRuntime and alias config
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
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:[email protected]"] } }, "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:[email protected]) → 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:[email protected])
→ 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