Repository navigation
Conversation
…s list The fallbacks and image-fallbacks list leaves accepted the inherited models --agent option and silently printed the global agents.defaults fallbacks instead of the named agent's chain. Their add, remove and clear siblings already reject --agent through the global-only guard; the list leaves now route through the same guard.
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. What this changesRejects inherited --agent on both fallback-list commands instead of silently displaying global defaults. Example: Run openclaw models --agent ops fallbacks list when global fallbacks contain openai/gpt-5.4 and ops has a different chain.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this PR fixes a current CLI scope bug with the existing guard, respects the recorded global-only design, and has sufficient behavior proof with green exact-head CI. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherCommander registers model-management commands, the shared runtime validates scope, and the fallback reader returns global configuration as text or JSON. flowchart TD
A[CLI arguments] --> B[Models command registration]
B --> C[Shared global scope guard]
C -->|Agent supplied| D[Error and exit 1]
C -->|No agent supplied| E[Global fallback reader]
E --> F[Text or JSON output]
Technical reviewBest possible solution: Use the existing global-command guard for both list leaves while retaining unscoped output and agent-specific inspection through models status. Do we have a high-confidence way to reproduce the issue? Current-main registration discards the inherited agent option and the reader returns global defaults; the contributor's before/after CLI transcript independently demonstrates that path, without reviewer execution. Is this the best way to solve the issue? This is the smallest complete fix: it reuses the established scope owner, covers both fallback groups, and preserves configuration, model routing, and unscoped output. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 33c6ccee1405. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource 0, Tests +15, Docs 0. Total +15 across 4 files. Added test files: 0. View PR surface stats
LabelsLabel changes: No label changes. Label justifications:
Rating scale6/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. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed November 1, 2026, 11:07 AM ET / 16:07 UTC. |
Summary
openclaw models --agent ops fallbacks listexits 0 and prints the globalagents.defaults.model.fallbacks, not theopsagent's own fallback chain, with no hint that--agentwas dropped.models --agent ops image-fallbacks listdoes the same for image fallbacks. A user checking which fallbacks an agent will use gets a confident, wrong answer whenever that agent has its ownmodel.fallbacks.The
add,removeandclearsiblings already reject--agentsince #163077, and #106346 was closed with fallback management staying global by design. The twolistleaves are the remaining fallback commands that still accept the inherited parent--agentand ignore it.Root cause
src/cli/models-cli.tsregisters the fallbacklistleaf with the plain runtime wrapper, so the inheritedmodels --agentoption is never checked, while the mutation leaves go through the global-only guard:listFallbacksCommandonly readscfg.agents?.defaults?.[key], so whatever--agentnames, the output is the global list.Fix
The
listleaf now runs through the samewithGlobalModelsRuntimeguard asadd/remove/clear, andGlobalOnlyModelCommandNamegainslistfor both fallback groups:docs/cli/models.mdlistslistalongsideadd,removeandclearin the global-only sentence.Why this is the right boundary
rejectAgentScopedModelCommandis the single owner of "thismodelsleaf is global and must not accept--agent";set,set-image,scan,refresh, allaliasesleaves, and the fallback mutations already route through it. Both fallback groups are registered by one loop, so the change coversfallbacks listandimage-fallbacks listtogether.listFallbacksCommandand its output are unchanged; without--agentthe command prints exactly what it did before. Per-agent effective fallbacks remain visible throughmodels status --agent <id>, which already resolves them. This does not add per-agent fallback editing or listing.Verification
src/cli/models-cli.test.ts: the existing "rejects unsupported agent scope" table gainsmodels --agent ops fallbacks listandmodels --agent ops image-fallbacks list --json, asserting exit 1 withmodels fallbacks list does not support --agent/models image-fallbacks list does not support --agentand thatlistFallbacksCommandis never called. Run withnode scripts/run-vitest.mjs src/cli/models-cli.test.ts: both new cases fail on pristine main (the command resolves instead of rejecting) and the file passes 24/24 with the patch.oxfmt --checkclean on the changed files.Real behavior proof
Behavior addressed:
openclaw models --agent <id> fallbacks listandimage-fallbacks listsilently ignored--agentand printed the global defaults as if they were that agent's fallbacks.Real environment tested: The real
openclawCLI from source (node --import tsx/esm src/entry.ts) with an isolatedOPENCLAW_STATE_DIRandOPENCLAW_CONFIG_PATHholdingagents.ownership: "explicit",agents.defaults.model={ primary: "anthropic/claude-sonnet-4-6", fallbacks: ["openai/gpt-5.4"] }, andagents.entries.ops.model={ primary: "anthropic/claude-opus-4-6", fallbacks: ["google/gemini-3-pro-preview", "openrouter/qwen/qwen3-coder"] }. Pristine main e97c9d3 first, then this patch with the same config and commands. Nothing was stubbed and no network was involved.Exact steps or command run after this patch:
node --import tsx/esm src/entry.ts models --agent ops fallbacks list,... models --agent ops image-fallbacks list --json,... models --agent ops fallbacks clear(existing sibling, for comparison), and... models fallbacks list(no--agent, unchanged path).Evidence after fix:
Observed result after fix: On main,
--agent opsprinted the globalopenai/gpt-5.4chain with exit 0 even thoughopsis configured withgoogle/gemini-3-pro-previewandopenrouter/qwen/qwen3-coder; with the patch both list leaves reject--agentwith the same message and exit code as theirclearsibling, and the unscopedfallbacks listoutput is unchanged.What was not tested: Per-agent fallback listing was not added (fallback management stays global per the closure of #106346); a packaged build of the CLI was not run, only the source entry point.