Skip to content

fix(models): respect models.mode=replace in 'openclaw models list' output#94735

Closed
Monkey-wusky wants to merge 0 commit into
openclaw:mainfrom
Monkey-wusky:fix/issue-94705-models-mode---replace--does-no
Closed

fix(models): respect models.mode=replace in 'openclaw models list' output#94735
Monkey-wusky wants to merge 0 commit into
openclaw:mainfrom
Monkey-wusky:fix/issue-94705-models-mode---replace--does-no

Conversation

@Monkey-wusky

@Monkey-wusky Monkey-wusky commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

When models.mode: "replace" is set with a restricted models.providers list, openclaw models list still shows models from built-in provider catalogs and authenticated-but-unconfigured providers. The replace-mode restriction incorrectly blocked --all and --provider browsing in enableSourcePlanCascade, making it impossible to discover models outside the configured provider list.

Fixes #94705.

Changes

  • src/commands/models/list.list-command.ts: Added modelsModeReplace flag; fixed enableSourcePlanCascade to not be blocked by replace mode, so --all and --provider browse work regardless of models.mode
  • src/commands/models/list.rows.ts: appendAuthenticatedCatalogRows skips processing when in replace mode

Evidence

Before (broken)

  • models list in replace mode shows models from built-in catalogs and unconfigured providers — incorrect
  • models list --all in replace mode is blocked — catalog browsing impossible
  • models list --provider <name> in replace mode is blocked

After (fixed)

  • models list shows only configured provider models (3 models) ✅
  • models list --all shows full catalog (40+ models) ✅
  • models list --provider xiaomi shows provider-filtered catalog (3 models) ✅

The replace-mode restriction is now scoped to appendAuthenticatedCatalogRows only — filtering at display time rather than blocking catalog loading.

Real Behavior Proof

Tested against a live OpenClaw gateway with models.mode: "replace" and a configured zte provider.

Test 1: Default models list (replace mode)

Only configured provider models appear (3 models):

Model                                      Input      Ctx         Local Auth  Tags
zte/Qwen3-235B-A22B                        text       125k        no    yes   default
openai/Qwen3-235B-A22B                     text       195k        no    no    configured
anthropic/claude-sonnet-4-6                text+image 1024k       no    yes   configured,alias:sonnet

Test 2: models list --all (replace mode)

All catalog models appear (40+ models), proving --all is NOT blocked by replace mode:

Model                                      Input      Ctx         Local Auth  Tags
zte/Qwen3-235B-A22B                        text       125k        no    yes   default
anthropic/claude-fable-5                   text+image 977k        no    yes   
anthropic/claude-haiku-4-5                 text+image 195k        no    yes   
anthropic/claude-haiku-4-5-20251001        text+image 195k        no    yes   
anthropic/claude-opus-4-6                  text+image 195k        no    yes   
anthropic/claude-opus-4-7                  text+image 195k        no    yes   
anthropic/claude-opus-4-8                  text+image 1024k       no    yes   
anthropic/claude-sonnet-4-6                text+image 195k        no    yes   configured,alias:sonnet
... (40+ models total)

Test 3: models list --provider xiaomi (replace mode)

Provider-filtered browsing works, showing Xiaomi catalog models:

Model                                      Input      Ctx         Local Auth  Tags
xiaomi/mimo-v2-flash                       text       256k        no    no    
xiaomi/mimo-v2-omni                        text+image 256k        no    no    
xiaomi/mimo-v2-pro                         text       1024k       no    no    

Summary

Scenario Models shown Expected?
Default models list (replace mode) 3 (configured only) ✅ Correct
models list --all (replace mode) 40+ (full catalog) Fixed
models list --provider xiaomi (replace mode) 3 (provider-filtered) Fixed

@openclaw-barnacle openclaw-barnacle Bot added commands Command implementations size: XS triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. labels Jun 19, 2026
@clawsweeper

clawsweeper Bot commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Thanks for the context here. I swept through the related work, and this is now duplicate or superseded.

Close as superseded: #103103 is the open, proof-positive, maintainer-labeled landing path for the same bug, uses the cleaner ownership boundary, includes regression coverage, and preserves the original contributor credit.

Root-cause cluster
Relationship: superseded
Canonical: #103103
Summary: The current PR and the canonical replacement address the same model-list replace-mode leak; the replacement is the safer landing path and preserves contributor credit.

Members:

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

Canonical path: Land the canonical replacement with its direct config check, focused merge/replace tests, explicit browsing regressions, and contributor credit, then close the linked bug issue after merge.

So I’m closing this here because the remaining work is already tracked in the canonical issue.

Review details

Best possible solution:

Land the canonical replacement with its direct config check, focused merge/replace tests, explicit browsing regressions, and contributor credit, then close the linked bug issue after merge.

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

Yes at source level: the authenticated-catalog append path explains the leaked rows, and both PRs provide live or focused evidence for the affected default and explicit browsing paths.

Is this the best way to solve the issue?

No. The behavior is correct, but the canonical replacement is the better fix because it keeps policy at the row source, reads canonical config directly, and includes focused upgrade-sensitive regressions.

Security review:

Security review cleared: The two TypeScript changes do not alter secrets, permissions, dependencies, downloads, workflows, or other security-sensitive execution paths.

AGENTS.md: found and applied where relevant.

What I checked:

  • Current patch behavior: The current head derives modelsModeReplace in the list command, threads it through RowBuilderContext, and makes appendAuthenticatedCatalogRows return early for replace mode. (src/commands/models/list.rows.ts:549, a537beed138b)
  • Canonical replacement: The open replacement PR implements the same user-visible behavior but reads canonical config at the row source instead of adding a parallel derived context flag, and explicitly preserves Monkey-wusky's contributor credit. (src/commands/models/list.rows.ts:548, e735d949fbd1)
  • Replacement proof: The canonical PR reports focused merge/replace regressions, model-list E2E coverage, exact-tree checks, autoreview, and isolated live CLI proof that default replace-mode output is restricted while --all and provider browsing remain available. (src/commands/models.list.e2e.test.ts:1, c45ceb843c0c)
  • Current PR real behavior proof: The contributor supplied live gateway output for all three affected CLI paths: restricted default output, full --all browsing, and provider-filtered browsing. (a537beed138b)
  • Maintainer direction: The replacement PR explicitly names this PR as superseded after the model-list refactor and carries a dedicated commit series referenced from this PR's timeline. (f7bb38f2a090)

Likely related people:

  • steipete: Authored the open replacement implementation, its model-list refactor and regression proof, and explicitly preserved the original contributor's credit. (role: canonical replacement author and recent area contributor; confidence: high; commits: c45ceb843c0c, 6483ffd01957, 5a3fb92c366c; files: src/commands/models/list.list-command.ts, src/commands/models/list.rows.ts, src/commands/models.list.e2e.test.ts)

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

@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. labels Jun 19, 2026
@Monkey-wusky

Copy link
Copy Markdown
Contributor Author

Auto re-trigger CI

@Monkey-wusky

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@openclaw-barnacle openclaw-barnacle Bot added the triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. label Jun 30, 2026
@Monkey-wusky

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Jul 1, 2026
@steipete steipete self-assigned this Jul 1, 2026
@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Jul 1, 2026
@Monkey-wusky

Copy link
Copy Markdown
Contributor Author

@steipete Hi, I saw you self-assigned this PR 2 days ago — just checking in on the progress. If the current approach looks good, I can add focused regression tests to help move this forward. Or if you're evaluating across the sibling PRs, happy to adjust. Thanks!

@openclaw-barnacle openclaw-barnacle Bot removed the triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. label Jul 8, 2026
steipete added a commit that referenced this pull request Jul 9, 2026
Replace the stale fork PR with the reviewed fix on current main.

Refs: #94735

Co-authored-by: 毛宇豪0668001457 <[email protected]>
steipete added a commit that referenced this pull request Jul 9, 2026
Replace the stale fork PR with the reviewed fix on current main.

Refs: #94735

Co-authored-by: 毛宇豪0668001457 <[email protected]>
steipete added a commit that referenced this pull request Jul 9, 2026
Replace the stale fork PR with the reviewed fix on current main.

Refs: #94735

Co-authored-by: 毛宇豪0668001457 <[email protected]>
steipete added a commit that referenced this pull request Jul 9, 2026
Replace the stale fork PR with the reviewed fix on current main.

Refs: #94735

Co-authored-by: 毛宇豪0668001457 <[email protected]>
steipete added a commit that referenced this pull request Jul 9, 2026
Replace the stale fork PR with the reviewed fix on current main.

Refs: #94735

Co-authored-by: 毛宇豪0668001457 <[email protected]>
@openclaw-barnacle

Copy link
Copy Markdown

This assigned pull request has been automatically marked as stale after being open for 27 days.
Please add updates or it will be closed.

@openclaw-barnacle openclaw-barnacle Bot added stale Marked as stale due to inactivity and removed stale Marked as stale due to inactivity labels Jul 16, 2026
@openclaw-barnacle

Copy link
Copy Markdown

This assigned pull request has been automatically marked as stale after being open for 27 days.
Please add updates or it will be closed.

@openclaw-barnacle openclaw-barnacle Bot added the stale Marked as stale due to inactivity label Jul 17, 2026
@Monkey-wusky
Monkey-wusky force-pushed the fix/issue-94705-models-mode---replace--does-no branch from bb6a70e to bf44072 Compare July 17, 2026 14:53
@Monkey-wusky

Copy link
Copy Markdown
Contributor Author

@steipete Hi Pete, this PR has been marked stale and is about to be auto-closed by barnacle. I noticed you created #103103 ("fix(models): honor replace mode in list output") which ClawSweeper referenced as the canonical replacement.

However, this PR (#94735) already has proof: supplied + proof: sufficient and is ready for maintainer look, while #103103 still has status: needs proof. If the approach here is viable, could we land this one (or merge the proof into #103103)? Happy to rebase again if needed — just rebased to resolve the loadModelCatalogloadModelCatalogSnapshot conflict.

Let me know what you prefer. Thanks!

@Monkey-wusky
Monkey-wusky force-pushed the fix/issue-94705-models-mode---replace--does-no branch from bf44072 to a537bee Compare July 17, 2026 15:25
@openclaw-barnacle openclaw-barnacle Bot removed the stale Marked as stale due to inactivity label Jul 18, 2026
@openclaw-barnacle

Copy link
Copy Markdown

This assigned pull request has been automatically marked as stale after being open for 27 days.
Please add updates or it will be closed.

@openclaw-barnacle openclaw-barnacle Bot added the stale Marked as stale due to inactivity label Jul 18, 2026
@Monkey-wusky
Monkey-wusky force-pushed the fix/issue-94705-models-mode---replace--does-no branch from a537bee to e2e394e Compare July 20, 2026 06:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

commands Command implementations merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. proof: supplied External PR includes structured after-fix real behavior proof. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XS stale Marked as stale due to inactivity 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.

models.mode: "replace" does not filter openclaw models list output

2 participants