Repository navigation
Description
Summary
First off — thank you for OpenClaw and for moving the OpenAI Codex handling onto a cleaner, canonical footing in #88605. The intent (no more openai-codex as a first-class runtime/provider id) makes a lot of sense.
We hit a sharp edge of that migration when upgrading to 2026.6.1: the legacy-config migration removed our openai-codex model provider but did not carry its model definition over to the canonical openai provider. The only place our chat model gpt-5.5 was defined was that provider, so after the upgrade the model simply no longer existed — and every agent went silent.
I think the scenario below may not have been considered, because it depends on a perfectly reasonable reason to have both providers configured at the same time.
Why we had a canonical openai provider and an openai-codex provider
These two providers served two different, legitimate purposes with two different auth modes:
openai(api_key,baseUrl: https://api.openai.com/v1) — existed only to hosttext-embedding-3-smallfor memory / vector search (agents.defaults.memorySearch.provider: "openai",model: "text-embedding-3-small"). This is the standard embeddings setup.openai-codex(oauth,baseUrl: https://chatgpt.com/backend-api,api: openai-codex-responses) — hosted the actual chat modelgpt-5.5, used by every agent viaagents.defaults.model.primary: "openai/gpt-5.5"withagentRuntime.id: "codex".
So the canonical openai provider was present, but it was embeddings-only — it did not contain gpt-5.5. The migration treated the existence of any canonical openai provider as "the codex provider is now redundant" and dropped it, taking gpt-5.5 with it.
Root cause
In migrateLegacyOpenAICodexProvider (dist legacy-config-migrations-*.js), the relevant branch is roughly:
if (!hasCanonicalOpenAIProvider(providers)) {
providers[OPENAI_PROVIDER_ID] = normalized.value; // move codex -> openai
changes.push(`Moved models.providers.openai-codex → models.providers.openai.`);
} else {
changes.push(`Removed models.providers.openai-codex because models.providers.openai already exists.`);
}
delete providers[providerId];When a canonical openai provider already exists, the codex provider is deleted outright. Its models[] (including gpt-5.5) are not merged into the existing openai provider, and the already-computed normalized.value (with the openai-codex-responses → openai-chatgpt-responses api rename applied) is discarded. The assumption seems to be that a canonical openai provider already covers everything the codex provider did — which isn't true when the two providers hold disjoint models (embeddings vs. the ChatGPT-backend chat model).
This behavior runs both during openclaw doctor --fix and during the post-openclaw update doctor step, so the upgrade applies it automatically.
Impact
After the upgrade, openai/gpt-5.5 was unresolvable. Every agent turn failed. The user-facing symptom chain:
Codex app-server auth profile "openai:<account>" was not found.(native Codex path)- embedded failover →
401 Unauthorized: Missing bearer or basic authentication in header, url: https://api.openai.com/v1/responses Embedded agent failed before reply: …
Net effect: a fully working multi-agent fleet went completely silent after a routine update, with no obvious pointer that a model had been removed (config still validated cleanly, since the dangling auth profile alone is accepted).
Environment
- OpenClaw:
2026.6.1 (2e08f0f) - Node:
v22.22.2 - Install: npm global (Linux)
- Auth: Codex/ChatGPT OAuth for the chat model; OpenAI api_key path only for embeddings
- Default route:
openai/gpt-5.5,agentRuntime.id: "codex"
Steps to reproduce
- On a pre-6.1 install, configure two model providers:
models.providers.openai(api_key) with only an embedding model (e.g.text-embedding-3-small), referenced byagents.defaults.memorySearch.models.providers.openai-codex(oauth,api: openai-codex-responses) with the chat modelgpt-5.5.agents.defaults.model.primary: "openai/gpt-5.5", runtimecodex.
- Upgrade to
2026.6.1(or runopenclaw doctor --fix). - Observe:
models.providers.openai-codexis removed;gpt-5.5no longer exists under any provider; all agents fail with the auth-profile/401 chain above.
Suggested fix
When removing a "shadowed" openai-codex provider because a canonical openai provider already exists, merge rather than drop:
- Move any models from
openai-codexthat are not already present inopenaiintoopenai.models[]. - Apply the existing
openai-codex-responses→openai-chatgpt-responsesrename to those moved models (the code already computes this asnormalized.value). - Preserve each moved model's
baseUrl(the ChatGPT-backend models rely on a per-modelbaseUrl, since theopenaiprovider's ownbaseUrlpoints atapi.openai.com).
That way the canonical-openai-already-exists case keeps both the embeddings model and the ChatGPT-backend chat model, and the migration stays loss-free.
A secondary, lower-priority nicety: when a model route (e.g. openai/gpt-5.5) becomes unresolvable as a result of a migration, surfacing a doctor warning would have made this immediately diagnosable.
Workaround (for anyone hitting this)
- Add the chat model back into the canonical
openaiprovider'smodels[], using the new api id and a per-model baseUrl:(Do not recreate a separate{ "id": "gpt-5.5", "name": "GPT-5.5", "baseUrl": "https://chatgpt.com/backend-api", "api": "openai-chatgpt-responses", "reasoning": false, "input": ["text"], "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 }, "contextWindow": 200000, "contextTokens": 195000, "maxTokens": 8192 }openai-codexprovider — it fails 6.1 schema validation, anddoctor --fixwould remove it again.) - Run
openclaw doctor --fixto rename the danglingopenai-codex:<account>auth profile to the canonicalopenai:<account>and rewrite references. Existing OAuth credentials are reused — no re-login is required. - Restart the gateway.
openclaw config validateshould be clean and agents respond again.
Thanks again for the great work, and happy to help confirm a fix against this configuration shape.
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Activity
clawsweeper commentedon Jun 3, 2026
Codex review: keeping this open for maintainer follow-up; there is still a little grit to resolve. Reviewed June 3, 2026, 7:17 PM ET / 23:17 UTC.
Summary
Current main still contains the shipped migration behavior that deletes a legacy
openai-codexprovider whenever any canonicalopenaiprovider exists, so the reported lossy upgrade path remains actionable.Reproducibility: yes. A config with
models.providers.openaiplusmodels.providers.openai-codex.models[]follows the source branch that deletes the legacy provider when canonicalopenaiexists, although I did not run doctor in this read-only review.Next step
This is a narrow doctor migration regression with clear source, history, and focused test surfaces.
Review details
Best possible solution:
Keep the canonical
openaiprovider, but have doctor merge non-conflicting normalized legacyopenai-codex.models[]entries into it, preserving per-modelapi,baseUrl, runtime policy, and metadata while skipping or clearly reporting true conflicts.Do we have a high-confidence way to reproduce the issue?
Yes. A config with
models.providers.openaiplusmodels.providers.openai-codex.models[]follows the source branch that deletes the legacy provider when canonicalopenaiexists, although I did not run doctor in this read-only review.Is this the best way to solve the issue?
Yes. Merging normalized disjoint model rows in the doctor migration is the narrowest maintainable fix because runtime stays canonical while user-owned model metadata is not lost.
AGENTS.md: found and applied where relevant.
Remaining risk / open question:
openclaw doctor --fixagainst a synthetic config because this review is read-only, so the reproduction is source-proven rather than runtime-run.gpt-5.5, so some installs may avoid a pure unknown-model failure; the remaining actionable bug is still that custom legacy model rows and per-model metadata are discarded instead of migrated.Codex review notes: model gpt-5.5, reasoning high; reviewed against 116bc2a0f0c4.
Label changes
Label changes:
P1: The report describes a latest-release upgrade regression that can break OpenAI/Codex-backed agent turns for existing multi-provider configs.impact:data-loss: The migration deletes legacy configured model rows instead of preserving them under the canonical provider.impact:message-loss: The user-visible symptom is agents failing before they can reply after upgrade.impact:auth-provider: The dropped provider/model metadata affects OpenAI/Codex provider routing, auth mode, and model resolution.issue-rating: 🦞 diamond lobster: Current issue advisory state selects this label.clawsweeper:source-repro: Current issue advisory state selects this label.clawsweeper:queueable-fix: Current issue advisory state selects this label.clawsweeper:fix-shape-clear: Current issue advisory state selects this label.Label justifications:
P1: The report describes a latest-release upgrade regression that can break OpenAI/Codex-backed agent turns for existing multi-provider configs.impact:data-loss: The migration deletes legacy configured model rows instead of preserving them under the canonical provider.impact:auth-provider: The dropped provider/model metadata affects OpenAI/Codex provider routing, auth mode, and model resolution.impact:message-loss: The user-visible symptom is agents failing before they can reply after upgrade.Evidence reviewed
Acceptance criteria:
What I checked:
migrateLegacyOpenAICodexProvidernormalizes the legacy provider but, whenhasCanonicalOpenAIProvider(providers)is true, records removal and deletes the legacy provider without merging itsmodels[]intoopenai. (src/commands/doctor/shared/legacy-config-migrations.runtime.models.ts:997, 116bc2a0f0c4)records removal when canonical OpenAI provider already existsexpects the canonicalopenaiprovider to remain unchanged andopenai-codexto be absent, with no coverage for preserving disjoint model rows. (src/commands/doctor/shared/legacy-config-migrate.test.ts:104, 116bc2a0f0c4)migrateLegacyConfigcallsapplyLegacyDoctorMigrations, and that migration set includes the runtime model migrations containingmodels.providers.openai-codex->models.providers.openai. (src/commands/doctor/shared/legacy-config-migrate.ts:10, 116bc2a0f0c4)v2026.6.1tag points at the latest release commit and its tagged source still contains the sameRemoved models.providers.openai-codex because models.providers.openai already existsbranch. (src/commands/doctor/shared/legacy-config-migrations.runtime.models.ts:997, 2e08f0f4221f)openai-codexremoval. (src/commands/doctor/shared/legacy-config-migrations.runtime.models.ts:997, 00d17e9df784)codex-rs/login/src/auth/manager.rs:49, 4d4837c49513)Likely related people:
refactor: make OpenAI Codex legacy doctor-onlyand changed the migration and tests for this exact surface. (role: introduced behavior; confidence: high; commits: 00d17e9df784; files:src/commands/doctor/shared/legacy-config-migrations.runtime.models.ts,src/commands/doctor/shared/legacy-config-migrate.test.ts)src/commands/doctor/shared/legacy-config-migrations.runtime.models.ts,src/commands/doctor/shared/legacy-config-migrate.test.ts)How this review workflow works
@clawsweeper re-reviewcomments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.@clawsweeper re-reviewor@clawsweeper re-runon an open PR or issue to request a fresh review only.@clawsweeper reviewto request a fresh review only.@clawsweeper autofix,@clawsweeper automerge,@clawsweeper fix ci, or@clawsweeper address review.@clawsweeper explainto ask for more context, or@clawsweeper stopto stop active automation.ooiuuii commentedon Jun 4, 2026
Adding another 2026.6.1 upgrade datapoint.
Environment (sanitized):
2026.5.28 (e932160)->2026.6.1 (2e08f0f).openai/gpt-5.5plusagentRuntime.id: "codex".What happened:
doctor --fixidentified the Codex migration/plugin direction and installed/enabled the Codex plugin path, but the config write did not fully land for all old model refs.openai-codex/gpt-5.5refs after the first pass, including defaults/main agent state.Unknown model: openai-codex/gpt-5.5until those residual refs were manually fixed.Expected behavior:
openai-codex/*is accepted as legacy migration input, all relevant durable config locations should be rewritten or explicitly reported as unresolved.codexruntime/plugin requirement is satisfied when producingopenai/gpt-5.5+agentRuntime.id: "codex".I plan to follow up with a focused PR for config migration coverage first, separate from session-store migration/status display changes.
ooiuuii commentedon Jun 4, 2026
Opened PR #90317 as the focused PR1 for config-migration coverage.
Scope:
agents.defaults.modelplus multipleagents.list[].modelentries still onopenai-codex/gpt-5.5openai/gpt-5.5, preserves Codex intent viaagentRuntime.id = "codex", and enables/adds thecodexplugin when a restrictive allowlist existsThis intentionally does not cover session-store persistence or route re-persistence; I will keep those in separate PRs linked to #90036.
fix(doctor): merge legacy codex models safely
fix(doctor): merge legacy codex models safely