Repository navigation
feat: configure Code Mode per model with inherited defaults - #132332
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs changes before merge. Reviewed August 29, 2026, 12:04 AM ET / 04:04 UTC. ClawSweeper reviewWhat this changesAdds per-model OpenClaw Code Mode on/off overrides, inherited activation precedence, CLI invocation overrides, Control UI tri-state selection, and documentation. Merge readinessKeep open: the prior P2 blocker remains. A valid provider-wildcard model entry can persist Priority: P2 Review scores
Verification
How this fits togetherAgent configuration supplies a selected provider/model to the tool-surface planner, which chooses either direct tools or the compact OpenClaw Code Mode controls. The resulting surface is used by embedded runs and the Copilot bridge. flowchart LR
A[Operator configuration] --> B[Selected provider and model]
B --> C[Activation resolver]
C --> D[Tool-surface planner]
D --> E[Code Mode controls]
D --> F[Direct tool surface]
E --> G[Embedded agent run]
F --> G
Before merge
Findings
Agent review detailsSecurityNone. PR surfaceSource +43, Tests +483, Docs +58, Generated 0. Total +584 across 44 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Make the documented exact-model contract enforceable by rejecting Do we have a high-confidence way to reproduce the issue? Yes, in source: set global Code Mode off and Is this the best way to solve the issue? No. The intended exact-only behavior is documented, but it is not enforced at the config boundary; reject wildcard Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 20997195bc47. LabelsLabel justifications:
EvidenceAcceptance criteria:
What I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
Maintainer confirmation: the optional per-model Accepted the wildcard finding. Both model maps now share one validation owner that rejects an authored Code Mode value on wildcard or bare model keys, with an error at the offending The rejection regressions failed before the repair and now pass for both agent/default scopes and both boolean values. The real CLI reproduced the earlier acceptance; I am rebuilding the dev Gateway to verify the corrected CLI and settings error path before landing. The two earlier CI fixture type errors are also corrected, with all core-test type jobs green on the current pushed head. |
|
Merged via squash.
|
…#132332) * feat: configure Code Mode per model with inherited defaults * test: type Code Mode invocation fixtures precisely * fix: reject ineffective model Code Mode overrides
What Problem This Solves
Operators could enable OpenClaw Code Mode globally or for an agent, but could not explicitly opt one model in or out independently of the provider catalog. The settings form also could not distinguish an inherited boolean from an explicit Off.
Why This Change Was Made
Adds the approved optional
codeMode: booleanto shared and agent-specific model entries. Activation follows agent model → explicit agent setting → shared model → global default. Omission inherits, including a parent's Auto policy. Wildcard and bare-key Code Mode overrides are rejected at config validation; existing wildcard runtime policy remains valid. Model selection uses the logical provider/model for each attempt, including fallbacks; runtime selection and native Codex Code Mode are unchanged.Production LOC: +124/-63 (net +61); tests: +557/-60. Growth implements the approved model override and tri-state UI while removing duplicate activation checks.
The shared tool-surface planner now owns activation. Catalog construction, client-tool additions, and execution no longer re-read the global switch and contradict an admitted model override or restart recovery. CLI mode flags and companion restrictions use an invocation override that wins over saved preferences while retaining limits and ordinary tool restrictions. Copilot uses the same owner.
User Impact
In Agent Defaults → Advanced → Models, each model now has Default / On / Off. Default removes the key; On/Off persist true/false. The Labs switch remains the global Auto/off default. Limits, aliases, parameters, streaming, and runtime settings are preserved.
Agent-specific model entries support the same config contract via Raw config or CLI. The existing Agent List generic form rejects its constrained map schema; repairing that editor is a separate follow-up, not claimed as fixed here. No new dependencies, persistence schema, or protocol version.
Evidence
--code-mode directretained direct read despite saved model On;--code-mode codeused exec despite all saved settings Off. Both completed with the exact marker.Before:

After:

Final schema validation proof: real CLI rejects wildcard overrides in both model scopes; the actual Gateway settings UI shows the exact validation error and preserves the saved config. A fresh Sol request completed through
execon the final build. The complete remote changed-file gate passed; the final validation delta is checked separately.