Bug: merge hook reports failure when Forgejo API returns merged=true #216
Labels
No labels
domain:backend
domain:devops
domain:frontend
status:approved
status:in-progress
status:needs-fix
status:qa
type:bug
type:devops
type:feature
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
ldraney/claude-custom#216
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Type
Bug
Lineage
Repo
forgejo_admin/claude-customUser Story
As the PM, I need the post-merge hook to correctly detect successful merges so that /update-docs and board automation fire reliably. Currently the hook reports "Merge was not successful" even when the Forgejo API returns
merged: true.Context
During session 2026-03-28, all 8 PR merges via
mcp__forgejo__merge_approved_prreturnedmerged: truefrom the API but the PostToolUse hook fired "Merge was not successful. Do NOT run /update-docs." This blocks the entire post-merge chain (board updates, doc updates). Betty Sue had to manually verify each merge via API and manually update board items.Root cause: The
_parse_merged_statusfunction inhooks/forgejo-helper.sh(lines 333-380) has 5 parsing shapes, but none handle the actual PostToolUse JSON shape from Claude Code. The shape is double-stringified:tool_response(string) → parse →{"result": "..."}→ parseresult→{"merged": true}. This requires a two-level unwrap ("Shape 4+2") that no existing shape performs. Reproduction data captured at/tmp/hook-debug-merge.json.File Targets
hooks/forgejo-helper.sh(lines 333-380,_parse_merged_statusfunction) — add a new parsing shape for double-stringified tool_response. The hook scripts that call this function (post-mcp-merge-rebase.sh,remind-update-docs.sh,board-item-on-merge.sh) need no changes.tests/test_parse_merged_status.sh— add test case for the double-stringified shape using the payload structure from/tmp/hook-debug-merge.jsonAcceptance Criteria
_parse_merged_statuscorrectly detectsmerged: truein the double-stringified shape (tool_response string → parse → result string → parse → merged boolean)Test Expectations
tests/test_parse_merged_status.shwith double-stringified payload — returns "true"bash tests/test_parse_merged_status.sh— all passConstraints
_parse_merged_statusinforgejo-helper.sh— do not modify the hook scripts that call itChecklist
_parse_merged_statusinforgejo-helper.shtests/test_parse_merged_status.shRelated
forgejo_admin/claude-custom#189— predecessor bug that introduced_parse_merged_statuswith 5 shapesforgejo_admin/claude-custom#161— scope review pipeline (sibling hook work)session_2026_03_28— 8 false negatives observedScope Review: NEEDS_REFINEMENT
Review note:
review-585-2026-03-28Ticket has correct traceability and is well-scoped for a single agent, but file targets are wrong and the Type header contradicts the board label.
Issues found:
hooks/post-mcp-merge-rebase.shbut the actual fix target ishooks/forgejo-helper.sh(lines 333-380,_parse_merged_statusfunction)tests/test_parse_merged_status.sh(existing test file needs new test case)tool_responseshape not handled (string -> parse ->{result: string}-> parse ->{merged: true})Scope Refinement Applied (review-585-2026-03-28)
5 changes per review recommendations:
post-mcp-merge-rebase.sh→forgejo-helper.sh(lines 333-380,_parse_merged_status)tests/test_parse_merged_status.shRe-running scope review.
Scope Review: READY
Review note:
review-585-2026-03-28-v2Re-review after refinement -- all 5 body fixes from previous review verified as correctly applied. Scope is solid, file targets verified against codebase, traceability complete, fits in a single agent pass (<5 min). Ready for dispatch.