fix: clear stale api_key when switching custom providers - #8571
fix: clear stale api_key when switching custom providers#8571yiminglin-ai wants to merge 1 commit into
Conversation
|
Thanks for the focused regression fix. The underlying legacy named-custom-provider case remains valid on current main. Problems
Suggested changes
Automated hermes-sweeper review. |
GottZ
left a comment
There was a problem hiding this comment.
This was generated by AI during triage.
Summary
Four PRs address or reference stale endpoint credentials during provider switches. #8571 covers the remaining named-custom-to-no-key-custom path, while #49360, #49362, and merged #49380 address switching away from custom providers, with #49380 implementing the broad shared-helper solution.
Related pull requests
- #8571
related— (+8/-4) — salvage and merge: the diff correctly removes a stale model.api_key when a selected named custom provider has no key and adds a focused regression assertion. The contributor keep_open review confirms that the bug remains on current main, but the implementation and test must be relocated from hermes_cli/main.py to the current model_setup_flows.py path. - #49360 [closed]
related— (+260/-17) — merged via #49380: this comprehensive shared-helper implementation clears api_key, legacy api, and api_mode across CLI, web, gateway, and auxiliary provider-switch paths. It remains relevant as the source implementation cherry-picked with preserved authorship into the merged consolidation PR. - #49362 [closed]
related— (+240/-0) — superseded by #49380: it fixes the stale in-memory Nous rewrite plus OpenRouter and generic API-key-provider paths, but #49380 covers the same cases and the wider provider-switch class through a shared helper. - #49380 [merged]
related— (+260/-17) — merged reference implementation: it centralizes endpoint-credential cleanup and applies it across approximately thirteen non-custom provider-switch paths, including the stale Nous in-memory-config case. Its diff does not add the named-custom-provider no-key cleanup covered by #8571.
Duplicates
#49360 and #49380 are materially the same comprehensive implementation because #49360 was cherry-picked into #49380; #49362 overlaps their Nous, OpenRouter, and generic API-key-provider subset. #8571 is not a duplicate because it covers the distinct named-custom-to-no-key-custom transition.
Suggested consolidation
Salvage and merge #8571 after relocating its implementation and regression test to the current model_setup_flows.py structure, completing the named-custom-provider gap left by merged #49380. Keep #49360 and #49362 closed as merged-via/superseded-by #49380; no reopening is warranted.
Cross-PR triage: Reviewed 4 pull requests and 0 issues in this complex. Each diff was read against this issue; Assessment working set: 58 kB of PR diffs, 11 kB of issue/PR text, 5 kB of discussion (6 comments), 1 verify verdict. verdicts reflect diff content, not PR titles. Part of an automated triage batch.
Summary
model.api_keywhen switching to a saved custom provider that does not define an API keyapi_modebehavior intactProblem
_model_flow_named_custom()already clears staleapi_modewhen the selectedcustom_providersentry does not specify one, but it leaves a stalemodel.api_keybehind.That means switching from an authenticated custom endpoint to a no-key local endpoint can preserve the old key in
config.yaml, which is incorrect state and can affect subsequent requests.Testing
/Users/yiminglin/.hermes/hermes-agent/venv/bin/pytest -q tests/hermes_cli/test_custom_provider_model_switch.pyHERMES_HOMEreproducer showingmodel.api_keyis removed when selecting a no-key provider