Repository navigation
refactor(models): share prepared catalog views across model pickers - #144563
Conversation
|
🦞👀 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. Reviewed September 10, 2026, 10:01 PM ET / September 11, 2026, 02:01 UTC (Revision 3). ClawSweeper reviewWhat this changesThe PR consolidates model catalog preparation for Gateway lists and setup pickers, preserving provider filtering, configured rows, native readiness, and picker ordering. Merge readiness✅ Ready for maintainer review Keep open: this remains a useful, bounded follow-up to the merged catalog cleanup. Current main does not contain this consolidation, and the reviewed patch has no actionable correctness findings. Priority: P3 Review scores
Verification
How this fits togetherModel catalog preparation combines published model inventory, configured choices, and current native-account observations. Gateway model lists and setup pickers consume those facts to display model choices and availability. flowchart TD
A[Published model inventory] --> D[Prepared catalog view]
B[Configured model choices] --> D
C[Native account observations] --> D
D --> E[Readiness and provider filtering]
E --> F[Gateway model lists]
E --> G[Setup model pickers]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource -89, Tests +125. Total +36 across 15 files. View PR surface stats
Review metricsNone. Technical reviewBest possible solution: Keep catalog preparation in the shared view while preserving lifecycle-owned acquisition, revocable readiness, and existing picker semantics. Do we have a high-confidence way to reproduce the issue? Not applicable: this is a behavior-preserving refactor, and source review found no concrete introduced failure to reproduce. Is this the best way to solve the issue? Yes: consolidating the existing operations and migrating their callers removes parallel preparation paths while retaining the established acquisition and readiness contracts. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 0ec6bd1e4312. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
History |
|
Landed the requested F12/F16 prepared-catalog cutover. Proof: Focused owner, Gateway, picker, and native-plugin tests passed. Before/after command-line, native
Production code is 89 lines smaller. Both introduced check failures were fixed; no gate was waived. |
Related: #136257, #144342, #144563 ## What Problem This Solves This maintainer-requested follow-up removes redundant test setup and two obsolete file boundaries after the auth and prepared-catalog cutovers. The older extraction deleted larger suites, but most current tests now protect behavior added or changed by the landed owners. ## Why This Change Was Made Move named-login assertions to the command boundary and make `resolveLoginProfiles` private. Consolidate duplicate auth, account-preview, and catalog cases. Move the unchanged output-flag guard into the shared command module, which its callers already import. The native-auth audit found remaining core credential consumers in setup, status, and execution identity. The plugin's non-secret login-status probe does not yet serve every consumer, so this PR retains those readers. The Codex migration provider still owns explicit auth and memory import. ## User Impact No behavior change. Model listing, output-flag validation, named profiles, account-preview recovery, and native sign-in status keep their current behavior. No schema, config, protocol, dependency, or compatibility path is added. ## Evidence - 241 focused tests passed across 11 command, login integration, persistence, reply, and UI suites. After the final rebase, all 143 tests in the six affected suites passed again; unchanged proof is retained. - Before/after `pnpm openclaw models list` and authenticated Gateway `models.list` return the same available fixture model. Conflicting `--json --plain` still fails with the same message. - Native sign-in status remains signed out in the isolated fixture. No interactive sign-in or inference claim is made. - Formatting, targeted type-aware lint, line-count/environment-count checks, assertion checks, and `git diff --check` passed. Fresh source review found no substantive findings. - Production delta is -1 line; tests are -160 lines. The patch adds 95 lines and deletes 256, including two whole files. ### File disposition | Requested file | Disposition | Reason or retained owner | | --- | --- | --- | | `src/commands/models/auth.test.ts` | Retain; consolidate duplicates | Manual input, method selection, force ordering, target agents, saved-state errors and defaults remain live. Named-profile cases move here. | | `ui/src/pages/new-session/model-control.metadata-lifecycle.test.ts` | Retain; remove one duplicate row | Retry coverage already proves rejected previews block; account confirmation, retirement, reconnect and remount cases remain. | | `src/gateway/server-methods/models-list-result.cli-runtime-availability.test.ts` | Retain | No full replacement for Gateway native/provider separation, plugin gates, and personal account precedence. | | `src/gateway/server-methods/models-list-result.provider-outcomes.test.ts` | Retain | Empty-catalog rejections, selected-account matching and public reason/deadline projection remain distinct. | | `src/auto-reply/reply/commands-models.catalog-recovery.test.ts` | Retain; remove two duplicates | The timer variant never delayed acquisition; the singleton tested only default retention already covered through public replies. | | `src/gateway/server-methods/models-list-result.plugin-runtime.test.ts` | Retain | Actual handler registry/generation races and preloaded chat composition remain live. | | `src/auto-reply/reply/directive-handling.auth.ts` | Untouched | Assigned to the separate prepared-auth endpoint lane. | | `src/auto-reply/reply/directive-handling.auth.test.ts` | Untouched | Stays with that lane. | | `src/agents/prepared-model-catalog-worker.test.ts` | Retain | Artifact-mode and synthetic-auth request identities lack complete replacement coverage. | | `extensions/codex/src/migration/provider.ts` | Retain | Registered by the plugin and migration artifact; explicit auth/memory import still needs it. | | `src/commands/models/auth.login-profiles.test.ts` | Delete; migrate assertions | Named override and ambiguous-result rejection move to command tests; ordinary login already covers pass-through. | | `src/auto-reply/reply/directive-handling.model-picker.ts` | Untouched | Assigned to the separate prepared-auth endpoint lane. | | `src/auto-reply/reply/directive-handling.model-picker.test.ts` | Untouched | Stays with that lane. | | `src/commands/models/list.options.ts` | Delete; move implementation | Shared command owner keeps the same guard and all four callers. | ### Assertion ledger - Named-profile override and multi-profile rejection now run through `modelsAuthLoginCommand`, including persistence/order/output and no-write failure assertions. - Provider-issued profile pass-through remains in the ordinary login test and registered CLI integration. - Protected-token mock forwarding is replaced by retained actual store/reference/audit proof in `provider-auth-persistence.test.ts` and generic token-command dispatch. - Configured-order promotion remains in the registered CLI integration, which reads the actual shared/local stores. - Invalid-method tests share one table and retain both omitted-force and forced cases, with no login or purge. - The failed-preview row remains covered by the stronger same-account retry test in the same UI file. - Native bound-model/default visibility remains in four public reply cases after removing the duplicate timer row and default-only singleton. Co-authored-by: Ayaan Zaidi <[email protected]>
…penclaw#144563) Model browsing now uses one prepared view for native refresh and readiness, static membership, and preferred-provider acquisition. Remove the superseded helpers while preserving current generation, host-account, last-good, and picker-order contracts. Validation: focused owner/Gateway/picker/native-plugin tests, online/offline CLI, native Gateway refresh, and before/after real Control UI picker proof. Co-authored-by: Ayaan Zaidi <[email protected]>
…law#144589) Related: openclaw#136257, openclaw#144342, openclaw#144563 ## What Problem This Solves This maintainer-requested follow-up removes redundant test setup and two obsolete file boundaries after the auth and prepared-catalog cutovers. The older extraction deleted larger suites, but most current tests now protect behavior added or changed by the landed owners. ## Why This Change Was Made Move named-login assertions to the command boundary and make `resolveLoginProfiles` private. Consolidate duplicate auth, account-preview, and catalog cases. Move the unchanged output-flag guard into the shared command module, which its callers already import. The native-auth audit found remaining core credential consumers in setup, status, and execution identity. The plugin's non-secret login-status probe does not yet serve every consumer, so this PR retains those readers. The Codex migration provider still owns explicit auth and memory import. ## User Impact No behavior change. Model listing, output-flag validation, named profiles, account-preview recovery, and native sign-in status keep their current behavior. No schema, config, protocol, dependency, or compatibility path is added. ## Evidence - 241 focused tests passed across 11 command, login integration, persistence, reply, and UI suites. After the final rebase, all 143 tests in the six affected suites passed again; unchanged proof is retained. - Before/after `pnpm openclaw models list` and authenticated Gateway `models.list` return the same available fixture model. Conflicting `--json --plain` still fails with the same message. - Native sign-in status remains signed out in the isolated fixture. No interactive sign-in or inference claim is made. - Formatting, targeted type-aware lint, line-count/environment-count checks, assertion checks, and `git diff --check` passed. Fresh source review found no substantive findings. - Production delta is -1 line; tests are -160 lines. The patch adds 95 lines and deletes 256, including two whole files. ### File disposition | Requested file | Disposition | Reason or retained owner | | --- | --- | --- | | `src/commands/models/auth.test.ts` | Retain; consolidate duplicates | Manual input, method selection, force ordering, target agents, saved-state errors and defaults remain live. Named-profile cases move here. | | `ui/src/pages/new-session/model-control.metadata-lifecycle.test.ts` | Retain; remove one duplicate row | Retry coverage already proves rejected previews block; account confirmation, retirement, reconnect and remount cases remain. | | `src/gateway/server-methods/models-list-result.cli-runtime-availability.test.ts` | Retain | No full replacement for Gateway native/provider separation, plugin gates, and personal account precedence. | | `src/gateway/server-methods/models-list-result.provider-outcomes.test.ts` | Retain | Empty-catalog rejections, selected-account matching and public reason/deadline projection remain distinct. | | `src/auto-reply/reply/commands-models.catalog-recovery.test.ts` | Retain; remove two duplicates | The timer variant never delayed acquisition; the singleton tested only default retention already covered through public replies. | | `src/gateway/server-methods/models-list-result.plugin-runtime.test.ts` | Retain | Actual handler registry/generation races and preloaded chat composition remain live. | | `src/auto-reply/reply/directive-handling.auth.ts` | Untouched | Assigned to the separate prepared-auth endpoint lane. | | `src/auto-reply/reply/directive-handling.auth.test.ts` | Untouched | Stays with that lane. | | `src/agents/prepared-model-catalog-worker.test.ts` | Retain | Artifact-mode and synthetic-auth request identities lack complete replacement coverage. | | `extensions/codex/src/migration/provider.ts` | Retain | Registered by the plugin and migration artifact; explicit auth/memory import still needs it. | | `src/commands/models/auth.login-profiles.test.ts` | Delete; migrate assertions | Named override and ambiguous-result rejection move to command tests; ordinary login already covers pass-through. | | `src/auto-reply/reply/directive-handling.model-picker.ts` | Untouched | Assigned to the separate prepared-auth endpoint lane. | | `src/auto-reply/reply/directive-handling.model-picker.test.ts` | Untouched | Stays with that lane. | | `src/commands/models/list.options.ts` | Delete; move implementation | Shared command owner keeps the same guard and all four callers. | ### Assertion ledger - Named-profile override and multi-profile rejection now run through `modelsAuthLoginCommand`, including persistence/order/output and no-write failure assertions. - Provider-issued profile pass-through remains in the ordinary login test and registered CLI integration. - Protected-token mock forwarding is replaced by retained actual store/reference/audit proof in `provider-auth-persistence.test.ts` and generic token-command dispatch. - Configured-order promotion remains in the registered CLI integration, which reads the actual shared/local stores. - Invalid-method tests share one table and retain both omitted-force and forced cases, with no login or purge. - The failed-preview row remains covered by the stronger same-account retry test in the same UI file. - Native bound-model/default visibility remains in four public reply cases after removing the duplicate timer row and default-only singleton. Co-authored-by: Ayaan Zaidi <[email protected]>
What Problem This Solves
Model browsing maintained separate implementations for native readiness, explicit refresh, configured model inclusion, and provider-scoped acquisition.
Why This Change Was Made
The prepared catalog view now owns those operations. Gateway lists, catalog decisions, and both pickers consume that view; four superseded helpers are removed.
User Impact
Model rows, availability, refusal guidance, and ordering stay the same. Ordinary reads remain passive, and explicit refresh keeps its acquisition behavior. No configuration or migration change.
Evidence
Focused catalog, Gateway, picker, and native-plugin tests passed. A mutation removing configured-model inclusion failed its owner test. Before/after CLI model lists and authenticated Gateway refresh preserved rows and availability. Real browser picker tests passed before and after, covering desktop/mobile choices, search, order, and catalog replacement. The final rebase retained the tested patch.
Related: #136257, #144342.