Skip to content

fix(auxiliary): add xAI OAuth route to auth refresh provider resolver - #60397

Closed
isheng-eqi wants to merge 2 commits into
NousResearch:mainfrom
isheng-eqi:clean/xai-oauth
Closed

fix(auxiliary): add xAI OAuth route to auth refresh provider resolver#60397
isheng-eqi wants to merge 2 commits into
NousResearch:mainfrom
isheng-eqi:clean/xai-oauth

Conversation

@isheng-eqi

Copy link
Copy Markdown
Contributor

What does this PR do?

_auth_refresh_provider_for_route() maps auto-routed base URLs to providers (#59837) but missed xAI OAuth. The sibling _resolve_provider_from_client() already maps api.x.ai. This adds the same mapping so auto-routed xAI calls can refresh their short-lived OAuth token.

Related Issue

Fixes sibling path of #59837 (#20832).

Type of Change

  • Bug fix

Changes Made

  • agent/auxiliary_client.py: Add xAI OAuth mapping to _auth_refresh_provider_for_route()
  • tests/agent/test_auxiliary_xai_auth_route.py: Route mapping + passthrough tests

How to Test

  1. Configure xAI OAuth as an auxiliary provider
  2. Trigger an auto-routed auxiliary call through xAI
  3. Verify expired tokens are refreshed instead of failing

_auth_refresh_provider_for_route() maps auto-routed client base URLs to
provider names so auth refresh works for auto→provider routes (NousResearch#20832).
The resolver covered Copilot, Codex, Anthropic, and Nous — but missed
xAI OAuth. The sibling _resolve_provider_from_client() function already
maps api.x.ai to xai-oauth; add the same mapping here so auto-routed xAI
calls can refresh their short-lived OAuth token.

Refs: NousResearch#59837, NousResearch#20832
@alt-glitch alt-glitch added type/bug Something isn't working comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint area/auth Authentication, OAuth, credential pools provider/xai xAI (Grok) P3 Low — cosmetic, nice to have labels Jul 7, 2026
@teknium1

Copy link
Copy Markdown
Contributor

Thanks for the focused xAI OAuth regression report.

Automated hermes-sweeper review found that current main already provides this recovery path:

  • agent/auxiliary_client.py:3360 maps auto-routed api.x.ai clients to the xai-oauth credential pool.
  • agent/auxiliary_client.py:3402-3406 refreshes the pool credential and evicts stale clients on auth failure; agent/auxiliary_client.py:7016-7057 retries the auxiliary call after that recovery.
  • This behavior was added by f6a2ba62611dd92c659df683060174d14425913a (fix(auxiliary): detect xAI OAuth 403 bad-credentials as auth error) and shipped in v2026.6.5.

Closing as implemented on main.

@teknium1 teknium1 closed this Jul 15, 2026
@teknium1 teknium1 added the sweeper:implemented-on-main Sweeper: behavior already present on current main label Jul 15, 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/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint P3 Low — cosmetic, nice to have provider/xai xAI (Grok) sweeper:implemented-on-main Sweeper: behavior already present on current main type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants