Skip to content

fix(auth): use _save_xai_oauth_tokens in auth_commands to set active_provider - #39015

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

fix(auth): use _save_xai_oauth_tokens in auth_commands to set active_provider#39015
teknium1 merged 1 commit into
mainfrom
hermes/hermes-e3d7b3c0

Conversation

@teknium1

@teknium1 teknium1 commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

hermes auth add xai-oauth now sets active_provider in auth.json after a successful OAuth login, so the setup wizard recognizes the provider instead of reporting "No inference provider configured".

Salvage of #37600 by @AhmetArif0 (cherry-picked onto current main, authorship preserved).

Root cause

The xai-oauth branch in auth_add_command() called pool.add_entry() directly with source="manual:xai_pkce", writing only a credential-pool entry — it never touched providers["xai-oauth"] or active_provider. _model_section_has_credentials() checks get_active_provider() first, so with it unset the wizard saw no configured provider despite a valid login.

Changes

  • hermes_cli/auth_commands.py: replace the hand-rolled pool.add_entry() with the canonical _save_xai_oauth_tokens() (which writes the provider singleton and sets active_provider via _save_provider_state), then load_pool() to seed the canonical loopback_pkce pool entry. Mirrors the openai-codex fix in fix(auth): align Codex OAuth persistence paths #37517 already on main.
  • New test test_auth_add_xai_oauth_sets_active_provider.

Validation

Before After
active_provider after login unset xai-oauth
providers["xai-oauth"] singleton not written written
pool entry source manual:xai_pkce loopback_pkce (canonical)
_model_section_has_credentials("xai-oauth") False True

E2E verified with isolated HERMES_HOME calling the real auth_add_command + _model_section_has_credentials. 47/47 test_auth_commands pass.

Infographic

xai-oauth-active-provider

…provider

hermes auth add xai-oauth called pool.add_entry() directly, writing only the
credential-pool entry (source "manual:xai_pkce") without touching
providers["xai-oauth"] or setting 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 OAuth login.

Use _save_xai_oauth_tokens() — the canonical path already called from the
hermes model xAI login flow — which writes providers["xai-oauth"]["tokens"]
(setting active_provider) and lets _seed_from_singletons seed the pool with
a "loopback_pkce" entry on the next load_pool() call.

Mirrors the fix applied to openai-codex in #37517.
@github-actions

github-actions Bot commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

🔎 Lint report: hermes/hermes-e3d7b3c0 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.

@teknium1
teknium1 merged commit 5f62ba8 into main Jun 4, 2026
23 checks passed
@teknium1
teknium1 deleted the hermes/hermes-e3d7b3c0 branch June 4, 2026 12:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants