Repository navigation
fix(antigravity): skip the hook script and python3 outside an Orca pane - #42790
Conversation
|
Important Review skippedReview was skipped as selected files did not have any reviewable changes.
|
agy runs Orca's hook on every message and before and after every tool call. Outside Orca the command still started two shells and python3 before the script noticed ORCA_PANE_KEY was empty: about 0.1s per hook, ~0.2s per tool call, even after Orca was uninstalled (#42601). The /bin/sh -c command now checks ORCA_PANE_KEY first, like Grok's. Outside a pane it prints the reply the script would have printed and drains stdin in the background, so hosts that keep stdin open (ACP) never block.
8dc93c4 to
1d168a8
Compare
ELI5
Orca adds a status hook to Antigravity (agy). agy runs it on every message, and before and after every tool call. That includes agy sessions that have nothing to do with Orca, and machines where Orca was uninstalled long ago. Each run started two shells and a python3 just to find out that Orca wasn't there. A widely shared post blamed this for agy feeling laggy.
Now the hook checks for Orca first, with one shell test, and only starts the script inside an Orca terminal.
What Changed
/bin/sh -c→/bin/sh antigravity-hook.sh→ python3 reads stdin → the script seesORCA_PANE_KEYis empty → exits. That's about 0.1s per hook, about 0.2s per tool call, and 4–5s across a 20-tool-call task. Measured with agy 1.5.8 on macOS./bin/sh -ccommand checksORCA_PANE_KEYbefore running the script, the same way Grok's command already does. Outside an Orca pane it prints the reply the script would have printed and returns:{"decision":"ask"}{"decision":""}{}catin the background (newstdinMayStayOpenoption onwrapPosixHookCommand), so hosts that keep stdin open, such as ACP clients, never block on it.~/.orcais deleted, non-PreToolUse events now get{}instead of nothing. That's the reply the script itself always gives.Why
catwould hang on hosts that never close stdin. agy treats a timed-out PreToolUse hook as "deny", so a hang would block tool calls. A backgroundcatkeeps the always-drain-stdin rule without that risk.Linked Issue
Part of #42601. This fixes the slowdown from hooks that run outside Orca. Removing hooks on uninstall is separate work.
Visual Proof
N/A. No UI change. Real-agy timings are under Testing.
Testing
Real
agy1.5.8 on macOS, oneagy -pturn that reads a file with one tool call. The new commands were installed into~/.gemini/config/hooks.jsonand restored afterwards./bin/sh,dash,zshandbash. Each returns at once while the backgroundcatstill reads the full payload.posix-hook-invocation.test.tsruns the installed command for PreToolUse, Stop and PreInvocation with stdin held open and no pane key. It asserts the reply and that the script never ran. Reverting the fix makes the script run. A foreground drain makes the test hang and fail.pnpm test src/main/antigravity src/main/agent-hooks/installation src/shared/agent-hook-listenerpasses.pnpm tc:node, oxlint and oxfmt pass.Risk
{"decision":"ask"}the script printed, and the real-agy run above exercised it.Level: Low
AI Disclosure
Review
Agent skill upstream boundary
Notes
Ensure no issues in: Security, Cross-platform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance
Checklist