fix: parse MCP-wrapped tool_response.result in 3 merge hooks #177
No reviewers
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!177
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "173-fix-mcp-response-parsing"
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?
Summary
Three PostToolUse hooks that fire on
mcp__forgejo__merge_approved_prwere parsing.tool_response.mergeddirectly, but MCP wraps responses in.tool_response.resultas a JSON string. This caused false positive "merge not successful" messages even when merges succeeded (observed on pal-e-platform PR #192).Changes
hooks/remind-update-docs.sh-- try.tool_response.mergedfirst, fall back to parsing.tool_response.resultJSON stringhooks/post-mcp-merge-rebase.sh-- same fixhooks/board-item-on-merge.sh-- same fixAll three now follow the same pattern already used by
label-on-pr.shandlabel-on-branch.sh.Test Plan
{"tool_response":{"result":"{\"merged\": true, ...}"}}-- all 3 hooks correctly detect success{"tool_response":{"merged":true}}-- still works (backward compatible){"merged": false}-- correctly reports failureReview Checklist
Related Notes
forgejo_admin/claude-custom#173-- the Forgejo issue this PR implementsproject-pal-e-agency-- hooks are agency infrastructureCloses #173
Self-Review
Verdict: PASS
What was reviewed
remind-update-docs.sh,post-mcp-merge-rebase.sh,board-item-on-merge.shFindings
.tool_response.mergedfirst (direct format), then falls back to parsing.tool_response.resultas a JSON string. This handles both MCP-wrapped and hypothetical direct response formats.label-on-pr.shandlabel-on-branch.sh.$MERGEDremains empty, which means!= "true"evaluates correctly -- merge is treated as failed, matching the original fail-safe behavior.Test results
No issues found. Ready for human review.