fix(auth): use _save_xai_oauth_tokens in auth_commands to set active_provider - #39015
Merged
Conversation
…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.
Contributor
🔎 Lint report:
|
2 tasks
Open
19 tasks
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.
hermes auth add xai-oauthnow setsactive_providerin 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()calledpool.add_entry()directly withsource="manual:xai_pkce", writing only a credential-pool entry — it never touchedproviders["xai-oauth"]oractive_provider._model_section_has_credentials()checksget_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-rolledpool.add_entry()with the canonical_save_xai_oauth_tokens()(which writes the provider singleton and setsactive_providervia_save_provider_state), thenload_pool()to seed the canonicalloopback_pkcepool entry. Mirrors the openai-codex fix in fix(auth): align Codex OAuth persistence paths #37517 already on main.test_auth_add_xai_oauth_sets_active_provider.Validation
active_providerafter loginxai-oauthproviders["xai-oauth"]singletonmanual:xai_pkceloopback_pkce(canonical)_model_section_has_credentials("xai-oauth")FalseTrueE2E verified with isolated HERMES_HOME calling the real
auth_add_command+_model_section_has_credentials. 47/47test_auth_commandspass.Infographic