Skip to content

fix(tui): scope model candidates to active provider#3428

Open
Hmbown wants to merge 2 commits into
mainfrom
issue/3383-provider-scoped-model-candidates
Open

fix(tui): scope model candidates to active provider#3428
Hmbown wants to merge 2 commits into
mainfrom
issue/3383-provider-scoped-model-candidates

Conversation

@Hmbown

@Hmbown Hmbown commented Jun 23, 2026

Copy link
Copy Markdown
Owner

Goal

Advance #3383 by making the main /model surfaces provider-scoped by default. A bare model string should no longer look like permission to switch providers.

Changes

  • added a reusable active-provider model candidate helper used by the picker and live slash-menu completions
  • removed cross-provider seeded/catalog rows from the main model picker section
  • removed cross-provider saved model rows from the main model picker section
  • changed /model <name> so saved models from other providers no longer silently emit SwitchProvider
  • kept active-provider saved models and current custom model reachability intact
  • added regression coverage for Together + saved OpenRouter rows not appearing as bare picker/completion choices

Verification

  • cargo test -p codewhale-tui --bin codewhale-tui --locked tui::model_picker
  • cargo test -p codewhale-tui --bin codewhale-tui --locked tui::widgets
  • cargo test -p codewhale-tui --bin codewhale-tui --locked visible_slash_model_completions_are_provider_scoped
  • cargo test -p codewhale-tui --bin codewhale-tui --locked commands::groups::core::core
  • cargo test -p codewhale-tui --bin codewhale-tui --locked model_inventory
  • cargo test -p codewhale-tui --bin codewhale-tui --locked route_resolver (0 matching tests)
  • python3 scripts/check-provider-registry.py
  • cargo fmt --all -- --check
  • git diff --check

Risks

Fixes #3383.

Make the /model command, model picker main section, and slash completions stay inside the active provider scope. Cross-provider saved/catalog rows no longer appear as bare model choices or silently switch providers; explicit route-switch UX remains deferred to the route resolver/search work.

Tests: cargo test -p codewhale-tui --bin codewhale-tui --locked tui::model_picker; cargo test -p codewhale-tui --bin codewhale-tui --locked tui::widgets; cargo test -p codewhale-tui --bin codewhale-tui --locked visible_slash_model_completions_are_provider_scoped; cargo test -p codewhale-tui --bin codewhale-tui --locked commands::groups::core::core; cargo test -p codewhale-tui --bin codewhale-tui --locked model_inventory; cargo test -p codewhale-tui --bin codewhale-tui --locked route_resolver; python3 scripts/check-provider-registry.py; cargo fmt --all -- --check; git diff --check

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request refactors the model picker and slash command completions to scope model choices strictly to the active provider, removing the automatic cross-provider switching behavior. The reviewer feedback recommends removing the unused _api_provider parameter from the newly introduced slash_completion_hints_with_model_candidates function and its callers to simplify the function signatures and reduce coupling.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment on lines +2341 to 2364
let model_candidates = model_completion_names_for_provider(api_provider)
.into_iter()
.map(str::to_string)
.collect::<Vec<_>>();
slash_completion_hints_with_model_candidates(
input,
limit,
cached_skills,
locale,
workspace,
api_provider,
&model_candidates,
)
}

pub(crate) fn slash_completion_hints_with_model_candidates(
input: &str,
limit: usize,
cached_skills: &[(String, String)],
locale: crate::localization::Locale,
workspace: Option<&std::path::Path>,
_api_provider: ApiProvider,
model_candidates: &[String],
) -> Vec<SlashMenuEntry> {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The _api_provider parameter in slash_completion_hints_with_model_candidates is unused. We can remove it to simplify the function signature and reduce coupling.

    let model_candidates = model_completion_names_for_provider(api_provider)
        .into_iter()
        .map(str::to_string)
        .collect::<Vec<_>>();
    slash_completion_hints_with_model_candidates(
        input,
        limit,
        cached_skills,
        locale,
        workspace,
        &model_candidates,
    )
}

pub(crate) fn slash_completion_hints_with_model_candidates(
    input: &str,
    limit: usize,
    cached_skills: &[(String, String)],
    locale: crate::localization::Locale,
    workspace: Option<&std::path::Path>,
    model_candidates: &[String],
) -> Vec<SlashMenuEntry> {

Comment on lines +31 to 39
slash_completion_hints_with_model_candidates(
&app.input,
limit,
&app.cached_skills,
app.ui_locale,
Some(&app.workspace),
app.api_provider,
&model_candidates,
)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

Remove the unused app.api_provider argument from the call to slash_completion_hints_with_model_candidates.

    slash_completion_hints_with_model_candidates(
        &app.input,
        limit,
        &app.cached_skills,
        app.ui_locale,
        Some(&app.workspace),
        &model_candidates,
    )

Comment on lines +228 to 236
let candidates = slash_completion_hints_with_model_candidates(
&app.input,
128,
&app.cached_skills,
app.ui_locale,
Some(&app.workspace),
app.api_provider,
&model_candidates,
)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

Remove the unused app.api_provider argument from the call to slash_completion_hints_with_model_candidates.

    let candidates = slash_completion_hints_with_model_candidates(
        &app.input,
        128,
        &app.cached_skills,
        app.ui_locale,
        Some(&app.workspace),
        &model_candidates,
    )

Keep the slash completion convenience wrapper test-only after the production slash menu path moved to explicit provider-scoped candidates. This avoids dead-code and unused-import failures under release/clippy builds while preserving the existing widget unit tests.

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

@Hmbown Hmbown marked this pull request as ready for review June 23, 2026 05:56

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

v0.8.65: Provider-scoped model candidates for /model, picker, and slash completions

1 participant