From 52e31c4a1fdb857d673c6e92c90ef4a6c1294c68 Mon Sep 17 00:00:00 2001 From: yetone Date: Thu, 12 Nov 2026 07:07:29 +0800 Subject: [PATCH] agy-cli 0.1.21: text that names a notice tag it never closes is routed by who wrote it, not refused (PolarizingLight on X) A tool turn answered with text beside the result that merely mentions a notice tag it does not close (" whose own text quotes a reminder tag (the wrapper then leaves a stray close tag), a hook's context, or the user typing the tag. Now: a wrapped developer or system message is a notice (broken up with cloak), a user's text steers and is replayed whole, other roles ride as a notice. A notice that opens and is cut short ("not a complete...") is still turned away. Not found: a real failing request. magpie's logs on this Mac hold none, and Codex's rollouts here hold no tag of this kind after a tool output, so the exact bytes the reporter's thread carries are inferred, not seen. Run: test/compat.mjs (new case red on 0.1.20, green now), agy-cli.test.mjs whole on mote (12 pass). Broken by hand: old index.mjs makes the new case fail. Not tried: a real ChatGPT desktop thread against agy-cli. --- packages/agy-cli/index.mjs | 25 +++++++++++++++++++++++-- packages/agy-cli/package.json | 2 +- packages/agy-cli/test/compat.mjs | 26 ++++++++++++++++++++++++++ 3 files changed, 50 insertions(+), 3 deletions(-) diff --git a/packages/agy-cli/index.mjs b/packages/agy-cli/index.mjs index abc6fae..aa6049e 100644 --- a/packages/agy-cli/index.mjs +++ b/packages/agy-cli/index.mjs @@ -4027,7 +4027,26 @@ function inspectToolTurn(results, body) { } const rest = withoutNotices.replace(SYSTEM_REMINDER_RE, "").trim() if (UNCLOSED_NOTICE_RE.test(rest)) { - throw new UnsupportedContent("text beside a live tool_result; send it after the tool response completes") + // Text that merely names a notice tag it does not close (a developer + // message that quotes , a user typing one, a hook's + // context) is routed by who wrote it, never refused and never dropped. + // A notice that opens and is cut short is still turned away. + const wrapped = /^]*)?>\s*([\s\S]*?)\s*<\/system-reminder>$/.exec(trimmed) + if (!wrapped && PROTOCOL_NOTICE_START_RE.test(rest)) { + // a protocol notice that starts and is cut short: not a mention + throw new UnsupportedContent("text beside a live tool_result; send it after the tool response completes") + } + if (wrapped || message.role === "system" || message.role === "developer") { + // the gateway's wrapper for a developer message, or a system one + const inner = wrapped ? wrapped[1] : rest + if (extractQueuedPrompt(inner) !== null || userInterruption.test(inner)) userSteered = true + else if (!isNoise(inner)) notices.push(cloak(inner)) + } else if (message.role === "user") { + userSteered = true + } else if (!isNoise(rest)) { + notices.push(cloak(rest)) + } + continue } if (message.role === "system" || message.role === "developer") { if (extractQueuedPrompt(rest) !== null || userInterruption.test(rest)) { @@ -4042,7 +4061,9 @@ function inspectToolTurn(results, body) { notices.some((item) => hookStoppedContinuation.test(item))) { userSteered = true } else { - throw new UnsupportedContent("text beside a live tool_result; send it after the tool response completes") + // text from neither the user nor the system (an assistant message + // that landed after the result): the model is told it, as a notice + notices.push(cloak(rest)) } } } diff --git a/packages/agy-cli/package.json b/packages/agy-cli/package.json index 1edc524..7143c17 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.20", + "version": "0.1.21", "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/compat.mjs b/packages/agy-cli/test/compat.mjs index 7c13da8..79bd318 100644 --- a/packages/agy-cli/test/compat.mjs +++ b/packages/agy-cli/test/compat.mjs @@ -246,3 +246,29 @@ test("execOnce still collects synchronous and asynchronous spawn failures", asyn }, mode) } }) + +test("text that names a notice tag it never closes is routed by its writer, not refused", () => { + const call = result("call_shell", "shell", "done") + const wrap = text => ({ type: "text", text: `\n${text}\n` }) + // the gateway wraps a Codex developer message, which here quotes a reminder tag + const developer = wrap("Hook context: output is wrapped in blocks.") + const nested = wrap("earlier note and more") + for (const block of [developer, nested]) { + const inspected = inspectToolTurn([call], bodyFor([call.block, block])) + assert.equal(inspected.userSteered, false, "a developer message is not the user steering") + const text = inspected.results[0].result.content.map(part => part.text || "").join("\n") + assert.ok(text.includes("earlier note") || text.includes("Hook context"), "the developer text reaches the model") + } + // a user typing the tag name steers, and the replay carries the words + const typed = { type: "text", text: "why does the part.text || "").join("") + assert.ok(replay.includes("why does the"), "the user's words are replayed") + } + // a notice that opens and is cut short is still turned away + assert.throws(() => inspectToolTurn([call], bodyFor([call.block, { type: "text", text: "cut short" }])), /text beside a live tool_result/) +})