Claude Code. Any Model. The most powerful AI coding agent now speaks every language.
fix(grok-subscription): retry a token-host blip before the CLI credential
Jack Rudenkoe40d109b6d63
diff --git a/packages/cli/src/providers/grok/grok-credentials.ts b/packages/cli/src/providers/grok/grok-credentials.tsindex 78ea13ef..5373aea0 100644--- a/packages/cli/src/providers/grok/grok-credentials.ts+++ b/packages/cli/src/providers/grok/grok-credentials.ts@@ -519,15 +519,16 @@ export async function resolveGrokAccessToken(): Promise<string> {try {return await GrokOAuth.getInstance().getToken();} catch (error) {- // Fall through to the CLI credential rather than failing outright: a- // user who has BOTH should not be blocked by one being broken. If there- // is no CLI credential either, the throw below carries the real message.- // A transient or network failure keeps its own classification: wrapping- // it terminal would stop a working subscription on a token-host blip.- if (!readGrokCredential()) {- if (isTransientCredentialError(error) || classifyConnectionError(error)) throw error;- throw terminal(`${(error as Error).message}`);- }+ // A transient or network failure is rethrown FIRST, whatever else is on+ // disk: the claudish login is fine and its token host only blinked, so+ // the request retries. Falling through would sign with a possibly stale+ // ~/.grok/auth.json, and wrapping it terminal would stop a working+ // subscription.+ if (isTransientCredentialError(error) || classifyConnectionError(error)) throw error;+ // Otherwise fall through to the CLI credential rather than failing+ // outright: a user who has BOTH should not be blocked by one being+ // broken. With no CLI credential either, this throw carries the message.+ if (!readGrokCredential()) throw terminal(`${(error as Error).message}`);}}