Skip to content

feat: add option for hiding inactive provider#207

Open
winston0410 wants to merge 5 commits into
carlos-algms:mainfrom
winston0410:fix/no-multiple-model-switcher
Open

feat: add option for hiding inactive provider#207
winston0410 wants to merge 5 commits into
carlos-algms:mainfrom
winston0410:fix/no-multiple-model-switcher

Conversation

@winston0410
Copy link
Copy Markdown

@winston0410 winston0410 commented Apr 26, 2026

Update the provider selector, so the inactive providers can be filtered out based on configuration.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 26, 2026

📝 Walkthrough

Walkthrough

Adds a new provider_switcher configuration block with a hide_unhealthy_providers: boolean option (default: false) wired into the user config and defaults. SessionRegistry.select_provider now consults Config.provider_switcher.hide_unhealthy_providers to omit providers whose CLI is not installed; if filtering yields no providers, it notifies the user and falls back to showing unavailable providers. Documentation and tests were updated to document and validate the new behavior.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant SessionRegistry
    participant Config
    participant ProviderStore
    participant UI as vim.ui.select

    User->>SessionRegistry: trigger provider switch
    SessionRegistry->>ProviderStore: fetch available providers
    ProviderStore-->>SessionRegistry: list (installed + not_installed)
    SessionRegistry->>Config: read provider_switcher.hide_unhealthy_providers
    alt hide_unhealthy_providers == true
        SessionRegistry->>SessionRegistry: filter out not_installed providers
        alt filtered list empty
            SessionRegistry->>User: notify "No healthy providers found. Showing unavailable providers."
            SessionRegistry->>SessionRegistry: include not_installed providers
        end
    else hide_unhealthy_providers == false
        SessionRegistry->>SessionRegistry: include not_installed providers
    end
    SessionRegistry->>UI: present provider list
    UI-->>User: show selection prompt
    User-->>UI: choose provider
    UI-->>SessionRegistry: return selected provider
    SessionRegistry->>ProviderStore: activate chosen provider
Loading

Possibly related PRs

  • carlos-algms/agentic.nvim#132: Modifies SessionRegistry.select_provider and provider-selection behavior; directly related to the selection logic adjusted here.
  • carlos-algms/agentic.nvim#133: Introduces the provider picker/switch flow that this change augments by adding the hide_unhealthy_providers option.

Poem

🐰 I hop to the switcher, tail all a-twitch,
Hide the frail providers or show them with a twitch,
If none stay healthy, I trumpet a cheer,
Then reveal the rest so choices appear,
Hopping onward, config snug and rich.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description check ✅ Passed The description is related to the changeset, describing the core functionality of filtering inactive providers based on configuration.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title 'feat: add option for hiding inactive provider' accurately describes the main change: introducing a configuration option to hide unhealthy/unavailable providers in the provider switcher UI.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@lua/agentic/session_registry.lua`:
- Around line 109-111: When Config.provider_switcher.hide_unhealthy_providers is
true the code may call vim.ui.select with an empty sorted_providers (variable
sorted_providers) when none of the provider commands are installed
(not_installed list), leaving users with no items; change the logic before
calling vim.ui.select in the function that builds sorted_providers so that if
sorted_providers is empty you fall back to using not_installed (so users see
providers tagged "✗ not installed") and/or call Logger.notify with a short
message explaining no healthy providers were found; update references to
Config.provider_switcher.hide_unhealthy_providers, sorted_providers,
not_installed, vim.ui.select and Logger.notify accordingly.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 2513ca62-d998-48e1-a4f0-684c362a9eae

📥 Commits

Reviewing files that changed from the base of the PR and between 7336e59 and 9b61508.

📒 Files selected for processing (4)
  • doc/agentic.txt
  • lua/agentic/config_default.lua
  • lua/agentic/session_registry.lua
  • lua/agentic/session_registry.test.lua

Comment thread lua/agentic/session_registry.lua
Copy link
Copy Markdown
Owner

@carlos-algms carlos-algms left a comment

Choose a reason for hiding this comment

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

Looks clean. Nice quality of life 👍🏻

Could you also please run timeout 5 nvim --headless -c "helptags doc/" -c "quit" to check if the new option gets its own tag?

Thanks.

Comment thread lua/agentic/session_registry.lua
carlos-algms added a commit that referenced this pull request Apr 26, 2026
## Summary

- Adds `actions/cache@v4` for `.local/bin/rg` and `.local/bin/fd` with
weekly-rotating keys (matches the nightly Neovim cache pattern at lines
161 of `pr-check.yml`)
- Authenticates the `api.github.com/.../releases/latest` calls with
`GITHUB_TOKEN` so we get the per-repo 1000/hr rate limit instead of the
shared 60/hr per-IP unauthenticated limit (this was causing the v0.11.5
`tar: gzip: stdin: not in gzip format` failure on PR #207 when the
unauth IP limit was hit and the API returned a JSON error in place of
the asset URL)
- Replaces `grep | cut | head` URL extraction with `jq` for cleaner JSON
parsing and proper failure modes (`curl -sfL` now exits non-zero on HTTP
errors instead of piping garbage into `tar`)
- Adds `permissions: contents: read` at the workflow level for
defense-in-depth
@carlos-algms carlos-algms changed the title add option for hiding inactive provider feat: add option for hiding inactive provider May 8, 2026
@carlos-algms
Copy link
Copy Markdown
Owner

Could you please have a look at the failing tests?

Are they passing locally on your machine?

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.

2 participants