Skip to content

Add xAI Grok subscription OAuth#773

Draft
pridemusvaire wants to merge 4 commits into
RooCodeInc:developfrom
pridemusvaire:feat/xai-grok-subscription-oauth
Draft

Add xAI Grok subscription OAuth#773
pridemusvaire wants to merge 4 commits into
RooCodeInc:developfrom
pridemusvaire:feat/xai-grok-subscription-oauth

Conversation

@pridemusvaire

Copy link
Copy Markdown
Contributor

Summary

  • Operators can connect SuperGrok / eligible X Premium+ via xAI device-code OAuth from Settings → Models and the setup inference step (alongside the existing XAI_API_KEY path).
  • Tokens are stored encrypted on the control plane; public status and poll responses never return access/refresh tokens.
  • Inference gateway xai-oauth strategy prefers a refreshed OAuth bearer for xai/ models and falls back to XAI_API_KEY when only the key is configured.

Test plan

  • Unit tests for device-code start/poll success and failure, encrypted status (no tokens), refresh safety margin, disconnect
  • Gateway tests: OAuth bearer preferred, API-key fallback, disconnected fail-closed
  • Catalog/status flags: xaiSubscriptionConnected / xaiApiKeyConnected
  • check-types:fast + lint + knip via pre-push
  • Manual device-code connect with a SuperGrok account (no live credentials in CI)

Operators can connect SuperGrok / eligible X Premium+ via device-code OAuth from Settings and setup; the inference gateway prefers a refreshed OAuth bearer for xai/ models and falls back to XAI_API_KEY.
@roomote-roomote

roomote-roomote Bot commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

Review blocked: the fork source branch could not be fetched in this checkout, so the current head cannot be verified against repository context. See task

  • apps/web/src/components/settings/XaiConnectDialog.tsx:80: Cancelling and quickly reopening the dialog can leave the first poll loop alive. Once the second flow sets the shared ref back to true, the old loop resumes and can save its old device code's account, replacing the account the operator intended to connect. Use a per-flow cancellation token or verify the active device code before each poll/result.

Reviewed 17fc504

Assert disconnect deletes the encrypted secret and sandbox runtime env emits R_INFERENCE_GATEWAY_XAI without shipping tokens when only SuperGrok OAuth is connected.
@pridemusvaire
pridemusvaire marked this pull request as draft July 25, 2026 03:14
Inject SuperGrok access tokens as XAI_API_KEY for non-gateway OpenCode (API-key shaped provider), and add refresh-failure, worker rebase, and command token-strip coverage.
Bring the feature branch up to date with the latest base branch.
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.

1 participant