gateway: Google's suspension of an Antigravity or agy-cli plugin account rests it as restricted (plugins#1148)

googleSuspended read Google's 403 "disabled in this account for violation
of Terms of Service" only for an account whose Agent is antigravity or
gemini, the built-ins. An account of the community Antigravity plugin, or
of agy-cli, has Agent "plugin", so its suspension was an unknown failure:
a minute's rest, doubling to ten, and asked (and refused) again every few
minutes for good. plugins#1148's reporters saw a 403 followed by a dozen
more tries. googleSignIn now also takes a plugin account whose plugin
provider is antigravity or agy-cli; such an account rests two hours as
restricted, and the last one left is answered by magpie without asking
Google, as the built-in's is.

Run (mote, base 0b8c4bfc3): go test -run TestAntigravitySuspended
./internal/gateway ok. Broken by hand: with routing.go from origin/main,
TestAntigravitySuspendedIsGooglesAlone is red on both plugin cases
("other, want restricted"). Another plugin's same words (kiro), another
403 and a 400 from the plugin stay failOther.

Not run: the whole gateway package (mote load 31, mica 111 at the time);
it runs after the push. Not tried with a real suspended account.
Not changed: antigravityTurnedAway, antigravityForeseen and
antigravityRound still check Account.Agent only; filed separately.
This commit is contained in:
yetone
2026-11-14 23:42:28 +08:00
parent 0b8c4bfc34
commit 171fce511a
2 changed files with 32 additions and 6 deletions
+13 -2
View File
@@ -107,12 +107,18 @@ func TestAntigravitySuspendedAloneRests(t *testing.T) {
}
}
// Only Google's suspension of a Google sign-in is read so: another 403 from
// Antigravity, and the same words from a key's relay, fail as before.
// Only Google's suspension of a Google sign-in is read so, the built-in's or
// a Google plugin's: another 403 from Antigravity, and the same words from a
// key's relay or another plugin, fail as before.
func TestAntigravitySuspendedIsGooglesAlone(t *testing.T) {
ag := candidate{p: provider.Provider{ID: "antigravity", Account: &provider.Account{Agent: "antigravity", User: "u"}}}
gem := candidate{p: provider.Provider{ID: "gemini", Account: &provider.Account{Agent: "gemini", User: "u"}}}
key := candidate{p: provider.Provider{ID: "relay", Key: "k"}}
// the community plugins that sign in to Google (plugins#1148), and
// another plugin, whose same words are its own
agPlugin := candidate{p: provider.PluginForTest("antigravity", "antigravity")}
agy := candidate{p: provider.PluginForTest("agy-cli", "agy-cli")}
other := candidate{p: provider.PluginForTest("kiro", "kiro")}
said := "Antigravity: This service has been disabled in this account for violation of Terms of Service. Please submit an appeal to continue using this product."
for _, c := range []struct {
c candidate
@@ -126,6 +132,11 @@ func TestAntigravitySuspendedIsGooglesAlone(t *testing.T) {
{ag, 403, `{"error":{"code":403,"message":"The caller does not have permission","status":"PERMISSION_DENIED"}}`, failOther},
{ag, 400, antigravitySuspended, failOther},
{key, 403, antigravitySuspended, failOther},
{agPlugin, 403, antigravitySuspended, failRestricted},
{agy, 403, said, failRestricted},
{agPlugin, 403, `{"error":{"code":403,"message":"The caller does not have permission","status":"PERMISSION_DENIED"}}`, failOther},
{agPlugin, 400, antigravitySuspended, failOther},
{other, 403, antigravitySuspended, failOther},
} {
if got := failureOf(c.c, c.status, []byte(c.body)); got != c.want {
t.Errorf("%s %d %s: %s, want %s", c.c.p.ID, c.status, c.body, got, c.want)
+19 -4
View File
@@ -757,15 +757,30 @@ var googleToS = lazyre.New(`(?i)disabled in this account for violation of Terms
// refused, every ten minutes for good. Another vendor's same words are its
// own, and aren't read so.
func googleSuspended(p provider.Provider, status int, body []byte) bool {
if status != http.StatusForbidden {
return false
}
if a := accountAgent(p); a != "antigravity" && a != "gemini" {
if status != http.StatusForbidden || !googleSignIn(p) {
return false
}
return googleToS.Match(wordsOf(body))
}
// googleSignIn says p is signed in to Google's Code Assist with a Google
// account: the built-in Antigravity or Gemini CLI account, or the
// community plugin's that does the same, the Antigravity plugin's (OAuth)
// or agy-cli's (Google's own agy program). A plugin account's Agent is
// "plugin", so a suspended plugin account was read as an unknown failure
// and asked again every few minutes (plugins#1148).
func googleSignIn(p provider.Provider) bool {
switch accountAgent(p) {
case "antigravity", "gemini":
return true
}
switch p.PluginProvider() {
case "antigravity", "agy-cli":
return true
}
return false
}
// isWorkBuddy is whether p is a WorkBuddy account, either build's: the
// built-in's, or the WorkBuddy plugin's.
func isWorkBuddy(p provider.Provider) bool {