Commit Graph
2 Commits
Author SHA1 Message Date
yetone d3a0be6dda provider: Google's verify link is the one Gemini CLI opens, read whole from any body (pppuuu)
pppuuu (Discord) tested an Antigravity model, got Google's 403 "Verify your
account to continue." with a link, and opening the link gave Google's own
"400. That's an error. The server cannot process the request because it
is malformed."

What magpie showed was checked first, and it was Google's validation_url
whole: a realistic VALIDATION_REQUIRED body (ErrorInfo metadata with
validation_url, validation_error_message, validation_url_link_text, a
google.rpc.Help detail, & written raw and as &) sent through the
Antigravity model test (TestAntigravityModelTest) and through the gateway
to an agent (TestVerifyLinkWhole) shows the URL with every parameter on
the old code too. Google's own Antigravity flow gives the same 400 to
many accounts (discuss.ai.google.dev 119780: cleared google.com cookies,
Chrome, or removing Antigravity from third-party access fixed it).

What differed from Google's own client, and is fixed here:
- Gemini CLI (classifyValidationRequiredError) opens the google.rpc.Help
  detail's link first, past a "Learn more" one, then the ErrorInfo's
  validation_link, then validation_url. magpie took validation_url first
  and never read validation_link. It now takes them in Gemini CLI's order.
- Metadata was read as map[string]string, so one non-string value made the
  whole body unreadable and the link was lost; values are read one by one.
- A message magpie already put the link in, passed on again as a JSON
  error body (a Remote magpie's, the gateway's), has & as &; the raw
  read stopped at the \ and found no link. It is read from the decoded
  words now.

Tests: TestVerificationLinkWhole and TestVerificationLinkAsGeminiCLI
(provider), TestVerifyLinkWhole and a verify case in
TestAntigravityModelTest (gateway).

Run on mote: go test -run 'TestVerification|TestAPIError' ./internal/provider
ok; go test -run 'TestAntigravityModelTest|TestVerify|Restricted'
./internal/gateway ok; go vet (darwin, linux, windows) of internal/provider
and go vet internal/gateway ok; go test ./internal/provider: ok (178s).
Broken by hand: with the old test.go, TestVerificationLinkWhole (escaped
read-back) and TestVerificationLinkAsGeminiCLI (Help link) are red; the
gateway cases pass on the old code too, which is the evidence the shown
link was already whole.
Not tried: a real account Google wants verified (none here), and
pppuuu's exact body and link, which aren't known; whether Google's Help
link and validation_url ever differ is not known.
2026-11-05 17:50:33 +08:00
yetone e665d70b56 gateway: an Antigravity account Google wants verified says so, and rests (marsxxl: Antigravity 返回「Verify your account to continue」403) — Cloud Code Assist refuses such an account with a 403 whose details say VALIDATION_REQUIRED, a validation_url in their metadata (as pi-ai's google-validation reads it); magpie passed on only the message, and every reconnect went back to the account Google had stopped. Now provider.Verification knows the refusal (the reason, or its words) and APIError adds what to do: open the link, when it's https, in a browser signed in to that account, or else the Antigravity app (or Gemini CLI), then try again. The account rests half an hour as failVerify ("needs verification", 账号需验证) — the last one left too, which rested never — and for a minute the agent's retries get the same error from magpie without asking Google. The Routing page shows the rest with a Verify link and "It's verified — try it again", which lifts it (POST /api/gateway/unrest, Server.Unrest); an answer lifts it as before. Tested with fake upstreams in a sandbox HOME: with a link and without, held retries not sent on, a group falling back past it; the exact body marsxxl got isn't known 2026-09-28 20:56:33 +08:00