Repository navigation
Description
Antigravity CLI Version
1.2.7
Environment Context
- OS: Windows 11 Pro 10.0.26340 (AMD64)
- Shell: PowerShell 7.x and Git Bash
- Terminal Emulator: n/a, all runs were non-interactive
agy -p - Runtime Version: agy CLI 1.2.7, Antigravity Hub 2.15.0
- Hardware Details: AMD Ryzen 7 5800H, 29 GB RAM
Steps to Reproduce
- Create a hook that returns only an allow decision:
# h_allow.py
import sys, json
p = json.loads(sys.stdin.read() or "{}")
cmd = ((p.get("toolCall") or {}).get("args") or {}).get("CommandLine", "")
sys.stderr.write("hook saw: %r\n" % cmd)
sys.stdout.write(json.dumps({"decision": "allow", "reason": "isolation test"}))- Register it in
~/.gemini/config/hooks.json:
{ "iso-allow": { "PreToolUse": [ { "matcher": "run_command",
"hooks": [ { "type": "command", "command": "python h_allow.py", "timeout": 15 } ] } ] } }- With no
command(...)grant matching the target, run:
agy -p "Run exactly: echo ISOLATION_TEST_MARKER"Expected Behavior
The command executes. Per agy-customizations/docs/hooks.md:
"allow": Automatically allow the tool execution.
Actual Behavior / Error Screenshots
The call is auto-denied:
jetski: no output produced - a tool required the "command" permission that headless
mode cannot prompt for, so it was auto-denied.
The hook ran and saw the call. Its own stderr:
hook saw: 'echo ISOLATION_TEST_MARKER'
So this is not a matcher miss. The response is also not thrown away wholesale, because overwrite from the same response object is applied.
Logs & Configurations
What each field actually does
I tested all three against the same gate.
| Field returned | Result |
|---|---|
decision: "deny" |
Honoured. Blocks a command that has an explicit grant. |
decision: "allow" |
Ignored. Ungranted command is still auto-denied. |
overwrite |
Honoured. Arguments rewritten and announced to the agent. |
deny test, with command(echo DENY_TEST_MARKER) granted and a hook returning {"decision": "deny", "reason": "blocked by safety hook (test)"}:
Execution of the command was denied by the environment's pre-tool safety hook:
tool call denied by pre-tool hook: blocked by safety hook (test)
overwrite test, with a grant present so the call could run:
A pre-tool hook changed the arguments of this tool call before it ran. Changed: CommandLine.
The command exited with code 0.
Output:
SUBSTITUTED_BY_HOOK
Reading of the cause
The gate consumes decision, since deny reaches it and overrides a grant. It lets a hook veto a granted call. It will not let a hook approve an ungranted one.
That fits a gate treating hooks as a restriction layer only, with deny-overrides semantics, where allow parses as valid input and never reaches the grant lookup. Conservative as a security posture. It does not match the documented contract.
Impact
A hook can restrict and never permit. PreToolUse works as a safety guard and fails as a policy engine. The obvious pattern, auto-approve a known-safe command set and ask about everything else, cannot be expressed in headless mode.
Anyone implementing the documented contract for CI gets a hook that fires, logs, returns valid JSON, raises no error, and has no effect. Nothing in the output points at the cause.
It also removes the remaining escape hatch. autoExecutionPolicy is inert in headless as well, which I am filing separately. With both gone, the options are an exact-match grant list or --dangerously-skip-permissions, and nothing in between.
Suggested fix
- Wire
"allow"into the gate the way"deny"already is.denyreaches the gate and overrides a grant, so the plumbing exists.allowneeds to satisfy the grant lookup rather than run beside it."ask"and"force_ask"can keep falling through to the existing cannot-prompt deny path. - If
allowis meant to be advisory in headless, say so inagy-customizations/docs/hooks.mdand log the discard:hook returned decision=allow but headless permission gate requires an explicit grant. - Name the hook in the denial message, so it is visible that a hook decided and was overruled.
One thing that already works correctly
While testing overwrite I checked whether a hook could launder an unapproved command through an approved one. Grant command(echo ORIGINAL_COMMAND), then rewrite it to something else in the hook.
The substituted command was denied. Permission evaluates against the post-overwrite arguments. That closes a privilege-escalation path through PreToolUse. Worth keeping through any refactor of this area.
Scope
agy -p headless only. IDE and Hub GUI untested.
Activity
fix(antigravity): observe PreToolUse instead of holding it for an isl…
Emily2040 commentedon Sep 24, 2026
Re-checked on 1.2.9: unchanged. A
PreToolUsehook returning{"decision": "allow"}for an ungranted command runs and is logged, and the call is still auto-denied.The shape from #1059, closed as a duplicate of this, does no better.
{"decision": "ask", "permissionOverrides": ["command(<the exact line>)"]}is denied the same way in headless.denystill blocks.overwritewithdecision: "allow"still rewrites the call and announces the change, and because the permission check runs against the rewritten command it still can't launder one.For the record, @konomings reported the
allowhalf on #548 on 1.1.8, well before I filed this.probablysamir commentedon Sep 28, 2026
We're hitting this too. Drawa (a browser canvas that runs coding agents) drives
agyin headless stream-json mode, and we'd like users to approve or deny each tool call from the UI, the same way we do for Claude Code and OpenCode. The only hook into that isPreToolUse, and sinceallowis ignored, we can deny but never approve. That leaves an Antigravity session either read-only or fully bypassed.Would it be possible to get
allow(andpermissionOverrides) honoured in headless mode? A way to answer permission prompts over stream-json stdin would work for us too.th3nolo commentedon Sep 29, 2026
Still reproduces on 1.2.13 (Windows 11, headless
agy -p, one PreToolUse hook, no grant for the command): a hook that returnsallowis ignored and the call is auto-denied.askandforce_askare auto-denied the same way.@probablysamir, the "fully bypassed" side is not fully bypassed. With
--dangerously-skip-permissions, a hook'sdenystill blocks the call, and a hook that crashes (exit 1, no output) also blocks it. So approve/deny from a UI works today:--dangerously-skip-permissions. The hook returnsdenywith a reason for every call that needs approval. The agent sees the reason.allowfor the saved command, and the call runs.The hook has to deny by default: under the flag, every call it does not deny runs.
One related gap: under the flag, a hook's
askandforce_askare auto-approved with no prompt. It would help if they showed the prompt in interactive mode and were a deny in headless mode.probablysamir commentedon Sep 30, 2026
I guess agy is still immature to use it in a full fledged headless session like claude code, opencode or codex, to mention a few we've integrated to so far. We've hit many other limitations too. CC: @th3nolo
Emily2040 commentedon Oct 5, 2026
Re-checked on agy 1.2.17, Windows 11 Pro Insider Preview 10.0.26340 (64-bit), headless
agy -p, usinggemini-3.8-flash-high. Theallowcase still fails.The hook records the actual command it receives and returns
{"decision":"allow"}. With no matching grant, the command is auto-denied. Adding an exact grant makes it run. Returningdenyblocks a command that has an exact grant.allow, no grantallow, exact grantdeny, exact grantI checked the tool results in the saved transcripts and the hook's input log. The current bundled hooks documentation still describes
allowas automatically allowing execution. That contract still differs from the observed headless behaviour.These runs used an isolated configuration with no inherited permission grants.
th3nolo commentedon Oct 5, 2026
@probablysamir The official ACP server gives per-call approval today. I tested it.
Setup:
agy_acp_server1.3.0 (Windows x64, ACP registry entryantigravity-acp), a minimal ACP client over stdio. The server does not use theagyCLI login. The client must callauthenticateonce.For
run_command, the server sendssession/request_permissionwithallow_always,allow_onceandreject_once. The client answer controls the call:allow_oncereject_onceallowreject_onceaskreject_oncedenyDrawa can approve and deny from the UI. It needs no hooks and no skip flag. If you add hooks, do not use shell syntax in the command (#1152).
Two results for this issue:
allow. The call goes to the client prompt. The docs sayallowapproves the call. That is false on both the CLI and the ACP server.tool_callupdate. Only the agent text shows the block.My earlier workaround does not need
--dangerously-skip-permissions. Set"toolPermission": "always-proceed"in~/.gemini/antigravity-cli/settings.json. On 1.2.13 headless, a hookdenystill blocksrun_commandwith this setting. @Emily2040's table on #1054 shows that this setting runs ungranted commands on 1.2.17. The hook must deny by default.Testing note:
GEMINI_HOMEisolates the ACP server. It does not isolate theagyCLI. WithGEMINI_HOMEset to an empty folder, CLI 1.2.13 still reads~/.gemini/antigravity-cli/settings.jsonand~/.gemini/config/hooks.json.probablysamir commentedon Oct 5, 2026
@th3nolo but this is just a workaround by installing agy_acp_server and this works in a very different way than how we have wrapped other agents in drawa. This might definitely work but it's more about a rewrite than a simple fix. Hope agy supports this natively soon enough
Profile effort for Codex and Antigravity; agy_approvals to run agy wo…
lpalvess commentedon Oct 18, 2026
Confirming this on agy 1.4.2 (Linux/WSL2), and adding two data points that may help: a behaviour change between 1.3.x and 1.4.x, and TUI results (the report above is headless only).
Same bug in 1.4.2, headless (
agy -p "Run this exact shell command with your terminal tool: touch proof.txt", PreToolUse hook onrun_command):{"decision":"allow"}commandpermission){"decision":"allow","permissionOverrides":["command(touch proof.txt)"]}{"decision":"allow","permissionOverrides":["command(touch)"]}{"decision":"ask","permissionOverrides":["command(touch proof.txt)"]}{"permissionOverrides":["command(touch)"]}(nodecision){"decision":"allow","overwrite":{}}Regression:
{}no longer lets the call through. On agy 1.3.3, a hook printing{}maderun_commandrun with no permission prompt (headless, 5/5 runs, while no hook was auto-denied; in the TUI it ran without the "Run this command?" prompt). On 1.4.1 and 1.4.2 the same{}makes the call fail (tool call denied by pre-tool hook:with an empty reason, reported independently on 1.4.1), and it also blocksview_file. I'm not claiming{}was documented behaviour, only that tools were relying on it, and it silently flipped from "allow" to "deny".TUI (1.4.2, pty): empty stdout shows the normal "Run this command?" prompt;
{}shows no prompt and the command does not run. So there is still no way for a hook to approve a call in the TUI either.The practical effect: a PreToolUse hook can block (
deny) but cannot approve, anddecision: "allow", as documented inhooks.md, has no effect. Tools that forward approval decisions from another UI to agy (we hit this in an open-source dashboard) have no working option on 1.4.x. A workingallow(or honouringpermissionOverrides) would fix this and #1059.DevCop95 commentedon Oct 24, 2026
Cross-reference: I opened #1329 with evidence that in the Antigravity IDE App (not CLI print mode) PreToolUse/PostToolUse do fire and {"decision":"allow"} is honored (control case executed), while deny blocks. So the allow-ignored behavior reported in #1053 appears to be specific to the CLI print-mode executor, not the hook contract itself. The App side also shows deny > force_ask > allow/ask precedence when multiple hooks disagree. Full event lifecycle + counts by model (including gemini-4-argon-high) in #1329.
Emily2040 commentedon Oct 25, 2026
Still present on 1.4.7. Windows 11 Pro Insider Preview 10.0.26340, headless
agy -p,gemini-3.8-flash-low, fresh synthetic workspace and isolated CLI home for each case, no broad grants.run_commandreturns{"decision":"allow"}permission check failed ... user denied permission to run commandcommand(python <path>/touch.py)in settings, no hookSo the hook runs and answers allow, and the call is still denied exactly as if there were no hook. The grant control shows the command itself is fine.
This matches what @lpalvess saw on 1.4.2. #1329 reports that the desktop app honours
allow, so this looks specific to the CLI print-mode path.