From 3db6dcfa8587600f8f10d34bbb8b77de3304da98 Mon Sep 17 00:00:00 2001 From: yetone Date: Sat, 14 Nov 2026 20:56:03 +0800 Subject: [PATCH] agy-cli 0.1.47: agy 1.5.9's bare 429 ending fails the turn (#1151) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit agy 1.5.9 ends a turn whose every retry got 429 with the upstream status itself, "⚠ RESOURCE_EXHAUSTED (code 429): Resource has been exhausted (e.g. check quota).", instead of "⚠ Agent execution terminated due to error.". That line was not one of AGENT_ERROR_MARKERS, so the bridge sent it to the client as the model's answer and ended the turn as a success (jx407's Codex turns showed the error text as the reply). It is now a marker like the others: held while it could still be one, dropped when it ends the prompt, and the turn fails through #agentError -> #formatAgentError as rate_limit_error ("Antigravity quota or rate limit reached: RESOURCE_EXHAUSTED (code 429): ..."), or as the system-prompt case when the cloak says the prompt turns away. Text after it, the model quoting the line, keeps it as text, as for the other markers. This fixes how the 429 is reported, not why Antigravity answered 429 to the reporter's Codex requests; that is still open on #1151. Run (WSL magpie-desktop, Node 22, Bun 1.4.2, HOME=$(mktemp -d)): - packages/agy-cli `bun test`: 21 pass, 0 fail (agy-cli.test.mjs runs repeat-batch.mjs and the rest). - node --test --test-name-pattern="1151|1136" test/repeat-batch.mjs: 4/4 ok. With the new marker line deleted from index.mjs: the endings test goes red (1 fail), the quoting test stays green. - bun scripts/check.mjs agy-cli, scripts/bumped.mjs origin/main: ok. Not tried: a real agy 1.5.9 turn that ends in 429. --- packages/agy-cli/index.mjs | 4 +++- packages/agy-cli/package.json | 2 +- packages/agy-cli/test/repeat-batch.mjs | 16 +++++++++++++++- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/packages/agy-cli/index.mjs b/packages/agy-cli/index.mjs index b1a7c0b..762ce4d 100644 --- a/packages/agy-cli/index.mjs +++ b/packages/agy-cli/index.mjs @@ -111,11 +111,13 @@ const STEP_USAGE_SAME_GEN_WAIT_MS = 75 const STEP_USAGE_POLL_MS = 25 // agy reports an upstream failure as an ordinary message chunk followed by end_turn. // 1.5.8 words a connection that failed every retry, and a spent credit -// balance, on their own (#1136). +// balance, on their own (#1136). 1.5.9 ends a turn whose every retry got 429 +// with the upstream status itself (#1151). const AGENT_ERROR_MARKERS = [ "\n⚠ Agent execution terminated due to error.\n", "\n⚠ There was a network issue connecting to the server, please try again.\n", "\n⚠ Your AI credits balance is too low to continue.\n", + "\n⚠ RESOURCE_EXHAUSTED (code 429): Resource has been exhausted (e.g. check quota).\n", ] const AGENT_ERROR_CORES = AGENT_ERROR_MARKERS.map((marker) => marker.trim()) const CREDITS_CORE = AGENT_ERROR_CORES[2] diff --git a/packages/agy-cli/package.json b/packages/agy-cli/package.json index 97538a9..bfc63ad 100644 --- a/packages/agy-cli/package.json +++ b/packages/agy-cli/package.json @@ -1,6 +1,6 @@ { "name": "@magpie-community/opencode-agy-cli-auth", - "version": "0.1.46", + "version": "0.1.47", "description": "Magpie/OpenCode model provider that connects your local agy CLI through the Agent Client Protocol (agy acp), so Antigravity subscription models run through the real CLI", "type": "module", "main": "./opencode.mjs", diff --git a/packages/agy-cli/test/repeat-batch.mjs b/packages/agy-cli/test/repeat-batch.mjs index 3c3a611..1752a0c 100644 --- a/packages/agy-cli/test/repeat-batch.mjs +++ b/packages/agy-cli/test/repeat-batch.mjs @@ -894,13 +894,16 @@ test("#1136: agy's attempt banners before a retry that works never reach the cli } }) -test("#1136: agy 1.5.8's network and credit endings fail the turn", async () => { +test("#1136, #1151: agy's network, credit and 429 endings fail the turn", async () => { for (const [chunks, want, kind] of [ // Turn B: one attempt, then agy gives up. The attempt's detail names why. [[EOF_ATTEMPT(1) + "\n" + NETWORK], /EOF/, "api_error"], // Turn C: the ending alone, split mid-marker. [[NETWORK.slice(0, 20), NETWORK.slice(20)], /network issue connecting/, "api_error"], [["partial\n⚠ Your AI credits ", "balance is too low to continue.\n"], /credits balance is too low/, "rate_limit_error"], + // #1151: agy 1.5.9's ending after every retry got 429, split mid-marker. + [["partial\n⚠ RESOURCE_EXHAU", "STED (code 429): Resource has been exhausted (e.g. check quota).\n"], /quota or rate limit reached: RESOURCE_EXHAUSTED \(code 429\)/, "rate_limit_error"], + [["\n⚠ RESOURCE_EXHAUSTED (code 429): Resource has been exhausted (e.g. check quota).\n"], /quota or rate limit reached/, "rate_limit_error"], ]) { await withKit({}, async (kit) => { markerAgent(kit, chunks) @@ -914,6 +917,17 @@ test("#1136: agy 1.5.8's network and credit endings fail the turn", async () => } }) +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) => { + markerAgent(kit, chunks) + const parsed = await readSse(await kit.request(baseBody({ metadata: { user_id: "exhausted-quoted" }, + messages: [{ role: "user", content: "what did agy print?" }] }))) + assert.equal(parsed.error, null) + assert.equal(replyText(parsed), chunks.join("")) + }) +}) + test("#1136: the model quoting an attempt banner or the network ending mid-line keeps it", async () => { const chunks = ["agy printed `⚠ API error (attempt 1): EOF` and later", " `⚠ There was a network issue connecting to the server, please try again.` too."] await withKit({}, async (kit) => {