Repository navigation
fix: switching back to an OpenAI model fails when the Codex plugin is not enabled - #169412
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. What this changesAllow OpenAI model selection when an unavailable implicit Codex preference can fall back to OpenClaw. Example: With the Codex plugin disabled, select openai/gpt-5.6-luna.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Regression provenanceRegression provenance — verified: source commit Merge readiness✅ Ready for maintainer review Keep open: this PR repairs a current mismatch between model-selection admission and the runtime that executes the next turn. No actionable introduced defects were found. Priority: P1 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherGateway session mutation resolves a requested model, validates its runtime, and produces session state consumed by subsequent agent turns. flowchart LR
A[Model selection client] --> B[Session patch projection]
B --> C[Shared harness availability]
C --> D[OpenClaw fallback or required harness]
D --> E[Harness admission check]
E --> F[Session selection]
F --> G[Next agent turn]
Technical reviewBest possible solution: Use the existing execution availability decision for admission while retaining projection defaults and explicit-runtime rejection. Do we have a high-confidence way to reproduce the issue? Current source shows projection retaining an unavailable implicit Codex id while execution falls back to OpenClaw; the author also reports reproducing the selection failure through the installed CLI. Is this the best way to solve the issue? The repair reuses the canonical availability owner at the rejecting producer, preserves explicit policies, and leaves existing projection callers unchanged. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 2040d1b71db9. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +13, Tests +39. Total +52 across 3 files. Added test files: 1. View PR surface stats
LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed October 11, 2026, 6:29 PM ET / 22:29 UTC. |
|
Maintainer override: the only failed job on exact head
|
|
Landed in f17ac94. With the Codex plugin missing or disabled, |
… not enabled (#169412) ## What Problem This Solves Fixes: `/model openai/<model>` fails with `requires agent harness "codex", but no enabled plugin provides it` when the Codex plugin is not enabled, even though the same model already runs in that session. ## User Impact User impact: operators without the Codex plugin can switch back to an OpenAI model in the TUI, Control UI, and other session-patch clients. Turns already ran these models on the built-in OpenClaw runtime; only the selection check refused them. A model explicitly pinned to `agentRuntime: codex` is still rejected when no plugin provides Codex. ## Why This Change Was Made OpenAI routes prefer Codex implicitly. When that harness is unavailable, a turn falls back to OpenClaw (`implicit-unavailable` in `resolveAgentHarnessAvailabilityDecision`). The model-selection gate added in #134837 read the read-only projection instead, which keeps the bare `codex` id, so it rejected selections that would run fine. The gate now asks for the execution decision through `resolveEffectiveAgentRuntime({ mode: "execution" })`; thinking validation keeps the projection. ## Evidence - Real `openclaw chat` (local embedded, copied operator config with no Codex plugin enabled, real OpenAI and Claude CLI): gpt-6-astra turn → `/model` Claude → `/model openai/gpt-6-astra` printed `model set to openai/gpt-6-astra` and the next turn answered. The installed build failed this step with the error above. - New `src/gateway/sessions-patch.harness-selection.test.ts`: the implicit case fails on `main` and passes here; the explicit Codex pin case still rejects on both. Cost: `pnpm test src/gateway/sessions-patch.harness-selection.test.ts --maxWorkers=1` ≈ 20 s wall, tests ≈ 0.8 s. - `pnpm test src/gateway/sessions-patch.test.ts`: 127 passed. - `node scripts/check-changed.mjs`: all green (typecheck core + core tests) except the dead-export scan, which lists only unchanged `ui/` and `src/` exports already present on `main`. Co-authored-by: Ayaan Zaidi <[email protected]> (cherry picked from commit f17ac94)
… not enabled (openclaw#169412) ## What Problem This Solves Fixes: `/model openai/<model>` fails with `requires agent harness "codex", but no enabled plugin provides it` when the Codex plugin is not enabled, even though the same model already runs in that session. ## User Impact User impact: operators without the Codex plugin can switch back to an OpenAI model in the TUI, Control UI, and other session-patch clients. Turns already ran these models on the built-in OpenClaw runtime; only the selection check refused them. A model explicitly pinned to `agentRuntime: codex` is still rejected when no plugin provides Codex. ## Why This Change Was Made OpenAI routes prefer Codex implicitly. When that harness is unavailable, a turn falls back to OpenClaw (`implicit-unavailable` in `resolveAgentHarnessAvailabilityDecision`). The model-selection gate added in openclaw#134837 read the read-only projection instead, which keeps the bare `codex` id, so it rejected selections that would run fine. The gate now asks for the execution decision through `resolveEffectiveAgentRuntime({ mode: "execution" })`; thinking validation keeps the projection. ## Evidence - Real `openclaw chat` (local embedded, copied operator config with no Codex plugin enabled, real OpenAI and Claude CLI): gpt-6-astra turn → `/model` Claude → `/model openai/gpt-6-astra` printed `model set to openai/gpt-6-astra` and the next turn answered. The installed build failed this step with the error above. - New `src/gateway/sessions-patch.harness-selection.test.ts`: the implicit case fails on `main` and passes here; the explicit Codex pin case still rejects on both. Cost: `pnpm test src/gateway/sessions-patch.harness-selection.test.ts --maxWorkers=1` ≈ 20 s wall, tests ≈ 0.8 s. - `pnpm test src/gateway/sessions-patch.test.ts`: 127 passed. - `node scripts/check-changed.mjs`: all green (typecheck core + core tests) except the dead-export scan, which lists only unchanged `ui/` and `src/` exports already present on `main`. Co-authored-by: Ayaan Zaidi <[email protected]>
… not enabled (#169412) ## What Problem This Solves Fixes: `/model openai/<model>` fails with `requires agent harness "codex", but no enabled plugin provides it` when the Codex plugin is not enabled, even though the same model already runs in that session. ## User Impact User impact: operators without the Codex plugin can switch back to an OpenAI model in the TUI, Control UI, and other session-patch clients. Turns already ran these models on the built-in OpenClaw runtime; only the selection check refused them. A model explicitly pinned to `agentRuntime: codex` is still rejected when no plugin provides Codex. ## Why This Change Was Made OpenAI routes prefer Codex implicitly. When that harness is unavailable, a turn falls back to OpenClaw (`implicit-unavailable` in `resolveAgentHarnessAvailabilityDecision`). The model-selection gate added in #134837 read the read-only projection instead, which keeps the bare `codex` id, so it rejected selections that would run fine. The gate now asks for the execution decision through `resolveEffectiveAgentRuntime({ mode: "execution" })`; thinking validation keeps the projection. ## Evidence - Real `openclaw chat` (local embedded, copied operator config with no Codex plugin enabled, real OpenAI and Claude CLI): gpt-6-astra turn → `/model` Claude → `/model openai/gpt-6-astra` printed `model set to openai/gpt-6-astra` and the next turn answered. The installed build failed this step with the error above. - New `src/gateway/sessions-patch.harness-selection.test.ts`: the implicit case fails on `main` and passes here; the explicit Codex pin case still rejects on both. Cost: `pnpm test src/gateway/sessions-patch.harness-selection.test.ts --maxWorkers=1` ≈ 20 s wall, tests ≈ 0.8 s. - `pnpm test src/gateway/sessions-patch.test.ts`: 127 passed. - `node scripts/check-changed.mjs`: all green (typecheck core + core tests) except the dead-export scan, which lists only unchanged `ui/` and `src/` exports already present on `main`. Co-authored-by: Ayaan Zaidi <[email protected]> (cherry picked from commit f17ac94)
What Problem This Solves
Fixes:
/model openai/<model>fails withrequires agent harness "codex", but no enabled plugin provides itwhen the Codex plugin is not enabled, even though the same model already runs in that session.User Impact
User impact: operators without the Codex plugin can switch back to an OpenAI model in the TUI, Control UI, and other session-patch clients. Turns already ran these models on the built-in OpenClaw runtime; only the selection check refused them. A model explicitly pinned to
agentRuntime: codexis still rejected when no plugin provides Codex.Why This Change Was Made
OpenAI routes prefer Codex implicitly. When that harness is unavailable, a turn falls back to OpenClaw (
implicit-unavailableinresolveAgentHarnessAvailabilityDecision). The model-selection gate added in #134837 read the read-only projection instead, which keeps the barecodexid, so it rejected selections that would run fine. The gate now asks for the execution decision throughresolveEffectiveAgentRuntime({ mode: "execution" }); thinking validation keeps the projection.Evidence
openclaw chat(local embedded, copied operator config with no Codex plugin enabled, real OpenAI and Claude CLI): gpt-6-astra turn →/modelClaude →/model openai/gpt-6-astraprintedmodel set to openai/gpt-6-astraand the next turn answered. The installed build failed this step with the error above.src/gateway/sessions-patch.harness-selection.test.ts: the implicit case fails onmainand passes here; the explicit Codex pin case still rejects on both. Cost:pnpm test src/gateway/sessions-patch.harness-selection.test.ts --maxWorkers=1≈ 20 s wall, tests ≈ 0.8 s.pnpm test src/gateway/sessions-patch.test.ts: 127 passed.node scripts/check-changed.mjs: all green (typecheck core + core tests) except the dead-export scan, which lists only unchangedui/andsrc/exports already present onmain.