agy-cli 0.1.81: agy's "Verification Required" is a 403 that says how to verify

kidgpt on X (Windows 11, Claude Code in VS Code, gemini-3.8-flash) got
the bare text "Verification Required" as the model's answer. agy 1.5.9
turns Google's 403 VALIDATION_REQUIRED into that line
(utils.CustomUserErrorMessageFromHTTPError, read from the binary) and
ends the turn with "\n⚠ Verification Required\n", which the bridge
didn't know, so it went out as a successful reply.

- The ending is a sixth agent-error marker. The turn fails as a no-retry
  403 permission_error (stream error event and HTTP 403 with
  x-should-retry: false, as #1201's banned account), in the words
  magpie's gateway reads as Google verification ("this Google account
  needs to be verified: open <link> in a browser"), so magpie rests the
  account as needing verification and shows the link.
- The link comes from agy's log for the turn (validation_link /
  validation_url, or the "in your browser to continue:" line) when there
  is one; otherwise the message says to open the Antigravity app or run
  agy signed in to the account.
- Sibling: agy's eligibility refusal for the same cause ("Please verify
  your account in your browser to continue:\n<url>", "Verification
  required. Please complete verification…", from
  AuthStatus.EligibilityError / IneligibilityFromResult) got the
  region/VPN advice and lost the URL in agyRefusal (models, sign-in
  probe). It now gets the same verify message with agy's link.
- A model quoting the line with more text after it keeps its text.

Run (mote, temp HOME): node --test test/repeat-batch.mjs test/usage.mjs
95 pass; bun test packages/agy-cli 37 pass 0 fail (smoke.mjs included);
bun scripts/check.mjs agy-cli ok. Windows (xiaomi-gpu, win-run):
repeat-batch, usage, windows-nc, platform 120 pass 0 fail.
Red on the old code: with origin/main's index.mjs and usage.mjs the two
new ending tests fail (a 200 reply) and the agyRefusal test gets the VPN
advice.
Not tried: a real account Google wants verified; the exact log line agy
writes for a VALIDATION_REQUIRED turn (the fixture follows Google's JSON
error's validation_url).
This commit is contained in:
yetone
2026-11-16 23:04:00 +08:00
parent 92de181056
commit 83a677177b
7 changed files with 155 additions and 9 deletions
+30 -1
View File
@@ -6,7 +6,7 @@ import fs from "node:fs/promises"
import os from "node:os"
import path from "node:path"
import { test } from "node:test"
import { agyRefusal, createUsageReader, fetchUsage, parseUsageReport, quotaUserAgent, readQuotaDirect } from "../usage.mjs"
import { agyRefusal, createUsageReader, fetchUsage, parseUsageReport, quotaUserAgent, readQuotaDirect, verifyLinkIn } from "../usage.mjs"
import http from "node:http"
import { modelsInGroup, storeCatalogRows } from "../model-ids.mjs"
import { forgetStoredSignIn } from "../signin.mjs"
@@ -990,3 +990,32 @@ test("agyRefusal: Google turning the account away, never a network failure or ag
"This service has been disabled in this account for violation of Terms of Service.",
]) assert.equal(agyRefusal(other), "", other)
})
// Google's VALIDATION_REQUIRED at agy's eligibility check, in agy 1.5.9's
// words (AuthStatus.EligibilityError, IneligibilityFromResult): the link
// agy prints goes to the user whole, in the words magpie's gateway reads as
// a verification (provider.verifyAdvice, verifyLink), never the VPN advice.
test("agyRefusal: an account Google wants verified gets the link agy printed, or where to verify", () => {
const link = "https://accounts.google.com/signin/continue?sarp=1&scc=1&continue=https://developers.google.com/gemini-code-assist/auth/auth_success_gemini&plt=AKgnsbv"
const linked = `Error: Eligibility check failed: Verify your account to continue.\n\nPlease verify your account in your browser to continue:\n${link}\n`
const said = agyRefusal(linked)
assert.ok(said.includes(`this Google account needs to be verified: open ${link} in a browser`), said)
assert.doesNotMatch(said, /VPN/)
assert.equal(verifyLinkIn(linked.replace(/\n/g, "\r\n")), link)
for (const bare of [
"Error: Eligibility check failed: Verification required. Please complete verification in your browser to continue.",
"Error: Eligibility check failed: Verify your account to continue.",
]) {
const why = agyRefusal(bare)
assert.match(why, /this Google account needs to be verified: open the Antigravity app, or run `agy` in a terminal/, bare)
assert.doesNotMatch(why, /https:/)
}
})
test("verifyLinkIn: Google's validation link from a logged error, validation_link first, https only", () => {
const body = '{"error":{"code":403,"message":"Verify your account to continue.","status":"PERMISSION_DENIED","details":[{"@type":"type.googleapis.com/google.rpc.ErrorInfo","reason":"VALIDATION_REQUIRED","metadata":{"validation_url":"https://accounts.google.com/signin/continue?sarp=1\\u0026x=2","validation_link":"https://accounts.google.com/v?a=1\\u0026b=2"}}]}}'
assert.equal(verifyLinkIn(body), "https://accounts.google.com/v?a=1&b=2")
assert.equal(verifyLinkIn(body.replace(/,"validation_link":"[^"]+"/, "")), "https://accounts.google.com/signin/continue?sarp=1&x=2")
assert.equal(verifyLinkIn('validation_url: "http://example.com/x"'), "")
assert.equal(verifyLinkIn("Verification Required"), "")
})