Skip to content

fix(tui): canonicalize the openai-codex provider alias so /model never opens empty#156

Merged
BunsDev merged 1 commit into
mainfrom
fix/openai-codex-alias
Jul 14, 2026
Merged

fix(tui): canonicalize the openai-codex provider alias so /model never opens empty#156
BunsDev merged 1 commit into
mainfrom
fix/openai-codex-alias

Conversation

@BunsDev

@BunsDev BunsDev commented Jul 14, 2026

Copy link
Copy Markdown
Member

Summary

  • Canonicalize the openai-codex provider alias to codex so alias-opened /model pickers are never empty and the fetch spinner never spins forever.

Context

  • Related issue/user request: recovered from local work on main (device-auth flow stores the provider as openai-codex; the registry registers codex; exact-match lookups made the picker seed nothing and the spinner hang).
  • Scope: 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).
  • Non-goals: any other provider aliases; typeahead/keybinding work (separate PR).

Changes

  • crates/api/src/registry.rs: canonical_provider_id() mapping openai-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 in open_model_picker_for_provider and 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 — clean
  • cargo fmt --all--check clean
  • cargo check --workspace — clean
  • cargo clippy --workspace --all-targets -- -D warnings — clean
  • cargo test --workspace — not run in full; see targeted
  • Targeted/manual checks: cargo 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)
  • Not run: full workspace test suite — CI runs it; change surface is covered by the targeted tests above.

PR Readiness

  • Diff is limited to the intended files.
  • Generated files were not edited by hand.
  • User-facing docs/help were updated or are not needed.
  • No secrets, credentials, local paths, or unrelated logs are included.
  • Remaining risks or follow-up work are listed above.

…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.
Copilot AI review requested due to automatic review settings July 14, 2026 09:24
@BunsDev BunsDev added bug Something isn't working crate:tui Terminal UI crate (src-rust/crates/tui) labels Jul 14, 2026
@vercel

vercel Bot commented Jul 14, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
docs Ready Ready Preview Jul 14, 2026 9:24am

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 map openai-codexcodex (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-codexcodex.
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.

@BunsDev
BunsDev merged commit 19ea082 into main Jul 14, 2026
5 checks passed
@BunsDev
BunsDev deleted the fix/openai-codex-alias branch July 14, 2026 10:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working crate:tui Terminal UI crate (src-rust/crates/tui)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants