Skip to content

fix(antigravity): write Stop handlers bare in hooks.json, per the vendor schema - #208

Merged
jothimani-rajendran merged 1 commit into
mainfrom
agy-1-antigravity-hooks-schema
Oct 17, 2026
Merged

jothimani-rajendran merged 1 commit into
mainfrom
agy-1-antigravity-hooks-schema

Conversation

@jothimani-rajendran

Copy link
Copy Markdown
Collaborator

What this changes

hook_config() for antigravity now writes Stop's handler bare ({"type": "command", "command": ...}) instead of inside a {"hooks": [...]} group, and gives every PreToolUse/PostToolUse group a matcher ("*" when the caller passes none). A maintainer's Antigravity IDE log (2026-10-17) rejected the old file with invalid hook "agentseam": command hook must specify 'command', so none of its hooks loaded.

Before:

{"agentseam": {"PreToolUse": [{"hooks": [{"type": "command", "command": "guard"}]}],
               "Stop":       [{"hooks": [{"type": "command", "command": "guard"}]}]}}

After:

{"agentseam": {"PreToolUse": [{"matcher": "*", "hooks": [{"type": "command", "command": "guard"}]}],
               "Stop":       [{"type": "command", "command": "guard"}]}}

Claim check

  • No capability claim is widened without a mechanism behind it. Block, rewrite and fail-mode claims are unchanged. Basis stays vendor-docs, and nothing is marked witnessed.
  • Any changed MATRIX row carries a verified record. Only the antigravity row's notes change: they record the corrected shape, the observed rejection, and that the corrected file has not been run.
  • Primary source: https://antigravity.google/docs/hooks (read 2026-10-17), "Schema and file format":
    • "The hooks.json file maps hook names to their event configurations". The example gives PreToolUse/PostToolUse {matcher, hooks} groups. It gives PreInvocation and SessionStart bare {"type": "command", "command": ...} items.
    • The Supported events table marks Stop as "N/A (matcher ignored)", the same as PreInvocation/SessionStart. The docs give no explicit Stop example, so treating Stop as bare is inferred from that class, and the observed log error supports it.
    • Matcher: "\"\" or \"*\": Match all tools."
    • Hook handler configuration: "command | string | Required."

Checks

  • pytest -q passes (2617 passed, 6 skipped, local)
  • ruff check . and ruff format --check . pass
  • Runtime path is still stdlib-only
  • Commits are signed off (git commit -s)

Notes for the reviewer

  • New hook_entry.flat_events field (schema + recount derive it from the golden fixture). default_match now also applies to the hooks_map wrapper; only antigravity sets either field, and the other vendors' golden fixtures are byte-identical.
  • The "*" default matcher is a deviation beyond the minimum fix. Every grouped example in the docs carries a matcher. If Antigravity tells grouped entries from bare ones by the matcher key, a group without one would hit the same error. "*" is documented to match all tools.
  • Not run against Antigravity. AGY-2 (chock) re-emits and the owner re-runs the witness.

Generated by Claude Code

…dor schema

Antigravity rejected the hooks.json agentseam's antigravity entry produced:
`invalid hook "agentseam": command hook must specify 'command'` (a maintainer's
Antigravity IDE language_server.log, 2026-10-17), so no hook loaded.

antigravity.google/docs/hooks (read 2026-10-17): "The `hooks.json` file maps hook
names to their event configurations". Its example gives the tool events
{matcher, hooks} groups and the matcher-ignored events (SessionStart,
PreInvocation) bare {type, command} handlers; its events table marks Stop
"N/A (matcher ignored)". agentseam wrote Stop as a {hooks} group, which has no
`command` of its own.

- hook_entry gains `flat_events` (wire events whose handlers sit bare in the
  event's list) and `default_match` now applies to hooks_map as well;
  antigravity sets flat_events [Stop] and default_match "*" (documented: "`*`:
  Match all tools"), so every tool-event group carries a matcher as in the docs.
- Golden fixture, generated example, recount and matrix notes follow.
- Basis stays vendor-docs; nothing is marked witnessed. The corrected file has
  not been run.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Jothi Mani Rajendran <250249270+jothimani-rajendran@users.noreply.github.com>
@jothimani-rajendran
jothimani-rajendran marked this pull request as ready for review October 17, 2026 17:05
@jothimani-rajendran
jothimani-rajendran merged commit 945ceb0 into main Oct 17, 2026
19 checks passed
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.

1 participant