Skip to content

fix: switching back to an OpenAI model fails when the Codex plugin is not enabled - #169412

Merged
obviyus merged 1 commit into
mainfrom
fix/chat-local-issues
Oct 12, 2026
Merged

obviyus merged 1 commit into
mainfrom
fix/chat-local-issues

Conversation

@obviyus

@obviyus obviyus commented Oct 11, 2026

Copy link
Copy Markdown
Collaborator

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.

@clawsweeper

clawsweeper Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime agents Agent runtime and tooling size: S labels Oct 11, 2026
@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 11, 2026
@clawsweeper

clawsweeper Bot commented Oct 11, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

Allow 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.

  • Before: Selection fails because no enabled plugin provides the Codex harness.
  • After: Selection succeeds through the existing OpenClaw fallback; an explicit Codex pin still fails.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Focused, source-supported repair with useful boundary tests; shipped-entry behavior is reported in prose rather than supplied as a direct execution trace.
Proof confidence 🦐 gold shrimp (3/6) The supplied maintainer-authorship instruction exempts this PR from the ordinary contributor-proof gate; its body reports a real embedded CLI model switch followed by a successful turn, while the inspected images demonstrate the earlier admission PR.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Operators without an enabled Codex plugin cannot switch back to an OpenAI model that already runs through OpenClaw.
Reason: The focused change reconciles selection with existing execution behavior without adding configuration or changing explicit runtime intent; the supplied maintainer-authorship instruction settles direction.

Regression provenance

Regression provenance — verified: source commit 2e3cae2ae352 by Peter Steinberger; canonical PR #134837 (blame-to-merge-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
Reviewed head: 407f58ab23a07e9bf35a35bf059a089504d75db9

Before merge

None.

Findings

None.

Agent review details

How this fits together

Gateway 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]
Loading

Technical review

Best 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

  • Session model admission changes intended behavior with a stated reason (2e3cae2: Reject selections lacking an activatable required harness before persisting session fields or sticky defaults.)
  • Thinking runtime projection keeps the original intent (625f3cf: Share availability policy while keeping cold projections from treating an unregistered harness as unavailable.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 2e3cae2 adds src/gateway/sessions-patch.ts:514 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 2e3cae2ae352; files: src/gateway/sessions-patch.ts)
  • Ayaan Zaidi: Raw commit 144adb9 adds src/gateway/sessions-patch.ts:593 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 144adb922ad3; files: src/gateway/sessions-patch.ts)

PR surface

Source +13, Tests +39. Total +52 across 3 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 2 15 2 +13
Tests 1 39 0 +39
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 54 2 +52

Labels

Label changes:

  • add P1: A currently executable OpenAI model cannot be reselected through Gateway session-patch clients when the implicit Codex harness is unavailable.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P1: A currently executable OpenAI model cannot be reselected through Gateway session-patch clients when the implicit Codex harness is unavailable.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed October 11, 2026, 6:29 PM ET / 22:29 UTC.

@obviyus

obviyus commented Oct 12, 2026

Copy link
Copy Markdown
Collaborator Author

Maintainer override: the only failed job on exact head 407f58ab23a (run 38180346270) is checks-ui-e2e (1/2). All other red jobs were cancelled when that job failed, plus the openclaw/ci-gate aggregate.

  • Failing test: ui/src/e2e/board-mcp-app.e2e.test.ts › "retains one board runtime across split, expanded, and inactive panel states". This PR does not touch ui/.
  • Same failure on main: scheduled CI at 3be41182be, checks-ui-e2e (5/9). Scheduled main CI has failed every hour since.
  • Same failure on an unrelated PR: run 38181257310, checks-ui-e2e (1/2).
  • Cancelled jobs, covered locally at this head: check-changed passed (typecheck core and core tests, lint core changed files, guards, import cycles, format). Changed-file Vitest (gateway, agents-core) passed: 149 tests. The dead-export scan lists only unchanged ui/ and src/ exports already present on main.

@obviyus
obviyus merged commit f17ac94 into main Oct 12, 2026
105 of 125 checks passed
@obviyus
obviyus deleted the fix/chat-local-issues branch October 12, 2026 00:14
@obviyus

obviyus commented Oct 12, 2026

Copy link
Copy Markdown
Collaborator Author

Landed in f17ac94. With the Codex plugin missing or disabled, /model openai/<model> now passes the same harness check a turn uses. A turn runs these models on OpenClaw, so selecting them no longer fails. A model pinned to Codex in config is still rejected when no plugin provides Codex. Proof: a real openclaw chat session switched from gpt-6-astra to Claude CLI and back, then answered on gpt-6-astra. The new regression test fails on main and passes here.

RomneyDa pushed a commit that referenced this pull request Oct 12, 2026
… 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)
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 12, 2026
… 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]>
RomneyDa pushed a commit that referenced this pull request Oct 13, 2026
… 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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling gateway Gateway runtime P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant