Repository navigation
refactor(models): retire duplicate auth and catalog test seams - #144589
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:32 PM ET / September 11, 2026, 02:32 UTC. ClawSweeper reviewWhat this changesConsolidates model login and catalog tests, makes the named-profile helper private, and moves unchanged output-flag validation into the shared command module. Merge readiness✅ Ready for maintainer review Keep open: this remains a useful, bounded follow-up to the merged catalog work. The retained coverage supports the deletions, and no introduced correctness or security defect was found. Priority: P3 Review scores
Verification
How this fits togetherOpenClaw’s model commands connect provider login results to saved profiles and present model catalogs through the CLI and chat. The new-session UI consumes catalog results to determine whether a selected model account is ready. flowchart TD
A[Provider login result] --> B[Model auth command]
B --> C[Profile persistence and ordering]
D[CLI output options] --> E[Shared flag validation]
E --> F[Model list output]
G[Published model catalog] --> F
G --> H[Chat and new-session model choices]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource -1, Tests -160. Total -161 across 8 files. View PR surface stats
Review metricsNone. Technical reviewBest possible solution: Keep the existing runtime owners and command contracts while retaining behavioral coverage at command, persistence, and UI lifecycle boundaries. Do we have a high-confidence way to reproduce the issue? Not applicable: this PR consolidates existing implementation and coverage rather than repairing a reported runtime defect. Is this the best way to solve the issue? Yes: making the test-only helper private and retaining the unchanged guard in an already-imported shared owner is a narrow solution, with meaningful deleted assertions preserved at stronger boundaries. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 89f364512258. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Landed as Proof: 241 focused tests passed across 11 suites. After the final rebase, 143 tests passed across the six affected suites. Formatting, targeted lint, ratchets, and full CI passed. The exact-head local review and server-side review found no blocking issue. Change: Retired two internal file boundaries and duplicate test setup. Named-profile assertions now run through the login command; the output-flag guard stays unchanged in the shared command owner.
F16 remains a named follow-up: core setup, status, and identity consumers still need facts beyond the plugin's native login-status probe. Explicit Codex auth/memory import remains plugin-owned. The separate prepared-auth endpoint lane was untouched. |
…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]>
Related: #136257, #144342, #144563.
What Problem This Solves
Auth and prepared-catalog changes left duplicate test setup and two obsolete file boundaries, making their remaining behavior harder to maintain.
Why This Change Was Made
Named-login assertions move to the command boundary, and the profile resolver becomes private. Duplicate authentication, account-preview, and catalog cases are consolidated. The unchanged output-flag guard moves into the shared command module. Credential readers and explicit imports remain where their consumers still need them.
User Impact
No behavior changes. Model listing, conflicting output flags, named profiles, account-preview recovery, and native sign-in status retain their contracts. No configuration, schema, protocol, or dependency change is introduced.
Evidence
All 241 focused tests passed across command, login, persistence, reply, and UI suites. After rebase, the six affected suites passed 143 tests. Before/after command-line and authenticated Gateway model lists returned the same fixture model; conflicting output flags returned the same error. Isolated native sign-in status remained signed out. Formatting, lint, structural, and whitespace checks passed. Interactive sign-in and inference were not tested.