llllleo9 couldn't add Grok: grok login --device-auth exited 0, and the
sign-in failed with "grok login finished without an account".
Grok Build 1.0.62 was run in a sandbox HOME. The stand-in auth.x.ai sat
behind an HTTPS_PROXY MITM, with its CA passed through
GROK_EXTRA_CA_BUNDLE, and sandbox-exec denied opening a browser. The CLI
takes email and user_id from the id_token's claims alone. With no email
claim (an xAI account signed in through X), it writes "email": null and
still prints "✓ Signed in". When Grok Build's own home is already signed
in, the plugin signs in beside it and demanded an email, so that sign-in
failed.
- An account is now told apart by its email, else its user_id, else the
token's sub. saved() and the refresh path's remember() use the same
account id.
- GROK_AUTH_PATH is now left out of the CLI's run. With it set, 1.0.62
keeps the sign-in at that file, and the home the plugin reads stays
empty (seen in the same sandbox). The login always runs with envFor(home)
now, not process.env.
- A login that finishes with nothing readable now says what grok said,
which file it read and what was there (no file, not JSON, no token,
or no account). It also points to "Use Grok Build's current sign-in".
Run:
- TMPDIR and HOME set to a scratch dir, bun test packages/grok: 47 pass,
0 fail. The six new login tests FAIL with 0.1.15's index.mjs.
- bun scripts/check.mjs grok: ✓.
- node --check and git diff --check are clean.
- The plugin was run against the real grok 1.0.62 and the stand-in x.ai,
with the CLI home already signed in:
- id_token without email: 0.1.16 returns success with accountId
"user-1". 0.1.15 returns "grok login finished without an account",
the reporter's message.
- GROK_AUTH_PATH set: 0.1.16 returns success, 0.1.15 fails the same way.
- login.test's "a login's link is still handed on" timed out at 5s in 2 of
10 runs alone, on 0.1.15's code too. That is #160, which another session
has taken; the data point was added there.
Not tried with a real xAI account: whether xAI's token for llllleo9's
account lacks the email claim, and whether their Grok Build was already
signed in.