agy-cli: a test that Claude Code's prompt reaches agy with no turned-away line (#1151)

niyezaimenglima on X (Windows, Claude Code through agy-cli): a 429
RESOURCE_EXHAUSTED with quota left, while Grok Build on the same models
works. Same case as KevinXC5's #1151 run, which still matched Claude
Code's "You are an interactive agent ..." line in agy's system
instruction on 0.1.58. 0.1.60 (baeb95a4) moves the client's prompt into
the first turn; this pins Claude Code's own head, the CLI's and the Agent
SDK's identity line with the billing line and the interactive-agent line:
nothing in agy's system instruction, and nothing turnsAway() matches in
the turn ("You're Claude Code, ...", billing line dropped).

Run on mica, HOME=$(mktemp -d), AGY_BRIDGE_STORED_SIGNIN=skip:
packages/agy-cli smoke ALL OK (357 checks). Broken by hand: systemAppend
forced on (0.1.59's route) makes all four new checks BAD.

Not tried: a real Antigravity request from Claude Code (no usable agy
account here), nor Windows.
This commit is contained in:
yetone
2026-11-15 13:44:43 +08:00
parent baeb95a43e
commit 2523b43a59
+22
View File
@@ -1375,6 +1375,28 @@ for (const [title, tools, want, name] of [
check("split error marker and quota map to rate_limit_error", error?.type === "rate_limit_error" && error.message.includes("quota exhausted") && textOf(events) === "", JSON.stringify({ error, text: textOf(events) }))
}
// #1151 (KevinXC5; niyezaimenglima on X, Windows): Claude Code's own
// opening lines, its CLI's and its Agent SDK's, got a 429 with quota left.
// By default none of it reaches agy's system instruction, and in the first
// turn no line Antigravity turns away goes as written.
{
const { turnsAway } = await import("../cloak.mjs")
const heads = {
cli: "You are Claude Code, Anthropic's official CLI for Claude.",
sdk: "You are Claude Code, Anthropic's official CLI for Claude, running within the Claude Agent SDK.",
}
for (const [name, head] of Object.entries(heads)) {
const system = `x-anthropic-billing-header: cc_version=2.1.325; cc_entrypoint=cli; cch=1;\n${head}\n\nYou are an interactive agent that helps users with software engineering tasks. CC-${name}`
await readSSE(await callFetch({ model, system, messages: [{ role: "user", content: `claude code ${name} turn` }] }))
const init = inits().at(-1)
const text = lastOf("user").text
check(`#1151 Claude Code's ${name} prompt stays out of agy's system instruction`, init.systemAppend == null, JSON.stringify(init.systemAppend))
check(`#1151 Claude Code's ${name} prompt goes in the turn with no line Antigravity turns away`,
text.includes(`CC-${name}`) && text.includes("You're Claude Code, Anthropic's official CLI for Claude") &&
!text.includes("x-anthropic-billing-header") && !turnsAway(text), JSON.stringify(text))
}
}
// #980: the system lines Antigravity turns away are reworded before agy
// sends them, in the session instructions, in the prompt when agy can't take
// them, and in a later system message; a 429 to such a prompt is not a quota.