Skip to content

fix(cli): resolve runtime credentials for current model#17590

Closed
liuhao1024 wants to merge 1 commit into
NousResearch:mainfrom
liuhao1024:fix/issue-17574-runtime-target-model
Closed

fix(cli): resolve runtime credentials for current model#17590
liuhao1024 wants to merge 1 commit into
NousResearch:mainfrom
liuhao1024:fix/issue-17574-runtime-target-model

Conversation

@liuhao1024

Copy link
Copy Markdown
Contributor

Summary

  • Pass the current CLI model into runtime credential resolution.
  • Keep fallback credential resolution aligned with the fallback model being selected.
  • Add regression coverage for mid-session /model switches that require a non-default api_mode.

Root cause

HermesCLI._ensure_runtime_credentials() re-resolved provider credentials without passing the active model. Providers whose transport depends on the selected model could therefore recompute api_mode from stale persisted config instead of the current /model selection.

Fix

Forward target_model=self.model during normal runtime resolution and target_model=_fb_model when falling through to an auth fallback.

Regression coverage

Added tests/cli/test_runtime_credentials.py to assert that _ensure_runtime_credentials() passes the active model to resolve_runtime_provider() and invalidates the cached agent when routing changes.

Testing

  • scripts/run_tests.sh tests/cli/test_runtime_credentials.py -q
  • scripts/run_tests.sh tests/cli/test_runtime_credentials.py tests/hermes_cli/test_runtime_provider_resolution.py -q

Closes #17574

@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 Apr 29, 2026
@liuhao1024

Copy link
Copy Markdown
Contributor Author

Closing this to avoid a competing duplicate PR since #17596 already resolves issue #17574 with a more comprehensive fix.

@liuhao1024 liuhao1024 closed this May 1, 2026
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.

_ensure_runtime_credentials() silently resets api_mode, breaking providers that require non-default transport

2 participants