Repository navigation
feat(agents): default code mode to per-model auto activation - #114906
Conversation
a710e65 to
1af3683
Compare
|
Codex review: needs maintainer review before merge. Reviewed July 28, 2026, 12:56 AM ET / 04:56 UTC. ClawSweeper reviewWhat this changesThe branch changes omitted Merge readinessKeep this PR open for normal maintainer landing review. It is a focused, owner-confirmed default-policy follow-up to the merged per-model Auto tier, and the updated body now supplies relevant after-fix runtime evidence for both preferred and unflagged catalog models; the remaining concern is the intentional upgrade behavior, not a demonstrated patch defect. Priority: P2 Review scores
Verification
How this fits togetherCode Mode determines whether an agent run exposes a compact flowchart LR
A[OpenClaw configuration] --> C[Code Mode resolver]
B[Provider model catalog] --> D[Model eligibility]
C --> E[Activation decision]
D --> E
E --> F[Agent or harness tool surface]
G[Labs Auto Off toggle] --> A
Before merge
Agent review detailsSecurityNone. PR surfaceSource +14, Tests +43, Docs +1. Total +58 across 11 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Land the explicit Auto/Off default only with the documented opt-out preserved and exact-head checks completed, keeping the existing catalog-preferred gate as the single source of activation policy. Do we have a high-confidence way to reproduce the issue? Not applicable: this is an intentional default-policy change, not a report of broken established behavior. The PR provides a high-confidence after-fix runtime comparison for omitted configuration across preferred and unflagged models. Is this the best way to solve the issue? Yes. Reusing the already-merged AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 42fdb81d97b6. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
Addressing the ClawSweeper before-merge items: Real behavior proof (added to the PR body Evidence section): ran the actual runtime decision surface from this head ( The preferred model ( Upgrade-risk framing: the newly engaged path is not new code — it is the same code-mode surface already shipped behind Owner confirmation: this default flip is the explicit owner product decision that PR #114695 deferred; this PR was created under that direct owner instruction, and the intentional upgrade-behavior change is stated plainly in the PR body's User Impact section. |
1af3683 to
b3ae33f
Compare
|
Merged via squash.
|
What Problem This Solves
PR #114695 added the
"auto"tier fortools.codeMode.enabled(per-model activation gated on catalogcompat.codeMode: "preferred"flags) but left the shipped default atfalse, so nobody gets code mode without hand-editing config. The Labs switch also wroteenabled: true, which force-engages code mode for every tool-capable run — including models never evaluated for it.Why This Change Was Made
Owner product decision:
"auto"is safe by construction — it engages code mode only for models the catalog explicitly flags as evaluated strong code-mode performers, while every unevaluated model keeps normal tool exposure. That makes it the right shipped default, and it makestrue(global force-on) the wrong thing for a one-click Labs switch to write.Two coupled changes:
falseto"auto"(src/agents/code-mode-runtime.tsreadEnabled). Omitted config andtools.codeModeobjects withoutenablednow resolve to"auto". Explicitfalse/truebehave exactly as before. Schema help, exported type docs, and both docs pages updated to match; the zod schema is untouched (additive only —truestays valid everywhere).ui/src/pages/labs/labs-registry.ts). The on position writesenabled: "auto", nevertrue; off writesenabled: false. A registryreadEnabledmirrors the runtime resolver so the unset shipped default reads as on, and an existingenabled: true(config-only power-user state) still displays as on. The row description now states what Auto means in one line.User Impact
This intentionally changes default behavior: code mode now engages by default for catalog-preferred models (the shipped list in docs/tools/code-mode.md). Set
tools.codeMode.enabled: false(or flip the Labs switch off) to opt out. Models without the"preferred"catalog flag — including all local/Ollama models — are unaffected and keep normal tool exposure. No config migration needed; every previously valid value keeps its meaning, so there is no doctor migration and no compat shim.Evidence
Real omitted-config behavior proof (actual
resolveCodeModeConfig+createAgentHarnessToolSurfaceRuntimefrom this head, fed real bundled catalog entries —extensions/anthropic/openclaw.plugin.jsonclaude-sonnet-5(compat.codeMode: "preferred") andextensions/ollama/openclaw.plugin.jsonkimi-k2.5(no flag) — withtools.codeModeentirely omitted from config):The preferred model's model-visible surface collapses to
exec/wait; the unflagged model's tool list is byte-identical to before this change.node scripts/run-vitest.mjs src/agents/code-mode-runtime.test.ts src/agents/code-mode.test.ts ui/src/pages/labs/labs-page.test.ts— green (resolver default now"auto"for omitted/object-without-enabled; labs switch writes"auto"/false, nevertrue;true,"auto", and unset all read as on; explicitfalsereads off).node scripts/run-vitest.mjs src/agents/harness/tool-surface-bridge.test.ts src/config/schema.test.ts src/gateway/session-companion.test.ts src/agents/code-mode-swarm.test.ts src/agents/code-mode-headless.test.ts src/config/doc-baseline.test.ts src/config/zod-schema.agent-defaults.test.ts— green (auto/preferred engagement matrix, companion sessions still force code mode off, schema/doc baselines aligned).pnpm ui:i18n:baselinerun; no baseline drift beyond the English source change.