fix(auth): set active_provider after hermes auth add qwen-oauth - #37580
Closed
AhmetArif0 wants to merge 1 commit into
Closed
fix(auth): set active_provider after hermes auth add qwen-oauth#37580AhmetArif0 wants to merge 1 commit into
AhmetArif0 wants to merge 1 commit into
Conversation
hermes auth add qwen-oauth called pool.add_entry() but never wrote to providers["qwen-oauth"] or set active_provider in auth.json. _model_section_has_credentials() checks get_active_provider() first; with active_provider unset and no api_key_env_vars configured for qwen-oauth, the setup wizard reported "No inference provider configured" even after a successful Qwen CLI OAuth login. Add _save_qwen_oauth_provider_state() in auth.py that writes a minimal provider-state entry (base_url, auth_file) and calls _save_provider_state() to set active_provider. Call it in auth_commands before pool.add_entry(). Runtime credential resolution continues to use the Qwen CLI credential file directly; auth.json is only used for provider detection. Mirrors the fix applied to openai-codex (NousResearch#37517), xai-oauth (NousResearch#37576), and google-gemini-cli (NousResearch#37579).
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.
Problem
hermes auth add qwen-oauthcalledpool.add_entry()but never wrote toproviders["qwen-oauth"]or setactive_providerinauth.json._model_section_has_credentials()checksget_active_provider()first. Withactive_providerunset and noapi_key_env_varsforqwen-oauth(
auth_type = oauth_external), the setup wizard reported "No inferenceprovider configured" even after a successful login.
Root cause
Same pattern as
openai-codex(#37517),xai-oauth(#37576), andgoogle-gemini-cli(#37579):pool.add_entry()only writes the credential-poolentry;
active_providerinauth.jsonis never set.Runtime credential resolution reads tokens from the Qwen CLI credential file via
resolve_qwen_runtime_credentials()— independent ofauth.json— so the agentitself worked. Only the setup-wizard detection was broken.
Fix
Add
_save_qwen_oauth_provider_state()inhermes_cli/auth.pythat writes aminimal provider-state entry (
base_url,auth_file) and calls_save_provider_state()(which setsactive_provider). Call it inauth_commandsbeforepool.add_entry().Test plan
test_auth_add_qwen_oauth_sets_active_providerpassestest_auth_commandstests pass