Skip to content

fix(auth): set active_provider after hermes auth add qwen-oauth - #37602

Closed
AhmetArif0 wants to merge 1 commit into
NousResearch:mainfrom
AhmetArif0:fix/qwen-oauth-active-provider
Closed

fix(auth): set active_provider after hermes auth add qwen-oauth#37602
AhmetArif0 wants to merge 1 commit into
NousResearch:mainfrom
AhmetArif0:fix/qwen-oauth-active-provider

Conversation

@AhmetArif0

Copy link
Copy Markdown
Contributor

Problem

hermes auth add qwen-oauth called pool.add_entry() but never wrote to providers["qwen-oauth"] or set active_provider in auth.json. The setup wizard reported "No inference provider configured" even after a successful Qwen CLI OAuth login.

Root cause

Same pattern as openai-codex (#37517), xai-oauth (#37600), and google-gemini-cli (#37601): pool.add_entry() only writes the credential-pool entry; active_provider is never set.

Qwen OAuth tokens live in the Qwen CLI credential file (read by resolve_qwen_runtime_credentials()), not in auth.json. Runtime resolution works fine; only setup/status detection was broken.

Fix

Add _mark_qwen_oauth_active() in hermes_cli/auth.py: writes a minimal provider-state entry (base_url for display only) and calls _save_provider_state() to set active_provider.

The function deliberately does not copy the api_key — that lives in the Qwen CLI credential file and must not be duplicated in auth.json where it would become stale.

pool.add_entry() is retained so hermes auth list continues to show the entry.

Test plan

  • New test test_auth_add_qwen_oauth_sets_active_provider verifies active_provider is set, state contains only base_url (no api_key), and pool entry exists
  • All 47 test_auth_commands tests pass

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 oauth_external
providers, the setup wizard reported "No inference provider configured" even
after a successful Qwen CLI OAuth login.

Add _mark_qwen_oauth_active() in auth.py: writes a minimal provider state
entry (base_url for display only) and calls _save_provider_state() to set
active_provider. The function deliberately does not copy the api_key — that
lives in the Qwen CLI credential file managed by _save_qwen_cli_tokens /
resolve_qwen_runtime_credentials and must not be duplicated in auth.json
where it would become stale.

pool.add_entry() is retained so "hermes auth list" continues to show the entry.
Runtime credential resolution continues to use resolve_qwen_runtime_credentials.

Mirrors the fix applied to openai-codex (NousResearch#37517) and xai-oauth (NousResearch#37576).
@alt-glitch alt-glitch added type/bug Something isn't working P3 Low — cosmetic, nice to have area/auth Authentication, OAuth, credential pools comp/cli CLI entry point, hermes_cli/, setup wizard provider/qwen Qwen / Alibaba Cloud (OAuth) labels Jun 2, 2026
@teknium1

teknium1 commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Merged via #39011 — your commit was cherry-picked onto current main with your authorship preserved in git log (commit on main: cd68b8f). Thanks for the fix! Closing this one in favor of the rebased PR.

@teknium1 teknium1 closed this Jun 4, 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 P3 Low — cosmetic, nice to have provider/qwen Qwen / Alibaba Cloud (OAuth) type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants