Skip to content

refactor(models): share prepared catalog views across model pickers - #144563

Merged
obviyus merged 3 commits into
mainfrom
refactor/prepared-catalog-view-cutover
Sep 11, 2026
Merged

obviyus merged 3 commits into
mainfrom
refactor/prepared-catalog-view-cutover

Conversation

@obviyus

@obviyus obviyus commented Sep 11, 2026 •

Copy link
Copy Markdown
Collaborator

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.

@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 gateway Gateway runtime commands Command implementations agents Agent runtime and tooling size: XL maintainer Maintainer-authored PR labels Sep 11, 2026
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. 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:01 PM ET / September 11, 2026, 02:01 UTC (Revision 3).

ClawSweeper review

What this changes

The 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
Reviewed head: 309ab5f6bfe05e883225f382e7ab3462b407e015

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused consolidation with meaningful retained coverage and no supported blocking defect.
Proof confidence 🌊 off-meta tidepool Not applicable: The supplied repository state identifies a MEMBER-authored PR, so the external-contributor proof gate does not apply. Its recorded CLI, Gateway-refresh, and picker observations cover the moved preparation behavior at c43cbefd5647; they are not represented as reviewer execution or execution of the current head.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The supplied repository state identifies a MEMBER-authored PR, so the external-contributor proof gate does not apply. Its recorded CLI, Gateway-refresh, and picker observations cover the moved preparation behavior at c43cbefd5647; they are not represented as reviewer execution or execution of the current head.
Evidence reviewed 8 items Shared view preserves existing constraints: The prepared view retains host-profile and authored-route exclusions, current-generation checks, registry identity checks, and fresh native-readiness observations; explicit native acquisition remains separately gated.
Consumers complete the cutover: Gateway preparation delegates refresh and provider inventory to the view, and both picker entry points delegate acquisition to it. Searching src and test found no remaining references to the retired helper symbols.
Current-main necessity: Fetched main still contains only the earlier route-projection view. The merged cleanup at #144342 explicitly retained the readiness, static-inventory, and provider-picker helpers pending this follow-up; it does not supersede this work.
Findings None None.
Security None None.

How this fits together

Model 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]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source -89, Tests +125. Total +36 across 15 files.

View PR surface stats
Area Files Added Removed Net
Source 8 458 547 -89
Tests 7 367 242 +125
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 15 825 789 +36

Review metrics

None.

Technical review

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

Labels

Label justifications:

  • P3: This is a bounded internal consolidation with no intended change to model choices, login behavior, or persisted settings.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The supplied repository state identifies a MEMBER-authored PR, so the external-contributor proof gate does not apply. Its recorded CLI, Gateway-refresh, and picker observations cover the moved preparation behavior at c43cbefd5647; they are not represented as reviewer execution or execution of the current head.

Evidence

What I checked:

  • Shared view preserves existing constraints: The prepared view retains host-profile and authored-route exclusions, current-generation checks, registry identity checks, and fresh native-readiness observations; explicit native acquisition remains separately gated. (src/agents/model-catalog-view.ts:102, 309ab5f6bfe0)
  • Consumers complete the cutover: Gateway preparation delegates refresh and provider inventory to the view, and both picker entry points delegate acquisition to it. Searching src and test found no remaining references to the retired helper symbols. (src/gateway/server-methods/models-list-result.ts:344, 309ab5f6bfe0)
  • Current-main necessity: Fetched main still contains only the earlier route-projection view. The merged cleanup at refactor(models): remove superseded catalog paths #144342 explicitly retained the readiness, static-inventory, and provider-picker helpers pending this follow-up; it does not supersede this work. (src/agents/model-catalog-view.ts:1, 0ec6bd1e4312)
  • Re-review delta: The latest commit changes evaluateNative from method syntax to an arrow-function property without changing its body. The previous completed review records no findings or published rank-up moves. (src/agents/model-catalog-view.ts:130, 309ab5f6bfe0)
  • Retained boundary coverage: The Gateway tests exercise actual preparation and handler composition with generation replacement. The Codex plugin test retains account-read, model-list, sign-out, disconnect, and host-route assertions while moving its direct evaluator calls to the new view; these are supplemental tests, not reviewer-executed live proof. (test/plugins/codex-model-catalog.gateway.test.ts:358, 309ab5f6bfe0)
  • Dependency contract inspected: The changed plugin test directly exercises Codex account/read, account/updated, and model/list, establishing the dependency signal. Personally inspected the sibling account response and notification definitions, paginated model response, and corresponding account/catalog processors. The cache repository remote verifies ownership as openai/codex. (codex-rs/app-server-protocol/src/protocol/v2/account.rs:537, 3d2ee51ca2d5)

Likely related people:

  • obviyus: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; 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.

History

Review history (2 earlier review cycles)
  • reviewed 2026-09-11T01:38:00.649Z sha 50c60f5 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-11T01:46:57.789Z sha 2f77b0b :: needs maintainer review before merge. :: none

@obviyus
obviyus merged commit cd3835f into main Sep 11, 2026
182 of 183 checks passed
@obviyus
obviyus deleted the refactor/prepared-catalog-view-cutover branch September 11, 2026 02:09
@obviyus

obviyus commented Sep 11, 2026

Copy link
Copy Markdown
Collaborator Author

Landed the requested F12/F16 prepared-catalog cutover.

Proof: Focused owner, Gateway, picker, and native-plugin tests passed. Before/after command-line, native models.list refresh, and real Control UI picker checks preserved the observed rows, availability, guidance, and ordering. The final-head review found no issues, and the required checks passed.

Before After
Four separate helpers owned native readiness, refresh/static membership, and preferred-provider acquisition. One prepared view serves those consumers; the helpers are deleted and their behavior assertions are retained.

Production code is 89 lines smaller. Both introduced check failures were fixed; no gate was waived.

obviyus added a commit that referenced this pull request Sep 11, 2026
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]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 11, 2026
…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]>
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

agents Agent runtime and tooling commands Command implementations gateway Gateway runtime maintainer Maintainer-authored PR P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XL 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