Skip to content
Source
Sign inSign up
pingdotgg/t3code

[Bug]: Grok provider always reports auth "unknown" ("authentication could not be verified") even after its own ACP authenticate succeeds #7505

Closedkrutftw(GitHub profile, opens in a new tab) opened this issue 2 comments

What happened

With the Grok CLI (1.0.5) logged in to a grok.com subscription, T3 Code's Grok provider card shows a green dot but the detail text "Installed and ready, but authentication could not be verified." The cache file caches/grok.json has status: "ready" with auth: { status: "unknown" }, even though the health check's own ACP probe authenticated successfully. The user's first question was therefore "is my Grok subscription actually linked?" — it is, but T3 cannot say so.

Diagnosis

Grounded in the installed bundle (apps/server/dist/bin.mjs, //#region src/provider/Layers/GrokProvider.ts):

  • checkGrokProviderStatus runs grok --version (4 s bound) and then discoverGrokModelsViaAcp, which spawns grok agent stdio (env GROK_OAUTH2_REFERRER=t3code), performs ACP initialize → authenticate({ methodId }) → session/new, and reads availableModels. methodId is "xai.api_key" only when XAI_API_KEY is present in the provider environment, otherwise "cached_token" (//#region src/provider/acp/GrokAcpSupport.ts, resolveGrokAuthMethodId).
  • Every return branch of checkGrokProviderStatus — disabled, version-probe failure/timeout/non-zero, ACP failure/timeout, and the success branch — hard-codes auth: { status: "unknown" }. buildInitialGrokProviderSnapshot does the same. Nothing ever sets authenticated/unauthenticated for Grok, unlike the Cursor driver (parseCursorAboutOutput) or the Claude/Codex drivers.
  • So after a successful authenticate + session/new (which is what produced status: "ready" and the model list), the UI still reports that authentication could not be verified.

Evidence that the probe really did authenticate with the subscription session: the Grok CLI's own ~/.grok/logs/unified.jsonl for the pid spawned by T3's check records auth.json load result: found, auth_mode Oidc, is_expired false, auth_methods ['cached_token','grok.com'] default cached_token, has_external_api_key false, auth started method cached_token → cached_token handler set api_key (SessionToken) → session created; ~/.grok/models_cache.json shows auth_method: "session" from cli-chat-proxy.grok.com. grok models prints "You are logged in with grok.com."

Suggested fix (small): in the success branch of checkGrokProviderStatus, set auth: { status: "authenticated", type: <methodId>, label: methodId === "xai.api_key" ? "xAI API Key" : "Grok Subscription" } — the ACP authenticate result is already awaited there; and set unauthenticated when authenticate fails with an auth error, so the card can show the real state.

Steps to reproduce

  1. grok login --oauth (or any logged-in grok CLI), grok models → "You are logged in with grok.com."
  2. Start T3 Code with the Grok provider enabled (default instance, binaryPath: "grok", no environment vars).
  3. Open Settings → Providers → Grok (or read <T3 home>/caches/grok.json).
  4. Observe status: "ready", models listed, auth.status: "unknown", and the "authentication could not be verified" detail.

Version

0.0.34-nightly.20260819.1132 (commit 36f4314ab768).

Environment

Windows 11 Pro 10.0.26100, T3 Code (Nightly) desktop, grok CLI 1.0.5 (5115b46bc9) [stable], Node 24.11.1.

Evidence

# <T3 home>/caches/grok.json (trimmed)
{"displayName":"Grok","badgeLabel":"Early Access","enabled":true,"installed":true,"version":"1.0.5",
 "status":"ready","auth":{"status":"unknown"},
 "models":[{"slug":"grok-4.6"},{"slug":"grok-4.5"},{"slug":"grok-build"}], ...}

# server.trace.ndjson: checkGrokProviderStatus spans all exit Success (5.5-7.5 s), no Grok warnings logged

# ~/.grok/logs/unified.jsonl, pid spawned during the T3 probe (redacted)
... "AuthManager::new auth.json load result" found=true auth_mode=Oidc is_expired=false
... "auth: initialize() built auth_methods for ACP response" methods=[cached_token, grok.com] default=cached_token has_external_api_key=false has_cached_token=true
... "auth started" method=cached_token
... "auth: cached_token handler set api_key (SessionToken)"
... "session created" sid=01a018d1-… cwd=<home>

#6075 is about the grok-build slug being rejected by session/set_model; no existing issue covers the auth status. Not a duplicate.

Fix applied or workaround

None required — Grok threads work; this is cosmetic. (Do not "fix" it by adding XAI_API_KEY to the instance environment: that flips methodId to xai.api_key and bills the console.x.ai key instead of the subscription.)

Filed by

Claude (Fable 5) via Claude Code on the reporter's machine, at the reporter's request.

  1. Related report #7932 covers the same problem and adds useful evidence.

    This reports the same ready-plus-unknown Grok auth snapshot and the same web fallback text as issue #7505. Both concern a successful ACP probe, not a failed login. The Linux reproduction adds another affected OS but no separate cause or required behavior.

    I'm linking the report here before I close it as a duplicate during an automated pass. The source report and its attachments will remain available at #7932.

  2. Note

    🤖 Claude Fable 5.1 responding on behalf of Theo

    Fixed in #9154. Thank you for the detailed report, it made this straightforward to pin down.

    The health check no longer opens an ACP session. It runs grok --version, then grok models for login state, then a single ACP initialize for model metadata. No authenticate, so no surprise browser login. No session/new, so no MCP servers boot during a background check. Auth is now reported as authenticated or unauthenticated instead of always unknown, and a failed metadata probe degrades to a warning instead of persisting an error over a working install.

    Against Grok CLI 1.0.13 this returns in about a second. It will be in the next nightly.

Sign in to join this conversation.