Skip to content

fix(auth): share xAI OAuth root store across profiles - #44604

Closed
tontoko wants to merge 1 commit into
NousResearch:mainfrom
tontoko:fix/xai-oauth-profile-shared-auth
Closed

fix(auth): share xAI OAuth root store across profiles#44604
tontoko wants to merge 1 commit into
NousResearch:mainfrom
tontoko:fix/xai-oauth-profile-shared-auth

Conversation

@tontoko

@tontoko tontoko commented Jun 12, 2026

Copy link
Copy Markdown

Summary

  • Route xAI OAuth reads, writes, and auth-store locks through the shared root auth.json when running from named profiles.
  • Keep stale profile-local xai-oauth singleton/pool state from shadowing the canonical root credentials.
  • Add regression coverage for profile fallback, global-root writes, and terminal refresh quarantine from profile workers.

Test Plan

  • scripts/run_tests.sh tests/agent/test_credential_pool.py tests/hermes_cli/test_auth_profile_fallback.py tests/hermes_cli/test_auth_xai_oauth_provider.py tests/hermes_cli/test_xai_oauth_pkce_token_exchange.py tests/run_agent/test_codex_xai_oauth_recovery.py tests/agent/test_auxiliary_client_xai_oauth_recovery.py (252 passed)
  • Manual filtered status check for profiles test-writer, frontend-engineer, and code-reviewer: xAI OAuth status logged in and runtime credential resolution used /home/hirakitomohiko/.hermes/auth.json for both read/write routing. Token values were not printed.

Source kanban follow-through: t_ada9abd3 / t_0276f271.

@liuhao1024

Copy link
Copy Markdown
Contributor

Verification review — reviewed this PR's diff in detail (auth store isolation for xAI OAuth across named profiles).

What I checked:

  • _xai_oauth_read_auth_file_path / _xai_oauth_write_auth_file_path correctly resolve to the global-root auth.json when it has runtime tokens, falling back to profile-local otherwise
  • _auth_store_lock now takes an auth_file parameter and uses per-path lock holders via _auth_lock_holder_for_path — prevents cross-file lock contention
  • _load_provider_state special-cases xai-oauth to prefer the global state when it has runtime tokens (prevents stale profile copies from shadowing live tokens)
  • read_credential_pool skips per-provider shadowing for xai-oauth entries from the global pool
  • write_credential_pool routes xai-oauth writes to the global auth file
  • _save_auth_store test guard prevents accidental writes to the real ~/.hermes/auth.json during test runs
  • Test test_xai_oauth_terminal_refresh_clears_global_auth_from_profile verifies the full profile → global quarantine path

Verdict: Clean. The read/write path asymmetry (global-canonical for xai-oauth, profile-local for everything else) is consistent across all 6 touch points. Lock scoping is correct.

@alt-glitch alt-glitch added type/bug Something isn't working P3 Low — cosmetic, nice to have area/auth Authentication, OAuth, credential pools labels Jun 12, 2026
@tontoko tontoko closed this Jun 12, 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 P3 Low — cosmetic, nice to have type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants