Skip to content

refactor(models): retire duplicate auth and catalog test seams - #144589

Merged
obviyus merged 1 commit into
mainfrom
refactor/models-dead-path-sweep-2
Sep 11, 2026
Merged

obviyus merged 1 commit into
mainfrom
refactor/models-dead-path-sweep-2

Conversation

@obviyus

@obviyus obviyus commented Sep 11, 2026 •

Copy link
Copy Markdown
Collaborator

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.

@clawsweeper

clawsweeper Bot commented Sep 11, 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 app: web-ui App: web-ui commands Command implementations size: M maintainer Maintainer-authored PR labels Sep 11, 2026
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. 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 Sep 11, 2026
@clawsweeper

clawsweeper Bot commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 10, 2026, 10:32 PM ET / September 11, 2026, 02:32 UTC.

ClawSweeper review

What this changes

Consolidates 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
Reviewed head: 19c1680bc79c1a77ae65928fab70d1efe37b19cb

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused cleanup with relevant reported runtime checks, preserved behavioral coverage, and no blocking findings.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (terminal): The complete PR body reports before/after isolated CLI and authenticated Gateway model-list parity plus unchanged conflicting-flag rejection, matching the relocated command guard; auth and UI algorithms remain unchanged, with retained boundary coverage supporting the test consolidation.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The complete PR body reports before/after isolated CLI and authenticated Gateway model-list parity plus unchanged conflicting-flag rejection, matching the relocated command guard; auth and UI algorithms remain unchanged, with retained boundary coverage supporting the test consolidation.
Evidence reviewed 9 items Introduced production changes: The pinned merge-base comparison shows only helper export removal and relocation of the identical output-mode guard; login, persistence, authorization, and catalog algorithms are unchanged.
Cleanup remains absent from current main: Fetched main still exports resolveLoginProfiles and imports/reexports list.options.js. The linked merged catalog PRs therefore do not implement this remaining cleanup.
Named-profile coverage moves to the command boundary: The new cases assert the requested profile reaches persistence, promotion, and output, while ambiguous multi-profile results cause no persistence, promotion, config update, or Gateway call. Ordinary login retains provider-issued profile pass-through coverage.
Findings None None.
Security None None.

How this fits together

OpenClaw’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]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source -1, Tests -160. Total -161 across 8 files.

View PR surface stats
Area Files Added Removed Net
Source 4 9 10 -1
Tests 4 86 246 -160
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 8 95 256 -161

Review metrics

None.

Technical review

Best 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.

Labels

Label changes:

  • add P3: This is a bounded maintenance cleanup with unchanged runtime behavior and no reported user-facing outage.
  • add proof: sufficient: Contributor real behavior proof is sufficient. The complete PR body reports before/after isolated CLI and authenticated Gateway model-list parity plus unchanged conflicting-flag rejection, matching the relocated command guard; auth and UI algorithms remain unchanged, with retained boundary coverage supporting the test consolidation.
  • 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 (terminal): The complete PR body reports before/after isolated CLI and authenticated Gateway model-list parity plus unchanged conflicting-flag rejection, matching the relocated command guard; auth and UI algorithms remain unchanged, with retained boundary coverage supporting the test consolidation.

Label justifications:

  • P3: This is a bounded maintenance cleanup with unchanged runtime behavior and no reported user-facing outage.
  • 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 (terminal): The complete PR body reports before/after isolated CLI and authenticated Gateway model-list parity plus unchanged conflicting-flag rejection, matching the relocated command guard; auth and UI algorithms remain unchanged, with retained boundary coverage supporting the test consolidation.
  • proof: sufficient: Contributor real behavior proof is sufficient. The complete PR body reports before/after isolated CLI and authenticated Gateway model-list parity plus unchanged conflicting-flag rejection, matching the relocated command guard; auth and UI algorithms remain unchanged, with retained boundary coverage supporting the test consolidation.

Evidence

What I checked:

  • Introduced production changes: The pinned merge-base comparison shows only helper export removal and relocation of the identical output-mode guard; login, persistence, authorization, and catalog algorithms are unchanged. (src/commands/models/shared.ts:45, 19c1680bc79c)
  • Cleanup remains absent from current main: Fetched main still exports resolveLoginProfiles and imports/reexports list.options.js. The linked merged catalog PRs therefore do not implement this remaining cleanup. (src/commands/models/auth.ts:1041, 89f364512258)
  • Named-profile coverage moves to the command boundary: The new cases assert the requested profile reaches persistence, promotion, and output, while ambiguous multi-profile results cause no persistence, promotion, config update, or Gateway call. Ordinary login retains provider-issued profile pass-through coverage. (src/commands/models/auth.test.ts:553, 19c1680bc79c)
  • Retained integration and storage coverage: The registered CLI integration verifies that a fresh login precedes configured stale order using actual persisted stores. The persistence suite separately verifies a provider-minted token becomes a resolvable protected reference without a plaintext audit finding. (src/cli/models-cli.auth-login.integration.test.ts:115, 19c1680bc79c)
  • Removed UI and catalog cases retain stronger coverage: The retained same-account retry test checks initial rejection, repeated rejection, blocked submission, and successful recovery. Four public catalog reply cases retain bound-model visibility and default inclusion; the removed timer variant never delayed its mocked acquisition. (ui/src/pages/new-session/model-control.metadata-lifecycle.test.ts:132, 19c1680bc79c)
  • Reported behavior proof and related work: The supplied complete PR body reports before/after isolated CLI and authenticated Gateway model-list parity, unchanged conflicting-output-mode rejection, and 143 passing tests after the final rebase. It identifies this as a follow-up to merged refactor(models): remove superseded catalog paths #144342 and refactor(models): share prepared catalog views across model pickers #144563, while retaining live credential readers and migration ownership. No new native sign-in or inference behavior is claimed. (19c1680bc79c)

Likely related people:

  • obviyus: 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.

@obviyus
obviyus merged commit 82c306d into main Sep 11, 2026
197 checks passed
@obviyus
obviyus deleted the refactor/models-dead-path-sweep-2 branch September 11, 2026 02:50
@obviyus

obviyus commented Sep 11, 2026

Copy link
Copy Markdown
Collaborator Author

Landed as 82c306d924c0ea00fac9e04a7b66e446e60fc5b3.

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.

Before After
CLI and authenticated Gateway return the available fixture model Same output
Conflicting output flags fail with the documented error Same error and exit code
Isolated native status reports signed out Same status
Helper-only profile tests and duplicate cases Command-boundary assertions and retained distinct coverage

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.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 11, 2026
…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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: web-ui App: web-ui commands Command implementations maintainer Maintainer-authored PR P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M 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.

1 participant