Skip to content

Allow award_emoji (reactions) API calls through PreToolUse hook - #2

Open
JustTheWord wants to merge 1 commit into
fprochazka:masterfrom
JustTheWord:allow-award-emoji
Open

Allow award_emoji (reactions) API calls through PreToolUse hook#2
JustTheWord wants to merge 1 commit into
fprochazka:masterfrom
JustTheWord:allow-award-emoji

Conversation

@JustTheWord

Copy link
Copy Markdown

Fixes #1

Problem

The PreToolUse hook regex matches any glab api path containing merge_requests/.../notes, which incidentally blocks the award emoji (reactions) endpointsnotes/:note_id/award_emoji contains /notes/, so reactions get denied as if they were note CRUD. The deny message then redirects the agent to glab-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 raw glab api nor via the CLI).

Fix

Reactions are not discussion CRUD, so the hook now lets glab api .../merge_requests/.../award_emoji calls 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 a glab-discussion react command 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):

  • ALLOW notes/99/award_emoji -X POST -f name=recycle
  • ALLOW quoted notes/1996757/award_emoji -f name=thumbsup
  • ALLOW notes/99/award_emoji/7 -X DELETE (un-react)
  • ALLOW MR-level 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 create command 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

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>
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.

Plugin hook blocks award_emoji (reactions) API with no glab-discussion replacement

2 participants