fix(cli): empty credential pool entries no longer authenticate provider (#28140)#28190
Closed
Sisuthros wants to merge 1 commit into
Closed
fix(cli): empty credential pool entries no longer authenticate provider (#28140)#28190Sisuthros wants to merge 1 commit into
Sisuthros wants to merge 1 commit into
Conversation
outsourc-e
approved these changes
May 18, 2026
outsourc-e
left a comment
Contributor
There was a problem hiding this comment.
Validated locally on clean upstream/main worktree. Regression tests passed (4 passed). Correct fix for empty credential_pool entries; no security concerns.
Collaborator
ebc4c39 to
5a92b38
Compare
Fixes NousResearch#28140. When a user removed an API-key env var (e.g. `MINIMAX_CN_API_KEY`) from their `.env`, an empty `credential_pool` array left behind in `~/.hermes/auth.json` (e.g. `"minimax-cn": []`) still caused the provider to appear authenticated in the `/model` picker. Root cause was a presence-check on the dict key only: ```python if store and hermes_id in store.get("credential_pool", {}): has_creds = True ``` `"minimax-cn": []` satisfies `hermes_id in {...}` even though the list is empty, so `has_creds` flipped to True with zero actual credentials. Fix: pull the list out and gate on its truthiness instead — matches the intent ("any usable credential in the pool?") and is consistent with how `agent/credential_pool.py` itself treats empty lists elsewhere. Tests added (`tests/hermes_cli/test_credential_pool_empty.py`): - Empty pool entry → provider hidden (the regression) - Populated pool entry → provider shown (no over-correction) - Missing pool key entirely → provider hidden - Env-var set + empty pool → env wins, provider shown All 4 pass with the fix, the regression test fails without it.
5a92b38 to
b515e94
Compare
3 tasks
Contributor
|
Closing as superseded by #28312. Triage notes (high confidence): Thanks for the contribution — the underlying problem this PR addresses has been resolved by the linked PR on current main. If you believe this was closed in error, please comment and we'll reopen. (Bulk-closed during a CLI PR triage sweep.) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #28140.
When the user removes an API-key env var (e.g.
MINIMAX_CN_API_KEY) from.env, an emptycredential_poolarray left behind in~/.hermes/auth.json(e.g."minimax-cn": []) still caused the provider to appear authenticated in the/modelpicker.Root cause
In
hermes_cli/model_switch.py::list_authenticated_providers, the auth-store fallback checked only whether the provider key existed in the pool dict, not whether the value held any actual credentials:"minimax-cn": []satisfieshermes_id in {...}even though the list is empty, sohas_credsflipped toTruewith zero usable credentials, and the provider appeared in the/modelpicker.Fix
Pull the list out and gate on its truthiness:
This matches the intent ("any usable credential in the pool?") and is consistent with how
agent/credential_pool.pyitself treats empty lists elsewhere.Test plan
tests/hermes_cli/test_credential_pool_empty.py:test_empty_credential_pool_does_not_authenticate_provider— the regression casetest_populated_credential_pool_does_authenticate_provider— sanity check: real entries still worktest_missing_credential_pool_key_does_not_authenticate_provider— no entry at all → hiddentest_env_var_still_authenticates_even_with_empty_pool— env-var path still winstests/hermes_cli/test_credential_pool_empty.pyis new and self-contained)