Since about 18:43 on 11-14 Google's Antigravity backend answers 429
RESOURCE_EXHAUSTED to requests whose system instruction holds certain
agents' identity lines, though the account has quota and the same
request with another prompt passes. Tried on a real account
(gemini-3-flash), each line alone in the system instruction:
- refused now: "You are Hermes Agent", Hermes' earlier persona
"…an intelligent AI assistant created by Nous Research" (also as
"You're …"), "You are OpenCode" / "You are opencode", Codex CLI's
"You are a coding agent running in the Codex CLI", and pi's "You are
a coding assistant running inside pi".
- pass as written: Codex GPT-6's prompt, Claude Code, Gemini CLI, Qwen
Code, Cline, Kilo, goose, Amp, Droid, Kimi, Aider, Cursor.
The cloak in antigravity and agy-cli (and the antigravity-cloak
middleware) now rewords each refused line the smallest way that passes:
"You are" -> "You're" for Hermes, OpenCode and Codex CLI, "created by"
-> "built by" for Hermes' earlier persona, "running inside pi" ->
"running within pi". The hint shown with a refusal names the agent
(new pi, OpenCode and Codex CLI hints; Hermes' hint covers both
personas).
agy-cli (@Lmohn39, pi 1.5.0 via agy 1.5.9, hydrogen): when agy prints
its retry banner for a refused 429, agy-cli waited while agy retried
the same refused prompt without end, so pi hung. The turn now fails at
once with the 429 and the existing "this is not a quota" explanation,
the agy process is stopped and dropped from the pool. A 503 banner
still waits as before.
Run:
- root `bun test` with HOME=$(mktemp -d) on mica (mote was over its 18
cores): 8820 pass, 20 skip, 0 fail, exit 0.
- real account through the patched loader, gemini-3-flash 5/5 each:
pi 1.5.0's full default prompt (built from its dist/core/system-prompt.js),
Hermes current and earlier personas, both OpenCode first lines, Codex
CLI's prompt, Codex GPT-6's prompt. claude-sonnet-4-6: pi 5/5.
Broken by hand:
- the old agy-cli index.mjs makes the new Lmohn39 test red ("still
waiting after 5s").
- dropping the pi line from TURNED_AWAY turns 6 cloak tests red.
Not tried: a real agy 1.5.9 turn on hydrogen showing the banner (the
banner's wording is the one agy-cli already matched); pi itself end to
end through agy-cli.
97 lines
5.5 KiB
JavaScript
97 lines
5.5 KiB
JavaScript
// cloak.mjs is a copy of packages/antigravity's TURNED_AWAY, cloak and hint
|
||
// (#980) and its REWORDED (#1028): these fail when the two packages stop
|
||
// agreeing.
|
||
import { expect, test } from "bun:test"
|
||
import { REWORDED, TURNED_AWAY, cloak, hint, outgoing, turnsAway } from "./cloak.mjs"
|
||
import { _internal as antigravity } from "../antigravity/index.mjs"
|
||
|
||
const ZW = ""
|
||
|
||
const samples = [
|
||
"x-anthropic-billing-header: cc_version=2.1.0.abc; cc_entrypoint=cli; cch=1a2b3;",
|
||
"You are a Claude agent, built on Anthropic's Claude Agent SDK.",
|
||
"You are Codex, an agent based on GPT-5. You are running as a coding agent.",
|
||
"You are Codex, a coding agent based on GPT-5.",
|
||
"You are Hermes Agent, an intelligent AI assistant created by Nous Research.",
|
||
"RFC 2119 keywords: MUST, REQUIRED, SHOULD, RECOMMENDED, MAY, OPTIONAL.\n\nYou are omp.",
|
||
"Two: RFC 2119 KEYWORDS: must, required, should, recommended, may, optional. and x-anthropic-billing-header: x",
|
||
"RFC 2119 keywords: MUST, REQUIRED,\r\nSHOULD, RECOMMENDED, MAY, OPTIONAL.\r\n",
|
||
"<conventions>\nRFC 2119\nkeywords:\tMUST, REQUIRED, SHOULD, RECOMMENDED, MAY,\u00a0OPTIONAL.\n</conventions>",
|
||
"You are Hermes Agent, an intelligent\nAI assistant created by Nous Research.",
|
||
"RFC 2119 keywords: MUST,REQUIRED,SHOULD,RECOMMENDED,MAY,OPTIONAL.",
|
||
"You are Hermes Agent, built by Nous Research.",
|
||
"You are OpenCode, a coding agent that helps users with software engineering tasks.",
|
||
"You are opencode, an interactive CLI tool that helps users with software engineering tasks.",
|
||
"You are OpenCode, the best coding agent on the planet.",
|
||
"You are a coding agent running in the Codex CLI, a terminal-based coding assistant. Codex CLI is an open source project led by OpenAI. You are expected to be precise, safe, and helpful.",
|
||
"You are a coding assistant running inside pi, a coding agent harness. Help users inspect files, run commands, and modify code.",
|
||
"Codex's GPT-6 prompt goes as written: You are Codex, an agent based on GPT-6.",
|
||
"You're Hermes Agent, an intelligent AI assistant created by Nous Research.",
|
||
"Nothing to see here; Claude Agent SDK alone is fine.",
|
||
"",
|
||
]
|
||
|
||
test("every turned-away line is reworded, with no invisible character in it", () => {
|
||
for (const s of samples) {
|
||
const out = cloak(s)
|
||
expect(out).not.toMatch(/[\u00ad\u200b-\u200f\u2060-\u2064]/)
|
||
if (turnsAway(s)) {
|
||
expect(out).not.toBe(s)
|
||
expect(turnsAway(out)).toBe(false)
|
||
} else {
|
||
expect(out).toBe(s)
|
||
}
|
||
}
|
||
expect(cloak("RFC 2119 keywords: MUST, REQUIRED, SHOULD, RECOMMENDED, MAY, OPTIONAL.")).toBe(
|
||
"RFC 2119 key words: MUST, REQUIRED, SHOULD, RECOMMENDED, MAY, OPTIONAL.",
|
||
)
|
||
})
|
||
|
||
test("a turned-away line wrapped or widened by white space is reworded too", () => {
|
||
for (const s of [samples[7], samples[8], samples[9]]) {
|
||
expect(turnsAway(s)).toBe(true)
|
||
expect(cloak(s)).not.toBe(s)
|
||
expect(turnsAway(cloak(s))).toBe(false)
|
||
}
|
||
expect(hint(samples[8])).toContain("oh-my-pi (omp)")
|
||
expect(turnsAway(samples[10])).toBe(false)
|
||
})
|
||
|
||
test("agy-cli and antigravity reword and explain the same lines", () => {
|
||
for (const line of [...TURNED_AWAY, ...samples.filter((s) => turnsAway(s)).map((s) => s.replace(/[A-Za-z0-9]{3,}/g, (w) => w[0] + ZW + w[1] + ZW + w.slice(2)))]) {
|
||
expect(antigravity.turnsAway(line)).toBe(true)
|
||
expect(cloak(line)).toBe(antigravity.cloak(line))
|
||
expect(hint(line)).toBe(antigravity.hint(line))
|
||
}
|
||
for (const s of samples) {
|
||
expect(turnsAway(s)).toBe(antigravity.turnsAway(s))
|
||
expect(cloak(s)).toBe(antigravity.cloak(s))
|
||
expect(hint(s)).toBe(antigravity.hint(s))
|
||
}
|
||
})
|
||
|
||
const DSH = "Tokens prefixed with @ are paths the user explicitly referenced. Relative paths resolve from the workspace root; absolute paths identify files or directories on the host. A trailing slash marks a directory: list it when its contents matter. Anything else is a file: use the read tool when its contents are needed, and do not claim to have inspected it before reading. @\"...\" quotes a path containing spaces."
|
||
|
||
// the system text antigravity sends for s (its shape() runs outgoing on it)
|
||
const antigravitySends = (s) =>
|
||
antigravity.shape({ systemInstruction: { parts: [{ text: s }] }, contents: [] }, "gemini-3-flash", "", "").systemInstruction.parts[0].text
|
||
|
||
test("DeepSeek Harness's @-path paragraph goes reworded, the rest as written (#1028)", () => {
|
||
const sys = "You are DeepSeek Harness.\n\n" + DSH + "\n\nBe brief."
|
||
expect(outgoing(sys)).toBe("You are DeepSeek Harness.\n\nWhen the user writes @ followed by a path, they are pointing at that file or folder. Relative paths start at the workspace root; absolute paths are host paths. A path ending in a slash is a folder, so list it if its contents matter; otherwise it is a file, so open it with the read tool before relying on it. Paths with spaces appear as @\"...\".\n\nBe brief.")
|
||
expect(outgoing("Tokens prefixed with @ are paths. Be brief.")).toBe("Tokens prefixed with @ are paths. Be brief.")
|
||
const both = outgoing("x-anthropic-billing-header: cc\n" + DSH)
|
||
expect(both).not.toContain("anthropic")
|
||
expect(both).toContain("When the user writes @ followed by a path")
|
||
})
|
||
|
||
test("agy-cli and antigravity send the same system text, reworded", () => {
|
||
for (const [from, to] of REWORDED) {
|
||
expect(outgoing(from)).toBe(to)
|
||
expect(antigravitySends(from)).toBe(to)
|
||
}
|
||
for (const s of [...samples.filter(Boolean), DSH, "Lead.\n" + DSH + "\n" + DSH, "x-anthropic-billing-header: cc\n" + DSH]) {
|
||
expect(outgoing(s)).toBe(antigravitySends(s))
|
||
}
|
||
})
|