Bug: post-merge hook fires on failed merges #134

Closed
opened 2026-03-21 15:02:29 +00:00 by forgejo_admin · 0 comments
Contributor

Type

Bug

Lineage

plan-pal-e-agency → Process enforcement — standalone, discovered during operations

Repo

forgejo_admin/claude-custom

What Broke

The PostToolUse:mcp__forgejo__merge_approved_pr hook fires "PR merged successfully. You MUST run /update-docs NOW" regardless of whether the merge actually succeeded. When the API returns 405 (merge blocked by CI checks), the hook still tells the agent to run /update-docs — which would update docs for a merge that never happened.

Observed during session: 3 consecutive merge attempts on PR #124 returned 405 errors, and the hook fired "BLOCKING REQUIREMENT" each time.

Repro Steps

  1. Attempt to merge a PR that has failing required checks
  2. mcp__forgejo__merge_approved_pr returns {"error": true, "status_code": 405}
  3. Hook fires anyway with "PR merged successfully"

Expected Behavior

Hook should check the tool result for "merged": true before firing the /update-docs requirement. If the merge failed, the hook should either stay silent or say "Merge failed — check CI checks."

Environment

  • Hook file: ~/claude-custom/hooks/ (PostToolUse handler for mcp__forgejo__merge_approved_pr)
  • Trigger: any failed merge attempt via Forgejo MCP

Acceptance Criteria

  • Hook only fires /update-docs requirement when "merged": true in tool result
  • Failed merges (405, 409, etc.) do not trigger /update-docs
  • Successful merges still trigger correctly
  • pal-e-agency — project
  • sop-post-merge-docs — the SOP the hook enforces
### Type Bug ### Lineage `plan-pal-e-agency` → Process enforcement — standalone, discovered during operations ### Repo `forgejo_admin/claude-custom` ### What Broke The `PostToolUse:mcp__forgejo__merge_approved_pr` hook fires "PR merged successfully. You MUST run /update-docs NOW" regardless of whether the merge actually succeeded. When the API returns 405 (merge blocked by CI checks), the hook still tells the agent to run /update-docs — which would update docs for a merge that never happened. Observed during session: 3 consecutive merge attempts on PR #124 returned 405 errors, and the hook fired "BLOCKING REQUIREMENT" each time. ### Repro Steps 1. Attempt to merge a PR that has failing required checks 2. `mcp__forgejo__merge_approved_pr` returns `{"error": true, "status_code": 405}` 3. Hook fires anyway with "PR merged successfully" ### Expected Behavior Hook should check the tool result for `"merged": true` before firing the /update-docs requirement. If the merge failed, the hook should either stay silent or say "Merge failed — check CI checks." ### Environment - Hook file: `~/claude-custom/hooks/` (PostToolUse handler for `mcp__forgejo__merge_approved_pr`) - Trigger: any failed merge attempt via Forgejo MCP ### Acceptance Criteria - [ ] Hook only fires /update-docs requirement when `"merged": true` in tool result - [ ] Failed merges (405, 409, etc.) do not trigger /update-docs - [ ] Successful merges still trigger correctly ### Related - `pal-e-agency` — project - `sop-post-merge-docs` — the SOP the hook enforces
forgejo_admin 2026-03-25 13:40:36 +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#134
No description provided.