From efeedf4f96eb9fd12026cb63ac61969a72b93dc8 Mon Sep 17 00:00:00 2001 From: Abhijeet Prasad Date: Mon, 14 Sep 2026 18:33:28 -0400 Subject: [PATCH] fix(plugins): use native antigravity and grok hook timeouts Remove explicit hook timeouts so each agent applies its own event-specific limits. Update Grok validation to expect omitted timeout overrides. --- src/plugins/antigravity/content/hooks.json | 12 +++------ src/plugins/grok/content/hooks/hooks.json | 30 +++++++++++----------- src/plugins/grok/test/test_hook.sh | 12 +++------ src/plugins/grok/validate.sh | 2 -- 4 files changed, 22 insertions(+), 34 deletions(-) diff --git a/src/plugins/antigravity/content/hooks.json b/src/plugins/antigravity/content/hooks.json index db63a11..675f371 100644 --- a/src/plugins/antigravity/content/hooks.json +++ b/src/plugins/antigravity/content/hooks.json @@ -6,8 +6,7 @@ "hooks": [ { "type": "command", - "command": "sh \"./bin/antigravity-hook.sh\" PostToolUse", - "timeout": 30 + "command": "sh \"./bin/antigravity-hook.sh\" PostToolUse" } ] } @@ -15,22 +14,19 @@ "PreInvocation": [ { "type": "command", - "command": "sh \"./bin/antigravity-hook.sh\" PreInvocation", - "timeout": 30 + "command": "sh \"./bin/antigravity-hook.sh\" PreInvocation" } ], "PostInvocation": [ { "type": "command", - "command": "sh \"./bin/antigravity-hook.sh\" PostInvocation", - "timeout": 30 + "command": "sh \"./bin/antigravity-hook.sh\" PostInvocation" } ], "Stop": [ { "type": "command", - "command": "sh \"./bin/antigravity-hook.sh\" Stop", - "timeout": 30 + "command": "sh \"./bin/antigravity-hook.sh\" Stop" } ] } diff --git a/src/plugins/grok/content/hooks/hooks.json b/src/plugins/grok/content/hooks/hooks.json index 71d9c79..b6eb91f 100644 --- a/src/plugins/grok/content/hooks/hooks.json +++ b/src/plugins/grok/content/hooks/hooks.json @@ -1,49 +1,49 @@ { "hooks": { "SessionStart": [ - { "hooks": [{ "type": "command", "command": "bash \"${GROK_PLUGIN_ROOT}/hooks/forward.sh\"", "timeout": 5 }] } + { "hooks": [{ "type": "command", "command": "bash \"${GROK_PLUGIN_ROOT}/hooks/forward.sh\"" }] } ], "UserPromptSubmit": [ - { "hooks": [{ "type": "command", "command": "bash \"${GROK_PLUGIN_ROOT}/hooks/forward.sh\"", "timeout": 5 }] } + { "hooks": [{ "type": "command", "command": "bash \"${GROK_PLUGIN_ROOT}/hooks/forward.sh\"" }] } ], "PreToolUse": [ - { "matcher": ".*", "hooks": [{ "type": "command", "command": "bash \"${GROK_PLUGIN_ROOT}/hooks/forward.sh\"", "timeout": 5 }] } + { "matcher": ".*", "hooks": [{ "type": "command", "command": "bash \"${GROK_PLUGIN_ROOT}/hooks/forward.sh\"" }] } ], "PostToolUse": [ - { "matcher": ".*", "hooks": [{ "type": "command", "command": "bash \"${GROK_PLUGIN_ROOT}/hooks/forward.sh\"", "timeout": 5 }] } + { "matcher": ".*", "hooks": [{ "type": "command", "command": "bash \"${GROK_PLUGIN_ROOT}/hooks/forward.sh\"" }] } ], "PostToolUseFailure": [ - { "matcher": ".*", "hooks": [{ "type": "command", "command": "bash \"${GROK_PLUGIN_ROOT}/hooks/forward.sh\"", "timeout": 5 }] } + { "matcher": ".*", "hooks": [{ "type": "command", "command": "bash \"${GROK_PLUGIN_ROOT}/hooks/forward.sh\"" }] } ], "PermissionDenied": [ - { "matcher": ".*", "hooks": [{ "type": "command", "command": "bash \"${GROK_PLUGIN_ROOT}/hooks/forward.sh\"", "timeout": 5 }] } + { "matcher": ".*", "hooks": [{ "type": "command", "command": "bash \"${GROK_PLUGIN_ROOT}/hooks/forward.sh\"" }] } ], "Stop": [ - { "hooks": [{ "type": "command", "command": "bash \"${GROK_PLUGIN_ROOT}/hooks/forward.sh\"", "timeout": 5 }] } + { "hooks": [{ "type": "command", "command": "bash \"${GROK_PLUGIN_ROOT}/hooks/forward.sh\"" }] } ], "StopFailure": [ - { "matcher": ".*", "hooks": [{ "type": "command", "command": "bash \"${GROK_PLUGIN_ROOT}/hooks/forward.sh\"", "timeout": 5 }] } + { "matcher": ".*", "hooks": [{ "type": "command", "command": "bash \"${GROK_PLUGIN_ROOT}/hooks/forward.sh\"" }] } ], "StopCancelled": [ - { "matcher": ".*", "hooks": [{ "type": "command", "command": "bash \"${GROK_PLUGIN_ROOT}/hooks/forward.sh\"", "timeout": 5 }] } + { "matcher": ".*", "hooks": [{ "type": "command", "command": "bash \"${GROK_PLUGIN_ROOT}/hooks/forward.sh\"" }] } ], "Notification": [ - { "matcher": ".*", "hooks": [{ "type": "command", "command": "bash \"${GROK_PLUGIN_ROOT}/hooks/forward.sh\"", "timeout": 5 }] } + { "matcher": ".*", "hooks": [{ "type": "command", "command": "bash \"${GROK_PLUGIN_ROOT}/hooks/forward.sh\"" }] } ], "SubagentStart": [ - { "matcher": ".*", "hooks": [{ "type": "command", "command": "bash \"${GROK_PLUGIN_ROOT}/hooks/forward.sh\"", "timeout": 5 }] } + { "matcher": ".*", "hooks": [{ "type": "command", "command": "bash \"${GROK_PLUGIN_ROOT}/hooks/forward.sh\"" }] } ], "SubagentStop": [ - { "matcher": ".*", "hooks": [{ "type": "command", "command": "bash \"${GROK_PLUGIN_ROOT}/hooks/forward.sh\"", "timeout": 5 }] } + { "matcher": ".*", "hooks": [{ "type": "command", "command": "bash \"${GROK_PLUGIN_ROOT}/hooks/forward.sh\"" }] } ], "PreCompact": [ - { "matcher": ".*", "hooks": [{ "type": "command", "command": "bash \"${GROK_PLUGIN_ROOT}/hooks/forward.sh\"", "timeout": 5 }] } + { "matcher": ".*", "hooks": [{ "type": "command", "command": "bash \"${GROK_PLUGIN_ROOT}/hooks/forward.sh\"" }] } ], "PostCompact": [ - { "matcher": ".*", "hooks": [{ "type": "command", "command": "bash \"${GROK_PLUGIN_ROOT}/hooks/forward.sh\"", "timeout": 5 }] } + { "matcher": ".*", "hooks": [{ "type": "command", "command": "bash \"${GROK_PLUGIN_ROOT}/hooks/forward.sh\"" }] } ], "SessionEnd": [ - { "matcher": ".*", "hooks": [{ "type": "command", "command": "bash \"${GROK_PLUGIN_ROOT}/hooks/forward.sh\"", "timeout": 15 }] } + { "matcher": ".*", "hooks": [{ "type": "command", "command": "bash \"${GROK_PLUGIN_ROOT}/hooks/forward.sh\"" }] } ] } } diff --git a/src/plugins/grok/test/test_hook.sh b/src/plugins/grok/test/test_hook.sh index 116706f..78164df 100755 --- a/src/plugins/grok/test/test_hook.sh +++ b/src/plugins/grok/test/test_hook.sh @@ -141,15 +141,9 @@ with open(sys.argv[1], encoding="utf-8") as handle: assert "SessionEnd" in hooks, "terminal hook must use exact SessionEnd spelling" assert "SessionStop" not in hooks, "non-native terminal spelling must not be registered" for event, groups in hooks.items(): - expected_timeout = 15 if event == "SessionEnd" else 5 - timeouts = { - hook["timeout"] - for group in groups - for hook in group["hooks"] - } - assert timeouts == {expected_timeout}, ( - f"{event} timeout {sorted(timeouts)} != {expected_timeout}" - ) + for group in groups: + for hook in group["hooks"]: + assert "timeout" not in hook, f"{event} must use Grok's default timeout" PY echo "test: grok hook adapter OK" diff --git a/src/plugins/grok/validate.sh b/src/plugins/grok/validate.sh index 90ba690..87d326d 100755 --- a/src/plugins/grok/validate.sh +++ b/src/plugins/grok/validate.sh @@ -40,13 +40,11 @@ expected = { } assert set(hooks) == expected for event, groups in hooks.items(): - expected_timeout = 15 if event == "SessionEnd" else 5 for group in groups: for hook in group["hooks"]: assert hook == { "type": "command", "command": 'bash "${GROK_PLUGIN_ROOT}/hooks/forward.sh"', - "timeout": expected_timeout, } PY