Repository navigation
fix(antigravity): migrate stale PreToolUse / PreInvocation hooks in place - #5670
Merged
thedotmack merged 1 commit intoNov 10, 2026
Merged
Conversation
…lace (thedotmack#5665) An in-place upgrade from a pre-thedotmack#5085 install leaves a PreToolUse entry in ~/.gemini/config/hooks.json. agy keeps firing it before every tool call, the current adapter answers {} with no decision field, and agy denies every call until the user re-runs install. Add findStaleAntigravityHooks + healStaleAntigravityHooksConfig to the Antigravity installer: when a stale PreToolUse or a PreInvocation -> context entry is present, the file is migrated in place with the same merge install performs (surgical strip fallback when the worker path cannot be resolved). Best-effort: never throws, writes only when stale, leaves a corrupt file untouched. worker-service runs the heal on antigravity-cli hook invocations and on worker startup.
Owner
|
Merged, thank you @0xABCD01! Antigravity users who upgraded in place from an older install no longer get every tool call denied: the next agy hook run (or worker start) migrates the leftover |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #5665 (the stale-hook half; the PostInvocation half is covered by #5667, so this PR is scoped to the hook migration only).
Problem
A pre-#5085 install left a
PreToolUseentry (and possibly a pre-#4911PreInvocation→contextentry) in~/.gemini/config/hooks.json. #5085 removed the{ decision: 'allow' }response, so the current adapter answers the stale entry with{}, which has nodecisionfield, and agy denies the call. After an in-place upgrade from 14.x to 15.x this denies every tool call. The entries were only cleaned up when the user happened to re-runinstall --ide antigravity.Fix
findStaleAntigravityHooksdetects a non-emptyPreToolUseor aPreInvocationhandler routing tocontexton theclaude-memnamed hook.healStaleAntigravityHooksConfigrewrites hooks.json in place with the same merge install performs (mergeHooksIntoConfigover the canonical config), falling back to deleting just the stale entries when the worker path can't be resolved. It never throws, writes only when a stale entry is present, and leaves a corrupt file untouched.worker-serviceruns the heal onantigravity-clihook invocations and on worker startup — the stale entries point at that binary, so the first run after an in-place upgrade repairs the file. The heal is kept out of the lean hook bundle on purpose (src/cliimports no installer modules).Tests
tests/integrations/antigravity-stale-hook-heal.test.ts: stale detection, in-place migration preserving other hooks, idempotence, current file byte-identical, missing/corrupt file handling. 8 tests, all passing.tsc --noEmitis clean (verified on the full two-part branch; this PR is the hook-migration commit only, and its test file passes standalone against main).Note: the
plugin/bundles are not regenerated in this PR; they rebuild with the release build.