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
+55
View File
@@ -1086,6 +1086,61 @@ test("#1201: the model quoting the banned-account ending with more text after ke
})
})
// kidgpt on X (11-16, Windows 11, Claude Code in VS Code, gemini-3.8-flash):
// Google's 403 VALIDATION_REQUIRED on a model call reaches agy 1.5.9 as
// "Verification Required" (CustomUserErrorMessageFromHTTPError), which it
// ends the reply with, and the client got that bare line as the answer.
const VERIFY = "\n⚠ Verification Required\n"
function agyLogOf(kit) {
const args = kit.acpSpawns.at(-1).args
return args[args.indexOf("--log-file") + 1]
}
test("agy's Verification Required ending fails the stream as a no-retry 403 that says how to verify", async () => {
await withKit({}, async (kit) => {
markerAgent(kit, [VERIFY.slice(0, 9), VERIFY.slice(9)])
const response = await kit.request(baseBody({ metadata: { user_id: "verify-end" },
messages: [{ role: "user", content: "hello" }] }))
const text = await response.text()
const error = sseError(text)
assert.equal(error.type, "permission_error")
assert.equal(error.status, 403)
assert.equal(error.noRetry, true)
assert.match(error.message, /this Google account needs to be verified: open the Antigravity app, or run `agy` in a terminal/)
assert.ok(!text.includes("⚠"), "no banner reaches the client")
})
})
test("agy's Verification Required ending carries the link agy logged, as a non-stream HTTP 403", async () => {
const link = "https://accounts.google.com/signin/continue?sarp=1&scc=1&plt=AKgnsbv"
await withKit({}, async (kit) => {
kit.defaultPrompt = async (agent) => {
fs.appendFileSync(agyLogOf(kit), `E1116 21:03:11.120000 6120 errorreport.go:224] agent executor error: generating and executing: PERMISSION_DENIED (code 403): Verify your account to continue. validation_url: ${link.replace(/&/g, "\\u0026")}\n`)
await agent.text(VERIFY)
return { stopReason: "end_turn" }
}
const response = await kit.request(baseBody({ metadata: { user_id: "verify-json" },
messages: [{ role: "user", content: "hello" }], stream: false }))
const body = await response.json()
assert.equal(response.status, 403)
assert.equal(response.headers.get("x-should-retry"), "false")
assert.equal(body.error.type, "permission_error")
assert.ok(body.error.message.includes(`this Google account needs to be verified: open ${link} in a browser`), body.error.message)
})
})
test("the model quoting the Verification Required ending with more text after keeps it", async () => {
const chunks = ["agy said\n⚠ Verification", " Required\nThat line is agy's, not mine."]
await withKit({}, async (kit) => {
markerAgent(kit, chunks)
const parsed = await readSse(await kit.request(baseBody({ metadata: { user_id: "verify-quoted" },
messages: [{ role: "user", content: "what did agy print?" }] })))
assert.equal(parsed.error, null)
assert.equal(replyText(parsed), chunks.join(""))
})
})
test("#1151: the model quoting the 429 ending with more text after keeps it", async () => {
const chunks = ["agy ended with\n⚠ RESOURCE_EXHAUSTED (code 429): Resource has", " been exhausted (e.g. check quota).\nThat line is agy's, not mine."]
await withKit({}, async (kit) => {
+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"), "")
})