Skip to content

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

Merged
teknium1 merged 1 commit into
mainfrom
hermes/hermes-f8da4407
Jun 4, 2026
Merged

fix(auth): set active_provider after hermes auth add qwen-oauth#39011
teknium1 merged 1 commit into
mainfrom
hermes/hermes-f8da4407

Conversation

@teknium1

@teknium1 teknium1 commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Summary

hermes auth add qwen-oauth now sets active_provider in auth.json, so the setup wizard and status commands detect the provider after a Qwen OAuth login.

Root cause: the qwen-oauth branch of auth_add_command called pool.add_entry() but never wrote active_provider, so the setup wizard reported "No inference provider configured" even after a successful login. Same pattern fixed for openai-codex in #37517.

Changes

  • hermes_cli/auth.py: new _mark_qwen_oauth_active() — writes a minimal provider-state entry (base_url only) and calls _save_provider_state() to set active_provider. Deliberately does NOT copy the api_key; Qwen OAuth tokens live in the Qwen CLI credential file read by resolve_qwen_runtime_credentials(), so storing them in auth.json would just create a stale duplicate.
  • hermes_cli/auth_commands.py: call _mark_qwen_oauth_active(creds) in the qwen-oauth path. pool.add_entry() retained so hermes auth list still shows the entry.
  • Test: test_auth_add_qwen_oauth_sets_active_provider.

Validation

Before After
active_provider after auth add qwen-oauth None qwen-oauth
api_key in providers state n/a not stored (lives in Qwen CLI file)
pool entry for hermes auth list present present
  • 47/47 test_auth_commands pass.
  • E2E (isolated HERMES_HOME, real auth_add_command): active_provider goes None → qwen-oauth, state contains base_url only, no token leak into the providers block, pool entry preserved, get_active_provider() resolves correctly.

Salvages #37602 by @AhmetArif0 (cherry-picked onto current main, authorship preserved).

Infographic

oauth-login-now-sticks

@github-actions

github-actions Bot commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

🔎 Lint report: hermes/hermes-f8da4407 vs origin/main

ruff

Total: 0 on HEAD, 0 on base (➖ 0)

🆕 New issues: none

✅ Fixed issues: none

Unchanged: 0 pre-existing issues carried over.

ty (type checker)

Total: 9792 on HEAD, 9792 on base (➖ 0)

🆕 New issues: none

✅ Fixed issues: none

Unchanged: 5085 pre-existing issues carried over.

Diagnostics are surfaced as warnings — this check never fails the build.

@alt-glitch alt-glitch added type/bug Something isn't working comp/cli CLI entry point, hermes_cli/, setup wizard area/auth Authentication, OAuth, credential pools provider/qwen Qwen / Alibaba Cloud (OAuth) P3 Low — cosmetic, nice to have labels Jun 4, 2026
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 (#37517) and xai-oauth (#37576).
@teknium1
teknium1 force-pushed the hermes/hermes-f8da4407 branch from 6d33396 to 033f6e7 Compare June 4, 2026 12:46
@teknium1
teknium1 merged commit cd68b8f into main Jun 4, 2026
23 checks passed
@teknium1
teknium1 deleted the hermes/hermes-f8da4407 branch June 4, 2026 12:58
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