Skip to content

fix(cli): limit provider selector height - #10420

Merged
michaelneale merged 5 commits into
aaif-goose:mainfrom
495696116:agent/limit-provider-list-height
Jul 15, 2026
Merged

fix(cli): limit provider selector height#10420
michaelneale merged 5 commits into
aaif-goose:mainfrom
495696116:agent/limit-provider-list-height

Conversation

@495696116

@495696116 495696116 commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Summary

  • cap the visible provider selector at 10 rows
  • keep the configured provider visible when it falls outside the first page
  • provide a fuzzy-search path for the complete provider list without stale pagination state

Why

goose configure currently renders every provider at once, which can overflow smaller terminals and make the prompt hard to scan.

cliclack 0.5.5 does not reset its private list offset when filtering a paginated selector, so long lists use a separate fuzzy-search step before rendering paginated results.

Validation

  • cargo fmt --check
  • cargo test -p goose-cli --no-default-features --features rustls-tls commands::configure::tests --locked (3 passed)
  • cargo check -p goose-cli --no-default-features --features rustls-tls --locked
  • cargo clippy -p goose-cli --all-targets --no-default-features --features rustls-tls --locked -- -D warnings
  • manually exercised pagination and fuzzy search with an isolated GOOSE_PATH_ROOT

Closes #10415

@495696116
495696116 marked this pull request as ready for review July 13, 2026 15:49

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0d71b3bea4

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread crates/goose-cli/src/commands/configure.rs Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f28e3ed5af

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread crates/goose-cli/src/commands/configure.rs Outdated

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f28e3ed5af

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread crates/goose-cli/src/commands/configure.rs Outdated

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. More of your lovely PRs please.

Reviewed commit: 1e836e6144

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@michaelneale

Copy link
Copy Markdown
Collaborator

thanks... taking a look

@michaelneale

Copy link
Copy Markdown
Collaborator

Nice fix — verified locally that it caps the list at 10 rows with a working search fallback. 👍

One small suggestion on the SEARCH_PROVIDERS_KEY / SEARCH_PROVIDERS_AGAIN_KEY sentinel strings: since cliclack::select is generic over its value type, the "is this a real provider or a UI action?" distinction can be modeled with an enum instead of __magic__ string values. That removes the (admittedly tiny) risk of a provider colliding with the sentinels and lets the compiler enforce that every case is handled.

Suggested change (tested locally: fmt/clippy clean, existing tests pass, same runtime behavior):

// replace the two sentinel consts with:
#[derive(Clone, PartialEq, Eq)]
enum ProviderChoice {
    /// A real provider, identified by its provider name (e.g. "anthropic").
    Provider(String),
    /// The "Search all providers..." entry in the paginated list.
    Search,
    /// The "Search again..." entry in the fuzzy-search results list.
    SearchAgain,
}

fn provider_choice_items(items: &[ProviderItem]) -> Vec<(ProviderChoice, String, String)> {
    items
        .iter()
        .map(|(name, label, hint)| {
            (ProviderChoice::Provider(name.clone()), label.clone(), hint.clone())
        })
        .collect()
}

search_provider_dialog then becomes:

let mut items = provider_choice_items(&filtered_items);
items.push((
    ProviderChoice::SearchAgain,
    "Search again...".to_string(),
    "Enter a different search term".to_string(),
));

match cliclack::select("Which model provider should we use?")
    .items(&items)
    .max_rows(MAX_PROVIDER_ROWS)
    .interact()?
{
    ProviderChoice::SearchAgain => continue,
    ProviderChoice::Provider(name) => return Ok(name),
    ProviderChoice::Search => unreachable!("Search entry is not added to the results list"),
}

and the paginated select in configure_provider_dialog:

let mut paginated_items = provider_choice_items(&provider_items);
paginated_items.insert(
    MAX_PROVIDER_ROWS - 1,
    (
        ProviderChoice::Search,
        "Search all providers...".to_string(),
        "Filter the complete provider list".to_string(),
    ),
);

match cliclack::select("Which model provider should we use?")
    .initial_value(ProviderChoice::Provider(default_provider.clone()))
    .items(&paginated_items)
    .max_rows(MAX_PROVIDER_ROWS)
    .interact()?
{
    ProviderChoice::Search => search_provider_dialog(&provider_items)?,
    ProviderChoice::Provider(name) => name,
    ProviderChoice::SearchAgain => {
        unreachable!("SearchAgain entry is not added to the paginated list")
    }
}

Fully optional — the current version works fine. The only slight wart in the enum version is the two unreachable!() arms (each list only ever contains a subset of the variants); using two separate enums would remove those at the cost of more boilerplate.

@michaelneale

Copy link
Copy Markdown
Collaborator

@495696116 do you want to apply those changes - and then can approve it and merge? (or I can comit to your branch if you would like me to) LMK - but nice work!

@michaelneale

Copy link
Copy Markdown
Collaborator

As an example of the enum approach, I put it up as #10474 (a straight PR to main with the full fix + refactor, builds/clippy/tests clean) — feel free to pull from it or ignore. Whichever version lands, the other can be closed since they cover the same issue (#10415).

Copy link
Copy Markdown
Contributor Author

Thanks! Applied the type-safe ProviderChoice enum change in a438598. Provider rows now carry Provider(String), Search, or SearchAgain values, removing the sentinel collision risk while preserving the existing picker behavior. This follows the approach demonstrated in #10474.

Validation on the updated branch:

  • cargo fmt --check
  • cargo test -p goose-cli --no-default-features --features rustls-tls commands::configure::tests --locked (3 passed)
  • cargo check -p goose-cli --no-default-features --features rustls-tls --locked
  • cargo clippy -p goose-cli --all-targets --no-default-features --features rustls-tls --locked -- -D warnings

I also confirmed the updated branch merges cleanly with the current main in a local merge-tree check.

@michaelneale michaelneale left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

nice one.

@michaelneale
michaelneale added this pull request to the merge queue Jul 15, 2026
Merged via the queue into aaif-goose:main with commit e359b35 Jul 15, 2026
25 checks passed
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.

provider list too long

2 participants