ACP server (agy_acp_server 1.1.1 and 1.4.1): PreToolUse `overwrite` is never applied, and plugin `hooks.json` files are not loaded

What I found (source reading of the shipped ACP server, not a live transcript)

I run Antigravity headlessly through its ACP server (agy_acp_server, agentInfo.version agy_acp_server_1.1.1, Linux) with a relocated GEMINI_HOME. While wiring a PreToolUse hook that rewrites shell commands, I read the Python sources shipped in the release archive (acp_server/hooks.py, acp_server/paths.py) and found two gaps against the hooks documentation (antigravity.google/docs/hooks). The same two files in the 1.4.1 Linux x86_64 archive (agy-acp-server-1.4.1-linux-x86_64.zip, sha256 2e37012c…871384) are byte-identical to 1.1.1’s, so both releases are affected:

  1. overwrite is dropped. The external PreToolUse handler maps the hook’s JSON output to allow/deny only (allowTool, decision, reason/denyReason). overwrite and permissionOverrides are never read, and the hook result is never turned into HookResult.modified_args, although the SDK’s hook router already forwards modified_arguments_json to the harness. So a hook answering {"decision":"allow","overwrite":{"CommandLine":"rtk git status"}} leaves the original CommandLine in place. I confirmed this by running the shipped handler function on that exact output in isolation (result: {"allow": true}, args unchanged); I have not yet spent a live ACP session on it.

  2. Only config/hooks.json is read. paths.py resolves the global hooks file as <GEMINI_HOME>/config/hooks.json, and the loader adds trusted workspace hook files. There is no traversal of <GEMINI_HOME>/config/plugins/<name>/hooks.json in the ACP server’s loader, so a plugin bundle that ships a hooks.json (for example the one rtk init -g --agent antigravity writes) is inert through ACP. The Go harness binary bundled with the release does carry strings about plugins/<name>/hooks.json, but under ACP its hooks appear to be dispatched back through the Python server, and I did not exercise that path.

Why it matters

Tools like rtk rely on overwrite for Antigravity. Through ACP — the path external clients such as acpx, Zed or T3 use — such hooks install cleanly and do nothing, with no error or log line telling the user why.

Ask

  • Map PreToolUse overwrite to HookResult.modified_args in the ACP server (the SDK side already carries it), and document whether permissionOverrides is honoured there.
  • Load config/plugins/*/hooks.json in the ACP server the way the documented plugin model implies, or document that ACP reads only config/hooks.json.

I can share the minimal hook and the isolated reproduction if useful.

Related:

(Drafted with Claude from my own reading and tests, reviewed before posting; the voice and decisions are mine.)
– Claude

Hi @superbiche,

Thanks for digging into acp_server/hooks.py and acp_server/paths.py and laying out the exact behavior across 1.1.1 and 1.4.1—your analysis is spot on.

  1. PreToolUse overwrite and permissionOverrides: The external hook handler in agy_acp_server currently only evaluates allow/deny fields (allowTool, decision, reason/denyReason) and doesn’t map overwrite into HookResult.modified_args or apply permissionOverrides. We’ve escalated this to the engineering team to wire overwrite through to HookResult.modified_args and document permissionOverrides behavior.
  2. Plugin hooks.json discovery: acp_server/paths.py currently only loads <GEMINI_HOME>/config/hooks.json and trusted workspace .agents/hooks.json files, so <GEMINI_HOME>/config/plugins/<name>/hooks.json isn’t picked up. We’ve included this in the escalation so ACP matches the documented plugin model.

Workarounds until this is fixed in agy_acp_server:

  • Copy the hook entries from the plugin’s hooks.json (e.g., the one rtk init -g --agent antigravity writes) into $GEMINI_HOME/config/hooks.json or .agents/hooks.json in a trusted workspace. Use absolute paths for command values—relative ./ paths resolve against the directory of the hooks.json that contains them, so they’ll break once moved out of the plugin folder.
  • Because overwrite is ignored on ACP, a rewrite hook returning allow + overwrite will run the original command unchanged. As a stopgap, have the hook return {"decision": "deny", "reason": "Run this instead: rtk git status"}. The agent receives the denial reason and can retry with the suggested command (costing one extra turn, but keeping the rewrite in effect).
  • Regarding the related thread you linked, lifecycle hooks (PreToolUse/PostToolUse) and overwrite aren’t CLI-only—they are supported in the Antigravity App (2.x) as well as the CLI (subject to the request-review issue #575 you linked). The gaps you found are specific to agy_acp_server.

Your source analysis is already plenty to go on, though feel free to drop the minimal hook and isolated repro here if you’d like us to attach it to the engineering ticket.