Allow award_emoji (reactions) API calls through PreToolUse hook - #2
Open
JustTheWord wants to merge 1 commit into
Open
Allow award_emoji (reactions) API calls through PreToolUse hook#2JustTheWord wants to merge 1 commit into
JustTheWord wants to merge 1 commit into
Conversation
The hook regex matched any glab api path containing merge_requests/.../notes, which incidentally blocked the award emoji (reactions) endpoints — e.g. notes/:id/award_emoji used by review bots as a re-review trigger. The deny message redirects to glab-discussion, which has no reactions command, leaving agents at a dead end. Reactions are not discussion CRUD, so let them pass through to raw glab api instead of blocking them. Fixes fprochazka#1 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Fixes #1
Problem
The PreToolUse hook regex matches any
glab apipath containingmerge_requests/.../notes, which incidentally blocks the award emoji (reactions) endpoints —notes/:note_id/award_emojicontains/notes/, so reactions get denied as if they were note CRUD. The deny message then redirects the agent toglab-discussion, which has no reactions command, leaving agents at a dead end (real-world case: a review bot using a:recycle:reaction on its summary note as a re-review trigger — the agent could neither react via rawglab apinor via the CLI).Fix
Reactions are not discussion CRUD, so the hook now lets
glab api .../merge_requests/.../award_emojicalls pass through while everything it previously targeted stays blocked. This is option 1 from #1 (minimal pass-through, keeps the CLI's scope clean); happy to rework toward aglab-discussion reactcommand instead if you'd rather grow the CLI surface.Tests
Added 4 cases to
test-block-glab-api-discussions.sh(TDD — 3 failed before the fix):notes/99/award_emoji -X POST -f name=recyclenotes/1996757/award_emoji -f name=thumbsupnotes/99/award_emoji/7 -X DELETE(un-react)merge_requests/42/award_emoji(regression guard, already passing)Full suite: 46 passed, 0 failed — all pre-existing BLOCK cases (discussions/notes CRUD,
mr view --comments,mr note) still blocked.Amusing side note: while preparing this PR, the installed version of the hook blocked the
gh pr createcommand itself, because the PR body heredoc contained the literal string it greps for — the hook matches the whole Bash command text, not just the invoked binary.🤖 Generated with Claude Code