Skip to content

fix: require non-empty credential pool entries in provider listing#26934

Closed
pinguarmy wants to merge 1 commit into
NousResearch:mainfrom
pinguarmy:fix/credential-pool-empty-entry-check
Closed

fix: require non-empty credential pool entries in provider listing#26934
pinguarmy wants to merge 1 commit into
NousResearch:mainfrom
pinguarmy:fix/credential-pool-empty-entry-check

Conversation

@pinguarmy

Copy link
Copy Markdown

Summary

The list_authenticated_providers() function in model_switch.py has a bug where empty credential pool entries (e.g. \kimi-coding-cn\: []) are treated as valid authentication, causing phantom providers to appear in the /model picker.

The credential check only verified that a provider ID existed as a key in the credential_pool dict — it did not check whether the entry had actual credentials.

Reproduction

  1. Configure a provider (e.g. Kimi CN) via .env → credential_pool entry created in auth.json
  2. Remove the API key from .env → credential_pool still has \kimi-coding-cn\: []
  3. Run /model in TUI → kimi still appears in the provider list even though no key exists

Fix

Changed the credential pool check to require non-empty entries:

pool_creds = store["credential_pool"].get(hermes_id, [])
if pool_creds:  # require non-empty
    has_creds = True

This is both corrective (the stale empty entry should be cleaned up) and defensive (prevents future empty entries from causing phantom providers).

Test Plan

  • Providers with actual credentials in credential_pool still appear
  • Empty [] or missing entries no longer appear as authenticated providers
  • All existing tests pass

Closes #—

The  credential pool check only verified
that a provider ID existed as a key in the credential_pool dict, not
that the entry had actual credentials. An empty list [] (leftover from
removed env vars like KIMI_CN_API_KEY) was treated as 'authenticated',
causing phantom providers to appear in the /model picker.

Fix: check that pool_creds is non-empty before marking the provider as
having credentials.
@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/cli CLI entry point, hermes_cli/, setup wizard area/auth Authentication, OAuth, credential pools labels May 16, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Overlaps with #20705, which addresses the same empty credential pool entry issue in list_authenticated_providers() section 1 (follow-up to merged #19669 that fixed sections 2/2b). Please coordinate.

@pinguarmy

Copy link
Copy Markdown
Author

Thanks @alt-glitch — I see #20705 was submitted earlier and uses the proper pattern consistent with the sections 2/2b fix from #19669. That's the better approach. I'll close this PR in favour of #20705. Appreciate the pointer!

@pinguarmy

Copy link
Copy Markdown
Author

Closing in favour of #20705 which addresses the same issue with a more thorough approach using load_pool().has_credentials().

@pinguarmy

Copy link
Copy Markdown
Author

This fix is already present in the current codebase. model_switch.py:1386 uses .get(hermes_id) which returns falsy for empty lists, preventing phantom providers from appearing in the /model picker.

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

Labels

area/auth Authentication, OAuth, credential pools comp/cli CLI entry point, hermes_cli/, setup wizard P2 Medium — degraded but workaround exists type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants