fix(tui): canonicalize the openai-codex provider alias so /model never opens empty#156
Merged
Conversation
…r opens empty The device-auth flow and older persisted configs store the Codex provider as "openai-codex"; the registry, model catalog, and query runtime all register it as "codex". Registry lookups are exact-match, so alias-opened pickers seeded no models and the fetch spinner span forever. Canonicalize at the picker entry points, persist the canonical id, keep seeded options when a listing comes back empty, and stop the spinner when no fetch can be spawned.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Pull request overview
This PR fixes an alias mismatch between persisted/provider-setup state (openai-codex) and the registry/catalog canonical provider id (codex), which previously caused /model pickers opened via the alias to seed no models and leave the “loading” spinner running indefinitely.
Changes:
- Added
canonical_provider_id()in the API registry to mapopenai-codex→codex(with unit tests). - Canonicalized provider ids at the TUI model-picker entry points (seeding and persistence) so the picker seed, async fetch, and current-model prefix all use the same id.
- Hardened interactive model fetching so empty listings don’t wipe seeded options, and the spinner stops when no fetch can be spawned (e.g., provider missing from the registry).
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src-rust/crates/api/src/registry.rs | Introduces canonical_provider_id() and tests to standardize openai-codex → codex. |
| src-rust/crates/tui/src/model_picker.rs | Treats the legacy alias as Codex when choosing the curated model list; adds a regression test. |
| src-rust/crates/tui/src/app.rs | Canonicalizes provider id when opening/persisting model picker state; adds a regression test for alias-opened picker. |
| src-rust/crates/cli/src/main.rs | Prevents empty async model listings from blanking seeded models and stops the spinner when no fetch is running. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
openai-codexprovider alias tocodexso alias-opened/modelpickers are never empty and the fetch spinner never spins forever.Context
openai-codex; the registry registerscodex; exact-match lookups made the picker seed nothing and the spinner hang).canonical_provider_id()in the api registry plus the three picker entry points that must agree (seed, async fetch, persisted id), and two picker robustness fixes (keep seeded options on an empty listing; stop the spinner when no fetch can be spawned).Changes
crates/api/src/registry.rs:canonical_provider_id()mappingopenai-codex->codex, with tests.crates/tui/src/model_picker.rs: curated CODEX_MODELS list served for the alias too.crates/tui/src/app.rs: canonicalize inopen_model_picker_for_providerand persist the canonical id after provider setup; test that an alias-opened picker shows curated models.crates/cli/src/main.rs: empty model listings no longer blank seeded options; spinner stops when the provider is missing from the registry.Validation
git diff --check— cleancargo fmt --all—--checkcleancargo check --workspace— cleancargo clippy --workspace --all-targets -- -D warnings— cleancargo test --workspace— not run in full; see targetedcargo test --package claurst-api -- canonical(2 passed),cargo test --package claurst-tui -- codex_alias(2 passed),cargo test --package claurst-tui -- model_picker_accepts(1 passed)PR Readiness