Bug: post-merge hook false alarm on successful squash merge #189

Closed
opened 2026-03-28 03:54:46 +00:00 by forgejo_admin · 3 comments
Contributor

Type

Bug

Lineage

Recurrence of #173 (fixed in PR #177, validated same day). Original fix added two-stage jq parsing but symptom has returned — likely the actual PostToolUse stdin JSON shape no longer matches either parsing path.

Repo

forgejo_admin/claude-custom

What Broke

After merging PR #226 via mcp__forgejo__merge_approved_pr, the PostToolUse hook fired with:

"Merge was not successful. Do NOT run /update-docs."

But the API returned {"merged": true, "method": "squash"} and the commit landed on origin/main (verified via git fetch + git log). The hook produced a false negative, suppressing the /update-docs reminder that should have fired.

Repro Steps

  1. QA approves a PR via comment_on_pr with VERDICT: APPROVED
  2. Merge via mcp__forgejo__merge_approved_pr(owner, repo, pr_number)
  3. API returns merged: true
  4. Hook fires with "not successful" message

Expected Behavior

Hook should detect the successful merge and fire the /update-docs reminder instead of the error message.

Environment

  • Hooks (3 affected):
    • remind-update-docs.sh (PostToolUse on mcp__forgejo__merge_approved_pr)
    • post-mcp-merge-rebase.sh (PostToolUse on mcp__forgejo__merge_approved_pr)
    • board-item-on-merge.sh (PostToolUse on mcp__forgejo__merge_approved_pr)
  • File targets: remind-update-docs.sh:21-24, post-mcp-merge-rebase.sh:13-16, board-item-on-merge.sh:37-40
  • Merge method: squash
  • Repo: forgejo_admin/pal-e-api PR #226

Acceptance Criteria

  • Capture actual PostToolUse stdin JSON to /tmp/hook-debug.json before attempting any fix
  • All 3 merge hooks correctly detect merged:true from PostToolUse stdin
  • Successful squash merge triggers /update-docs reminder (not error)
  • Failed merge still shows error message
  • No regression for rebase or regular merge methods
  • #173 — original bug (closed, fixed in PR #177)
  • project-pal-e-agency
  • forgejo_admin/pal-e-api #226 — the merge that triggered this
### Type Bug ### Lineage Recurrence of #173 (fixed in PR #177, validated same day). Original fix added two-stage jq parsing but symptom has returned — likely the actual PostToolUse stdin JSON shape no longer matches either parsing path. ### Repo `forgejo_admin/claude-custom` ### What Broke After merging PR #226 via `mcp__forgejo__merge_approved_pr`, the `PostToolUse` hook fired with: > "Merge was not successful. Do NOT run /update-docs." But the API returned `{"merged": true, "method": "squash"}` and the commit landed on `origin/main` (verified via `git fetch + git log`). The hook produced a false negative, suppressing the `/update-docs` reminder that should have fired. ### Repro Steps 1. QA approves a PR via `comment_on_pr` with VERDICT: APPROVED 2. Merge via `mcp__forgejo__merge_approved_pr(owner, repo, pr_number)` 3. API returns `merged: true` 4. Hook fires with "not successful" message ### Expected Behavior Hook should detect the successful merge and fire the `/update-docs` reminder instead of the error message. ### Environment - Hooks (3 affected): - `remind-update-docs.sh` (PostToolUse on `mcp__forgejo__merge_approved_pr`) - `post-mcp-merge-rebase.sh` (PostToolUse on `mcp__forgejo__merge_approved_pr`) - `board-item-on-merge.sh` (PostToolUse on `mcp__forgejo__merge_approved_pr`) - File targets: `remind-update-docs.sh:21-24`, `post-mcp-merge-rebase.sh:13-16`, `board-item-on-merge.sh:37-40` - Merge method: squash - Repo: forgejo_admin/pal-e-api PR #226 ### Acceptance Criteria - [ ] Capture actual PostToolUse stdin JSON to `/tmp/hook-debug.json` before attempting any fix - [ ] All 3 merge hooks correctly detect `merged:true` from PostToolUse stdin - [ ] Successful squash merge triggers /update-docs reminder (not error) - [ ] Failed merge still shows error message - [ ] No regression for rebase or regular merge methods ### Related - #173 — original bug (closed, fixed in PR #177) - `project-pal-e-agency` - `forgejo_admin/pal-e-api #226` — the merge that triggered this
Author
Contributor

Scope Review: NEEDS_REFINEMENT

Review note: review-505-2026-03-27

Regression of #173 -- fix is present in code (two-stage jq parsing) but symptom returned. Likely the actual PostToolUse stdin JSON shape doesn't match either parsing path.

  • [BODY] Add board-item-on-merge.sh as third affected hook (currently missing from Environment)
  • [BODY] Add explicit file targets: remind-update-docs.sh:21-24, post-mcp-merge-rebase.sh:13-16, board-item-on-merge.sh:37-40
  • [BODY] Update Lineage to note this is a recurrence of #173 (fixed in PR #177, validated same day)
  • [BODY] Add AC: "All 3 merge hooks correctly detect merged:true"
  • [BODY] Add AC: "Debug: capture actual PostToolUse stdin JSON to /tmp/hook-debug.json before fixing"
## Scope Review: NEEDS_REFINEMENT Review note: `review-505-2026-03-27` Regression of #173 -- fix is present in code (two-stage jq parsing) but symptom returned. Likely the actual PostToolUse stdin JSON shape doesn't match either parsing path. - **[BODY]** Add `board-item-on-merge.sh` as third affected hook (currently missing from Environment) - **[BODY]** Add explicit file targets: `remind-update-docs.sh:21-24`, `post-mcp-merge-rebase.sh:13-16`, `board-item-on-merge.sh:37-40` - **[BODY]** Update Lineage to note this is a recurrence of #173 (fixed in PR #177, validated same day) - **[BODY]** Add AC: "All 3 merge hooks correctly detect merged:true" - **[BODY]** Add AC: "Debug: capture actual PostToolUse stdin JSON to /tmp/hook-debug.json before fixing"
Author
Contributor

All 5 refinements from review-505-2026-03-27 applied:

  1. Lineage updated — now references #173 regression (fixed in PR #177)
  2. Environment expanded — board-item-on-merge.sh added as third affected hook
  3. File targets added — explicit line ranges for all 3 hooks
  4. AC added — "All 3 merge hooks correctly detect merged:true"
  5. Debug-first AC added — "Capture actual PostToolUse stdin JSON to /tmp/hook-debug.json before attempting any fix" (listed first in AC to enforce ordering)

Ready for re-review.

All 5 refinements from `review-505-2026-03-27` applied: 1. **Lineage** updated — now references #173 regression (fixed in PR #177) 2. **Environment** expanded — `board-item-on-merge.sh` added as third affected hook 3. **File targets** added — explicit line ranges for all 3 hooks 4. **AC added** — "All 3 merge hooks correctly detect merged:true" 5. **Debug-first AC added** — "Capture actual PostToolUse stdin JSON to /tmp/hook-debug.json before attempting any fix" (listed first in AC to enforce ordering) Ready for re-review.
Author
Contributor

Scope Review: READY

Review note: review-505-2026-03-28
Ticket is well-scoped with accurate file targets (all 3 line ranges verified), complete traceability triangle, debug-first AC ordering, and clear lineage to #173. Single-repo, single-pattern fix across 3 files — no decomposition needed. Ready for next_up.

## Scope Review: READY Review note: `review-505-2026-03-28` Ticket is well-scoped with accurate file targets (all 3 line ranges verified), complete traceability triangle, debug-first AC ordering, and clear lineage to #173. Single-repo, single-pattern fix across 3 files — no decomposition needed. Ready for `next_up`.
forgejo_admin 2026-03-28 11:30:13 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
ldraney/claude-custom#189
No description provided.