Bug: merge_approved_pr post-hook reports false positive failure #173

Closed
opened 2026-03-27 01:59:29 +00:00 by forgejo_admin · 2 comments
Contributor

Type

Bug

Lineage

Discovered during pal-e-platform PR #192 merge (2026-03-27).

Repo

forgejo_admin/claude-custom

What Broke

The PostToolUse:mcp__forgejo__merge_approved_pr hook emits "Merge was not successful. Do NOT run /update-docs." even when the MCP tool returns a successful merge response: {"merged": true, "method": "squash", "message": "PR #192 merged via squash"}.

This causes confusion about whether the merge actually happened and blocks the /update-docs SOP flow.

Repro Steps

  1. Have a QA-approved PR ready to merge
  2. Call mcp__forgejo__merge_approved_pr via MCP — merge succeeds
  3. Observe: hook fires with "Merge was not successful" despite merged: true in response
  4. Verify via mcp__forgejo__review_pr — PR is confirmed closed+merged

Expected Behavior

When the merge API returns merged: true, the post-hook should NOT report failure. It should either stay silent or emit a success message.

Environment

  • Cluster/namespace: local (claude-custom hooks run on archbox)
  • Service version: current main branch of claude-custom
  • Related alerts: none — this is a developer tooling issue

Acceptance Criteria

  • Hook correctly detects merged: true in MCP response
  • Hook does NOT emit false positive failure on successful squash merge
  • Hook still correctly reports actual merge failures (405, 409, etc.)
  • project-pal-e-agency — hooks are agency infrastructure
  • forgejo_admin/pal-e-platform#192 — PR where false positive was observed
### Type Bug ### Lineage Discovered during pal-e-platform PR #192 merge (2026-03-27). ### Repo `forgejo_admin/claude-custom` ### What Broke The `PostToolUse:mcp__forgejo__merge_approved_pr` hook emits "Merge was not successful. Do NOT run /update-docs." even when the MCP tool returns a successful merge response: `{"merged": true, "method": "squash", "message": "PR #192 merged via squash"}`. This causes confusion about whether the merge actually happened and blocks the /update-docs SOP flow. ### Repro Steps 1. Have a QA-approved PR ready to merge 2. Call `mcp__forgejo__merge_approved_pr` via MCP — merge succeeds 3. Observe: hook fires with "Merge was not successful" despite `merged: true` in response 4. Verify via `mcp__forgejo__review_pr` — PR is confirmed closed+merged ### Expected Behavior When the merge API returns `merged: true`, the post-hook should NOT report failure. It should either stay silent or emit a success message. ### Environment - Cluster/namespace: local (claude-custom hooks run on archbox) - Service version: current main branch of claude-custom - Related alerts: none — this is a developer tooling issue ### Acceptance Criteria - [ ] Hook correctly detects `merged: true` in MCP response - [ ] Hook does NOT emit false positive failure on successful squash merge - [ ] Hook still correctly reports actual merge failures (405, 409, etc.) ### Related - `project-pal-e-agency` — hooks are agency infrastructure - `forgejo_admin/pal-e-platform#192` — PR where false positive was observed
Author
Contributor

Scope Review: READY

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

Root cause identified: all 3 PostToolUse hooks for mcp__forgejo__merge_approved_pr use .tool_response.merged but MCP tool responses wrap the return value inside .tool_response.result as a JSON string. The jq expression never finds merged at the expected path.

Blast radius — 3 hooks affected, not 1:

  • remind-update-docs.sh (line 20) — emits false positive "Merge was not successful" (the reported symptom)
  • post-mcp-merge-rebase.sh (line 12) — silently skips local main fast-forward
  • board-item-on-merge.sh (line 36) — silently skips auto-move to done

Before moving to next_up:

  • Add story:dev-execute label (traceability gap)
  • Update issue body to name all 3 affected files
## Scope Review: READY Review note: `review-426-2026-03-27` Root cause identified: all 3 PostToolUse hooks for `mcp__forgejo__merge_approved_pr` use `.tool_response.merged` but MCP tool responses wrap the return value inside `.tool_response.result` as a JSON string. The jq expression never finds `merged` at the expected path. **Blast radius — 3 hooks affected, not 1:** - `remind-update-docs.sh` (line 20) — emits false positive "Merge was not successful" (the reported symptom) - `post-mcp-merge-rebase.sh` (line 12) — silently skips local main fast-forward - `board-item-on-merge.sh` (line 36) — silently skips auto-move to done **Before moving to next_up:** - Add `story:dev-execute` label (traceability gap) - Update issue body to name all 3 affected files
Author
Contributor

Validation: PASS

Validation note: validation-173-2026-03-27
5 checks: 5 PASS, 0 FAIL

All acceptance criteria verified against live main branch (commit a742d5f, PR #177). All 3 merge hooks (remind-update-docs.sh, post-mcp-merge-rebase.sh, board-item-on-merge.sh) now have identical two-stage jq parsing for .tool_response.result, matching the label-on-pr.sh reference pattern. False positive eliminated; failure path still correct.

## Validation: PASS Validation note: `validation-173-2026-03-27` 5 checks: 5 PASS, 0 FAIL All acceptance criteria verified against live main branch (commit a742d5f, PR #177). All 3 merge hooks (remind-update-docs.sh, post-mcp-merge-rebase.sh, board-item-on-merge.sh) now have identical two-stage jq parsing for `.tool_response.result`, matching the label-on-pr.sh reference pattern. False positive eliminated; failure path still correct.
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#173
No description provided.