Skip to content

fix(gateway): reject model selections without an activatable harness - #134837

Merged
steipete merged 2 commits into
mainfrom
codex/release-8.1-feedback-models-ui
Sep 1, 2026
Merged

steipete merged 2 commits into
mainfrom
codex/release-8.1-feedback-models-ui

Conversation

@steipete

@steipete steipete commented Sep 1, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #134305. Reported by @goslingmanagment. Related: #134468 adds execution-time recovery diagnostics for already-broken configurations.

What Problem This Solves

The Control UI could save a model whose required embedded harness had no installed, activatable plugin owner. sessions.patch committed the model and other patch fields, then sticky persistence could replace the configured default. sessions.create likewise accepted an unusable model. The next turn failed before inference.

This remains reproducible on main 61404b6c2a9. Merged #134463 (84e81339c2c3) pairs the full model catalog with native-auth evidence; it does not validate harness ownership before saving a session selection.

Why This Change Was Made

Validate harness ownership in the shared sessions.create / sessions.patch projection before committing any patch fields or publishing sticky defaults. Reuse the canonical runtime policy, manifest activation planner, and Gateway metadata snapshot. Installed lazy owners remain selectable without importing their runtime; missing, disabled, denied, or untrusted owners are rejected.

Explicit selections and null/default resets now share one application step. Installation and capability consent stay with setup. ACP and CLI backends retain their existing selection owners.

The maintainer decision requested by ClawSweeper is resolved: reject an unavailable harness before saving, preserve the previous selection, and explain recovery. Exact-head CI remains a landing requirement.

User Impact

An unavailable selection returns actionable guidance and preserves the previous model, other session fields, and configured default. The model-selection docs describe the check and recovery. This restores the intended Gateway picker behavior for the 2026.8.1 regression reported in #134305; it does not authenticate providers or certify later runtime initialization.

Production: +48/-24, net +24. Tests: +97/-47, net +50. Docs: +7. The production growth adds the missing admission boundary while removing duplicate model-application code. No configuration option, protocol version, dependency, public API, or SQLite schema was added.

Named follow-up — apply harness admission to /model directives: src/auto-reply/reply/model-runtime-normalization.ts:89-102 can accept a cataloged selection without checking its harness owner, and src/auto-reply/reply/directive-handling.impl.ts:489 persists it. This PR protects Gateway session selection; it does not claim every model-selection surface is covered.

Evidence

The original regression failed both real Gateway handlers before the fix: patch saved the unavailable model and another field, while create admitted an unusable row. The refreshed focused run passed 118 tests: 35 session-handler, 19 sticky-selection, 35 harness-owner, 23 registry, and 6 usage cases. Coverage includes missing owners, explicit Codex denial, enabled/disabled/denied generic harnesses, agent/global policy, aliases, and unchanged session/config after rejection. Cold fixture runtimes throw if imported, proving selection remains lazy.

The sticky-selection fixture now supplies the installed Codex owner required by its OpenAI route through the shared metadata fixture builder. This preserves real activation-policy checks and removes 29 test lines.

Actual Gateway RPC proof: both PRs were applied over main 61404b6c2a9 and exercised together using a built Gateway, authenticated WebSocket RPC, synthetic config marked lastTouchedVersion: "2026.7.1-2", a fresh OPENCLAW_STATE_DIR, and a random loopback port excluding 18789. The drivers stop their own Gateway afterward. No external provider inference or operator state was used.

node /tmp/harness-live-missing.mjs baseline-missing-stable
node /tmp/harness-live-missing.mjs candidate-missing
node /tmp/harness-live-proof.mjs candidate-disabled

Each driver first creates agent:main:harness-proof with synthetic/working and label Before selection, then sends:

{"method":"sessions.patch","params":{"key":"agent:main:harness-proof","model":"openai/gpt-5.6-sol","label":"Should not persist"}}
{"method":"sessions.create","params":{"key":"agent:main:unavailable-create","model":"openai/gpt-5.6-sol"}}
Observation Main baseline Candidate: missing owner Candidate: plugins disabled
Patch / create Both accepted Both INVALID_REQUEST Both INVALID_REQUEST
Existing session label Should not persist Before selection Before selection
Config unchanged after rejection false true true
Configured default afterward openai/gpt-5.6-sol synthetic/working synthetic/working

The missing-owner response was:

Model openai/gpt-5.6-sol requires agent harness "missing-harness", but no enabled plugin provides it. Install and enable its plugin, restart the Gateway, then select the model again.

The disabled-plugin case returned the same guidance naming codex. A separate configured agent already using the broken model received chat.send; the Gateway emitted visible chat error events containing reason=owner-plugin-not-activatable. The disabled case also named owner codex and the plugins disabled blocker. These paired runs verify selection rejection and the companion execution diagnostic. The first event exposed a truncation issue in the companion PR. The final rebuilt rerun now includes the complete Doctor command in the first implicit-Codex chat error. /health and /readyz remained HTTP 200 in these runs; this PR does not change their meaning.

Direct dependency inspection covered Codex's codex-rs/app-server/src/request_processors/catalog_processor.rs:242-295 and account_processor.rs:1034-1090: catalog listing and auth status are separate from OpenClaw plugin-host availability.

Final validation:

  • Full required validation is green in exact-head CI run 33479490035. Local focused commands were node scripts/run-vitest.mjs src/agents/harness/runtime-plugin.test.ts src/agents/runtime-plugins.test.ts src/plugins/provider-runtime.usage-harness.test.ts src/gateway/server.sessions.agent-model-catalog.test.ts src/gateway/server-methods/sessions-mutations.sticky-model.test.ts (118 passed), then the final harness-owner suite (35 passed). The combined pnpm build passed in 22m2s. Additional node scripts/check-changed.mjs --base 61404b6c2a91871b2a4f5819ca98b06a90077796 -- <the 11 changed files> is still running and is not claimed as completed proof.
  • Final rebuilt Gateway rerun passed: node /tmp/harness-live-missing.mjs final-missing (port 57540) and node /tmp/harness-live-implicit.mjs final-implicit (port 57551). Both rejected patch/create and preserved state. The implicit Codex fixture has no explicit runtime override; its first chat error includes the complete openclaw doctor --fix command and the disabled-plugin reason. The missing-harness first event contains complete enable/reinstall/restart guidance.
  • Required branch autoreview passed on b34390d4cf76fadb569d5673dcec9402aadd46f9: .agents/skills/autoreview/scripts/autoreview --mode branch --base aadafdc198c062d61c0c4dc182d311232df6df03 --max-priority P2; scoped-clean with no accepted/actionable P0–P2 findings.
  • Exact reviewed head: b34390d4cf76fadb569d5673dcec9402aadd46f9. node scripts/watch-pr-ci.mjs 134837 b34390d4cf76fadb569d5673dcec9402aadd46f9 returned GREEN. Latest ClawSweeper comment has no Rank-up moves: section; its before-merge requests are resolved by the explicitly authorized early-rejection decision, the shared projection boundary, and green exact-head CI. Native prepare/merge remains the required landing path.

The upgrade-shaped fixture also passed: node /tmp/harness-live-legacy-doctor.mjs final-legacy-doctor ran doctor --fix --non-interactive against actual v2026.7.1-2 agents.list and legacy openai-codex references before starting the Gateway. Doctor exited 0, migrated the route to openai, then both selections rejected with the harness reason, state stayed unchanged, and the first broken-turn error retained openclaw doctor --fix.

Before / After

These original screenshots show the real Control UI with mock-Gateway responses. They are rendering evidence, distinct from the actual Gateway RPC proof above.

Before: the unavailable model remains selected and sending fails.

Before: unavailable model persists

After: recovery guidance appears and the previous model remains selected.

After: recovery guidance and previous model retained

@clawsweeper

clawsweeper Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime agents Agent runtime and tooling size: S maintainer Maintainer-authored PR labels Sep 1, 2026
@clawsweeper clawsweeper Bot added merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 1, 2026
@clawsweeper

clawsweeper Bot commented Sep 1, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 1, 2026, 1:32 AM ET / 05:32 UTC.

ClawSweeper review

What this changes

This PR rejects session model selections whose required embedded harness has no enabled plugin owner, preserving the previous model selection and sticky default.

Merge readiness

⚠️ Ready for maintainer review - 4 items remain

The focused Gateway repair matches the linked model-picker defect and has no concrete patch defect in review. It remains open because it intentionally changes compatibility behavior and is a maintainer-authored, maintainer-labeled PR awaiting that decision and exact-head CI.

Priority: P1
Reviewed head: 7b26e653e2626c548df7e685315d3ed3ae2c3324
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The patch is focused, uses the owning session-projection boundary, and adds useful handler-level coverage; the remaining work is the intentional compatibility decision and exact-head CI.
Proof confidence 🌊 off-meta tidepool Not applicable: Repository State identifies a MEMBER-authored PR, so the external-contributor proof gate does not apply. The downloaded media available for inspection belonged to the adjacent recovery-diagnostics work and was not used as proof of this selection-time change.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: Repository State identifies a MEMBER-authored PR, so the external-contributor proof gate does not apply. The downloaded media available for inspection belonged to the adjacent recovery-diagnostics work and was not used as proof of this selection-time change.
Evidence reviewed 5 items Introduced admission boundary: The introduced hunk resolves the selected model, checks its required harness owner before applying model overrides, and returns an invalid request before the session write.
Existing execution invariant: The existing turn preparation rejects an unregistered required harness; the new check prevents persisting a selection that would reach that error on the next turn.
Metadata reuse: Activation planning reuses a compatible current plugin metadata snapshot when Gateway owns one, retaining the no-runtime-load behavior exercised by the cold-plugin tests.
Findings None None.
Security None None.

How this fits together

Gateway session creation and patch requests resolve a requested model before persisting it for later agent turns. The new admission check consults plugin activation metadata so an unusable model is rejected before it becomes session state.

flowchart LR
  A[Control UI or client] --> B[Gateway session request]
  B --> C[Resolve model selection]
  C --> D{Required harness available?}
  D -->|Yes| E[Persist session selection]
  D -->|No| F[Return recovery guidance]
  E --> G[Agent turn]
Loading

Decision needed

Question Recommendation
Should Gateway reject a model selection when its required harness plugin is absent or disabled, preserving the previous selection instead of allowing a later turn-time failure? Adopt early rejection: Reject unavailable harness selections before persistence and guide the operator to enable the plugin and restart.

Why: The patch deliberately changes the observable failure point for existing sessions and sticky defaults.

Before merge

  • Resolve merge risk (P1) - Existing users whose selected model requires an absent or disabled harness will now receive a save-time rejection rather than a later turn-time failure.
  • Resolve merge risk (P1) - Exact-head CI is still incomplete and remains required before merge.
  • Complete next step (P2) - A maintainer must decide whether the new save-time failure is the intended upgrade contract; the PR is also maintainer-authored and carries the protected maintainer label.
Agent review details

Security

None.

PR surface

Source +24, Tests +50, Docs +7. Total +81 across 5 files.

View PR surface stats
Area Files Added Removed Net
Source 2 48 24 +24
Tests 2 97 47 +50
Docs 1 7 0 +7
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 5 152 71 +81

Review metrics

Metric Value Why it matters
Production versus test delta production +48/-24 (net +24), tests +97/-47 (net +50), docs +7 Production growth is confined to the new admission boundary; the remaining changes are regression cases and fixture consolidation.

Merge-risk options

Maintainer options:

  1. Confirm early rejection (recommended)
    Accept the save-time compatibility contract after exact-head CI completes successfully.
  2. Pause for alternate UX
    Do not merge if product direction should retain unavailable selections or add setup behavior instead.

Technical review

Best possible solution:

Adopt the documented save-time rejection contract while retaining the existing prepared-run guard as defense in depth.

Do we have a high-confidence way to reproduce the issue?

Yes. The pre-change session projection persisted an allowed model without checking its harness owner, while the existing turn path rejects a missing prepared harness; the PR adds direct handler coverage for both creation and patching.

Is this the best way to solve the issue?

Yes, subject to the compatibility decision. The shared session projection is the producer that persists the unusable selection, and the repair reuses the existing activation planner without loading plugin runtime code.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 6bfac98ca38e.

Labels

Label justifications:

  • P1: The existing model picker can otherwise store an unusable route and make the next agent turn fail.
  • merge-risk: 🚨 compatibility: Previously stored or selectable routes with no enabled harness now fail at selection time.
  • merge-risk: 🚨 auth-provider: The changed model-selection path governs provider-backed OpenAI/Codex routes and their operator recovery path.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: Repository State identifies a MEMBER-authored PR, so the external-contributor proof gate does not apply. The downloaded media available for inspection belonged to the adjacent recovery-diagnostics work and was not used as proof of this selection-time change.

Evidence

What I checked:

  • Introduced admission boundary: The introduced hunk resolves the selected model, checks its required harness owner before applying model overrides, and returns an invalid request before the session write. (src/gateway/sessions-patch.ts:513, 25a103739f55)
  • Existing execution invariant: The existing turn preparation rejects an unregistered required harness; the new check prevents persisting a selection that would reach that error on the next turn. (src/agents/harness/runtime-plugin.ts:130, 7b26e653e262)
  • Metadata reuse: Activation planning reuses a compatible current plugin metadata snapshot when Gateway owns one, retaining the no-runtime-load behavior exercised by the cold-plugin tests. (src/plugins/plugin-registry-snapshot.ts:400, 7b26e653e262)
  • Regression coverage: The new table-driven Gateway-handler cases cover sessions.create and sessions.patch, absent, disabled, and denied harness owners, state preservation, and non-eager plugin loading. (src/gateway/server.sessions.agent-model-catalog.test.ts:86, 25a103739f55)
  • Codex protocol boundary: Direct sibling Codex inspection shows model listing and account status are independent request handlers; this PR itself uses OpenClaw’s manifest activation planner rather than a Codex runtime contract. (78c290807ce7)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Confirm the save-time rejection contract, then require green exact-head CI before merge.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (1 earlier review cycle)
  • reviewed 2026-09-01T05:02:00.667Z sha 25a1037 :: needs maintainer review before merge. :: none

@steipete
steipete force-pushed the codex/release-8.1-feedback-models-ui branch from 7b26e65 to b34390d Compare September 1, 2026 06:52
@steipete
steipete merged commit 2e3cae2 into main Sep 1, 2026
277 checks passed
@steipete
steipete deleted the codex/release-8.1-feedback-models-ui branch September 1, 2026 07:15
@steipete

steipete commented Sep 1, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

steipete added a commit that referenced this pull request Sep 1, 2026
Preserve the interrupted worker's seven pending files alongside 81fd1a7.
This is an incomplete recovery checkpoint, not a land-ready change.

Related: #134468 and #134304. Reported by @goslingmanagment.
The session selection work is already merged separately in #134837.

The recovery-only production delta remains +107, exceeding this sweep's
net-zero constraint. Pending owner tests expose contextless disabled-policy
and mixed-owner diagnostic gaps. Gateway selection coverage also exposed
an enabled-to-disabled fixture race with background sticky config writes.
Build, changed checks, and final branch review are not complete.

Co-authored-by: Jason (Json) <[email protected]>
steipete added a commit that referenced this pull request Sep 1, 2026
* fix(agents): show recovery when a model harness is unavailable

Carry the prepared plugin generation's activation and owner facts to the
final harness guard. Reuse the scoped registry owner for direct agents and
provider usage, preserving loaded request plugins when adding a selection.
Put recovery commands before longer details so the first bounded chat error
retains the operator's next action.

Fixes #134304. Reported by @goslingmanagment.
Release-note context: unavailable model harnesses explain plugin recovery
while model status continues to report route availability independently of
Gateway liveness.

Co-authored-by: Jason (Json) <[email protected]>

* chore: preserve blocked harness recovery checkpoint

Preserve the interrupted worker's seven pending files alongside 81fd1a7.
This is an incomplete recovery checkpoint, not a land-ready change.

Related: #134468 and #134304. Reported by @goslingmanagment.
The session selection work is already merged separately in #134837.

The recovery-only production delta remains +107, exceeding this sweep's
net-zero constraint. Pending owner tests expose contextless disabled-policy
and mixed-owner diagnostic gaps. Gateway selection coverage also exposed
an enabled-to-disabled fixture race with background sticky config writes.
Build, changed checks, and final branch review are not complete.

Co-authored-by: Jason (Json) <[email protected]>

* fix(agents): preserve exact harness recovery policy

Diagnose unavailable harness owners from the prepared registry, preserve explicit policy for direct hosts, and classify mixed/default-enabled owners correctly. Reuse activation context and shared registry load options; keep borrowed Gateway registry dependencies lazy. Join sticky config mutations before Gateway fixture teardown.

Co-authored-by: Json <[email protected]>

* test(gateway): join sticky mutations with explicit cleanup

Keep the original ordered activation assertions while awaiting every captured config mutation in a lint-safe try/finally.

Co-authored-by: Json <[email protected]>

* test: isolate provider hook proofs by execution mode

The previous case bundled compilation and four fresh subprocesses under one deadline. Give source and compiled execution their own cases, compile only the compiled case, and retain both provider scopes, lifecycle assertions, and the existing timeout.

Co-authored-by: Json <[email protected]>

---------

Co-authored-by: Jason (Json) <[email protected]>
Co-authored-by: Json <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 2, 2026
…penclaw#134837)

* fix(gateway): reject model selections without an activatable harness

* test(gateway): provide harness owner in sticky model fixture
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 2, 2026
…5118)

* fix(agents): show recovery when a model harness is unavailable

Carry the prepared plugin generation's activation and owner facts to the
final harness guard. Reuse the scoped registry owner for direct agents and
provider usage, preserving loaded request plugins when adding a selection.
Put recovery commands before longer details so the first bounded chat error
retains the operator's next action.

Fixes openclaw#134304. Reported by @goslingmanagment.
Release-note context: unavailable model harnesses explain plugin recovery
while model status continues to report route availability independently of
Gateway liveness.

Co-authored-by: Jason (Json) <[email protected]>

* chore: preserve blocked harness recovery checkpoint

Preserve the interrupted worker's seven pending files alongside 81fd1a7.
This is an incomplete recovery checkpoint, not a land-ready change.

Related: openclaw#134468 and openclaw#134304. Reported by @goslingmanagment.
The session selection work is already merged separately in openclaw#134837.

The recovery-only production delta remains +107, exceeding this sweep's
net-zero constraint. Pending owner tests expose contextless disabled-policy
and mixed-owner diagnostic gaps. Gateway selection coverage also exposed
an enabled-to-disabled fixture race with background sticky config writes.
Build, changed checks, and final branch review are not complete.

Co-authored-by: Jason (Json) <[email protected]>

* fix(agents): preserve exact harness recovery policy

Diagnose unavailable harness owners from the prepared registry, preserve explicit policy for direct hosts, and classify mixed/default-enabled owners correctly. Reuse activation context and shared registry load options; keep borrowed Gateway registry dependencies lazy. Join sticky config mutations before Gateway fixture teardown.

Co-authored-by: Json <[email protected]>

* test(gateway): join sticky mutations with explicit cleanup

Keep the original ordered activation assertions while awaiting every captured config mutation in a lint-safe try/finally.

Co-authored-by: Json <[email protected]>

* test: isolate provider hook proofs by execution mode

The previous case bundled compilation and four fresh subprocesses under one deadline. Give source and compiled execution their own cases, compile only the compiled case, and retain both provider scopes, lifecycle assertions, and the existing timeout.

Co-authored-by: Json <[email protected]>

---------

Co-authored-by: Jason (Json) <[email protected]>
Co-authored-by: Json <[email protected]>
obviyus added 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]>
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 docs Improvements or additions to documentation gateway Gateway runtime maintainer Maintainer-authored PR merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M 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.

[Bug]: Model picker persists an OpenAI model without ensuring its required Codex harness can run

1 participant