Skip to content

fix(models): fallbacks add, remove and clear accept --agent but edit global defaults - #163077

Merged
vincentkoc merged 1 commit into
openclaw:mainfrom
ericcurtin:fix/models-fallbacks-reject-agent
Oct 2, 2026
Merged

vincentkoc merged 1 commit into
openclaw:mainfrom
ericcurtin:fix/models-fallbacks-reject-agent

Conversation

@ericcurtin

Copy link
Copy Markdown
Contributor

Closes #127617

What Problem This Solves

Fixes: openclaw models --agent worker fallbacks clear exits 0 and edits the global defaults, not the worker.

User Impact

User impact: --agent on fallback add, remove and clear now fails with the same error as set and aliases. Config is left unchanged.

Why This Change Was Made

The six fallback leaves skipped the existing --agent guard. They now use it. All global-only commands share one small helper, so the guard is no longer repeated per command.

Evidence

  • Real CLI before: models --agent worker fallbacks clear printed "Fallback list cleared." and emptied agents.defaults.model.fallbacks.
  • Real CLI after: exit 1, "does not support --agent", config unchanged.
  • pnpm test src/cli/models-cli.test.ts src/cli/models-cli.lazy.test.ts: 86 passed. The 6 new cases fail without the fix. About 4s wall at --maxWorkers=1.
  • pnpm tsgo:core, core test typecheck for src/cli, oxlint and oxfmt are clean.

@clawsweeper

clawsweeper Bot commented Oct 1, 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 docs Improvements or additions to documentation cli CLI command changes size: S labels Oct 1, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. 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 Oct 1, 2026
@clawsweeper

clawsweeper Bot commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed October 1, 2026, 7:08 PM ET / 23:08 UTC.

ClawSweeper review

What this changes

The PR rejects --agent on text and image fallback mutations, consolidates global-command guards, and updates CLI documentation and regression coverage.

Merge readiness

✅ Ready for maintainer review

This PR remains necessary: current main still permits agent-qualified fallback mutations to change global defaults. No actionable introduced defect was found.

Likely related people: Peter Steinberger and Teddy Tennant (low-confidence routing candidates).

Priority: P2
Reviewed head: 40b03c9662c04fadba68acef4cc3bd716c8554c8

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, maintainable repair with relevant reported CLI proof and boundary regression coverage; no blocking defect was found.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): The captured body reports a real models --agent worker fallbacks clear run: the changed CLI admission now exits 1 with scope guidance and preserves config, replacing the observed global write. Registered-command tests supplement that result across both fallback groups; no stored-data format or migration changes.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The captured body reports a real models --agent worker fallbacks clear run: the changed CLI admission now exits 1 with scope guidance and preserves config, replacing the observed global write. Registered-command tests supplement that result across both fallback groups; no stored-data format or migration changes.
Evidence reviewed 8 items Verified introduced change: The pinned merge-base-to-head diff adds admission to all six fallback mutation leaves and preserves existing guards through a shared helper; unrelated endpoint drift is excluded.
Current-main necessity: Fetched main still routes fallback add/remove/clear directly through the unguarded runtime wrapper. The CLI and runtime files have no changes between the pinned merge base and fetched main.
Released behavior: The latest supplied release also contains unguarded fallback mutation callbacks, so the proposed repair is not already shipped there.
Findings None None.
Security None None.

How this fits together

The models CLI receives model-management commands and routes them to configuration owners. Fallback mutations change defaults inherited by agents, so misleading agent-qualified writes must stop before configuration access.

flowchart TD
  A[Models CLI input] --> B[Fallback mutation]
  B --> C{Agent option supplied}
  C -->|Yes| D[Error with scope guidance]
  C -->|No| E[Global fallback owner]
  E --> F[Updated agent defaults]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +2, Tests +19, Docs 0. Total +21 across 4 files.

View PR surface stats
Area Files Added Removed Net
Source 2 37 35 +2
Tests 1 22 3 +19
Docs 1 1 1 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 60 39 +21

Review metrics

None.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #127617
Summary: This PR supplies the remaining fallback admission repair requested by the canonical issue.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Technical review

Best possible solution:

Use the existing global-command admission consistently while preserving ordinary fallback writes and agent-specific configuration.

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

Yes: current main sends models --agent worker fallbacks clear to a global-only writer without admission. The contributor reports a real before/after CLI run; this review established the path from source without executing it.

Is this the best way to solve the issue?

Yes: applying the existing rejection contract to the remaining mutation leaves is the narrow repair requested by the linked issue, and the consolidation preserves existing command behavior.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against dc794c04818e.

Labels

Label changes:

  • add P2: This repairs a bounded CLI scope mismatch that silently changes global fallback settings.
  • add proof: sufficient: Contributor real behavior proof is sufficient. The captured body reports a real models --agent worker fallbacks clear run: the changed CLI admission now exits 1 with scope guidance and preserves config, replacing the observed global write. Registered-command tests supplement that result across both fallback groups; no stored-data format or migration changes.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The captured body reports a real models --agent worker fallbacks clear run: the changed CLI admission now exits 1 with scope guidance and preserves config, replacing the observed global write. Registered-command tests supplement that result across both fallback groups; no stored-data format or migration changes.

Label justifications:

  • P2: This repairs a bounded CLI scope mismatch that silently changes global fallback settings.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The captured body reports a real models --agent worker fallbacks clear run: the changed CLI admission now exits 1 with scope guidance and preserves config, replacing the observed global write. Registered-command tests supplement that result across both fallback groups; no stored-data format or migration changes.
  • proof: sufficient: Contributor real behavior proof is sufficient. The captured body reports a real models --agent worker fallbacks clear run: the changed CLI admission now exits 1 with scope guidance and preserves config, replacing the observed global write. Registered-command tests supplement that result across both fallback groups; no stored-data format or migration changes.

Evidence

What I checked:

  • Verified introduced change: The pinned merge-base-to-head diff adds admission to all six fallback mutation leaves and preserves existing guards through a shared helper; unrelated endpoint drift is excluded. (src/cli/models-cli.ts:260, 40b03c9662c0)
  • Current-main necessity: Fetched main still routes fallback add/remove/clear directly through the unguarded runtime wrapper. The CLI and runtime files have no changes between the pinned merge base and fetched main. (src/cli/models-cli.ts:261, dc794c04818e)
  • Released behavior: The latest supplied release also contains unguarded fallback mutation callbacks, so the proposed repair is not already shipped there. (src/cli/models-cli.ts:261, c074824a27c9)
  • Configuration owner boundary: The fallback owner writes agents.defaults.model or agents.defaults.imageModel. The new guard executes before importing that owner; ordinary commands retain the existing write path and stored format. (src/commands/models/fallbacks-shared.ts:32, 40b03c9662c0)
  • Regression coverage: Six fallback leaves extend the existing registered-Commander table, covering rejection with zero mutation-owner calls and continued dispatch without --agent. The body reports pre-fix failure of the new rejection cases, 86 passing focused tests, and approximately four seconds wall time. (src/cli/models-cli.test.ts:508, 40b03c9662c0)
  • Contributor real CLI evidence: The complete supplied body, captured under sourceRevision bb587ee57043eee570957fc5431094f96d57b38bb6d4bd90144c7d03e0e2dbb4, reports that models --agent worker fallbacks clear previously printed success and emptied global fallbacks; after the fix it exits 1 with 'does not support --agent' and leaves config unchanged. This directly exercises the changed admission boundary; the reviewer did not execute contributor code.

Likely related people:

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

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.

@vincentkoc vincentkoc self-assigned this Oct 1, 2026
@vincentkoc
vincentkoc merged commit 5aa4230 into openclaw:main Oct 2, 2026
117 of 118 checks passed
@vincentkoc

Copy link
Copy Markdown
Member

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI command changes docs Improvements or additions to documentation P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. 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.

Eight models --agent alias/fallback mutations silently write global defaults

2 participants