fix(hook): recognize Grok's run_terminal_command tool name - #152
Merged
Conversation
The released Grok CLI sends toolName run_terminal_command; snip only classified run_terminal_cmd and Bash as shell tools. Every other name returns an empty stdout and exit 0, which Grok reads as allow, so `snip init --agent grok` installed a hook that filtered nothing and left `snip gain` stuck on manual runs. The three names now live in one set, and the init matcher covers the released name too. Closes #145
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.
Closes #145.
The defect
snip hook grokclassified onlyrun_terminal_cmdandBashas shell tools. The released Grok CLI sendsrun_terminal_command, which fell through to the passthrough path: empty stdout, exit 0, which Grok reads as allow.snip init --agent groktherefore installed a hook that filtered nothing, andsnip gainonly ever moved for manualsnip runinvocations.Before:
After:
The fix
The three spellings live in one set:
run_terminal_command(what the CLI sends),run_terminal_cmd(what the hook docs use) andBash(the Claude-style alias). The init matcher gains the released name as well, so a fresh install matches it host-side too.Not included: the issue's optional suggestion to audit unrecognized shell-like tool names under
SNIP_HOOK_AUDIT=1. That is a separate feature, not this bug.Tests
TestRunGrokShellToolNamesruns the deny path across the three names. Droppingrun_terminal_commandfrom the set fails it; the two existing names keep their own coverage.make test-raceandgolangci-lintare clean.