Skip to content

agy-cli 0.1.114: a turn left empty after agy's own tool was turned away is asked again, not a silent stop (#1464) - #1468

Open
wangbingnan136 wants to merge 3 commits into
magpie-community:mainfrom
wangbingnan136:codex/agy-cli-denied-tool-empty-turn
Open

wangbingnan136 wants to merge 3 commits into
magpie-community:mainfrom
wangbingnan136:codex/agy-cli-denied-tool-empty-turn

Conversation

@wangbingnan136

Copy link
Copy Markdown

Fixes #1464.

Summary

A step whose only output was calls to agy's own tools, turned away by the bridge, ended the turn with no text and no tool call. emptyEnding didn't count it as empty (no thinking, no invalid-output retry), so the client got a finished reply that said nothing.

 #onRequest session/request_permission → reject_once
+  turn.deniedSinceCall = turn.deniedSeen = true
+  logBridgeEvent(..., "permission_denied", toolCall.kind)
 emptyEnding(stopReason)
-  thoughtSinceCall || invalidOutput
+  thoughtSinceCall || invalidOutput || deniedSinceCall || emptyAsked
+  (stopReason end_turn, or refusal after a denial)
 #runTurn: the one ask in the same session
-  EMPTY_REPLY_PROMPT
+  denied ? DENIED_REPLY_PROMPT : EMPTY_REPLY_PROMPT
 still empty → AgentTurnError "… (a tool of agy's own was turned away: only the client's tools run here) …"

agy told the model "Do not attempt to circumvent this denial … or accessing the same target resource". So the ask says that the same action is allowed through the mcp_ide-tools_* tools. It names no product (the words sent upstream name nobody). emptyAsked also makes a bare empty answer to the bridge's own ask an error, where before it passed as a reply.

test/testkit.mjs gains agent.requestPermission(toolCall, options), so the fake agy can ask before one of its own tools, as agy does.

Evidence

New tests in test/repeat-batch.mjs, modelled on #1464's turn:

  • Before (upstream index.mjs via AGY_BRIDGE_TEST_INDEX): both fail. The response is end_turn with nothing, and no error.
    After: pass
    • with and without thinking: read_file is still denied, the turn is asked once more in the same session, and the client gets the Read call
    • empty again after the ask, bare or after another denial: an error naming the turned-away tool, asked once only
  • the existing empty-ending tests still pass
  • bun test ./agy-cli.test.mjs, bun scripts/check.mjs, bun scripts/bumped.mjs upstream/main: pass

Not verified against a real agy: whether the model follows the ask after agy's own denial text.

Merge Danger

Door: two-way.

Blast Radius: narrow. Only turns that end with nothing said after a denial, or after the bridge's own ask, change, from a silent empty reply to one more prompt or an error. Permissions are answered exactly as before.

Version: 0.1.113 → 0.1.114.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

agy-cli: a turn that ends after agy's own tool is turned away stops silently, as a finished empty reply

2 participants