Skip to content

Commit d3b753c

Browse files
luisleo526claude
andcommitted
INT27 (vi): the engine's merge-gate hook entry runs for MCP tool calls too, and blocks when it cannot start
pineforge-workflow's docs/VERIFY.md ("Open decisions") records two gaps in the product repos' .claude/settings.json: the entry ran pr-gate.mjs for Bash only, so an MCP merge tool in an engine session met no hook, and without `|| exit 2` a hook that could not start (the file missing, a syntax error, node's own exit 1) let the call through, since Claude Code blocks only on exit 2. campaign/README.md's wiring closes both. The entry's matcher `Bash` becomes `Bash|mcp__.*`, and its pr-gate command gets `"timeout": 120` and a trailing `|| exit 2`, as the workflow repo's own entry has them. pr-gate.mjs reads only `tool_input.command`, so an MCP payload reaches it as an empty command and it answers "no opinion"; the same entry therefore also runs campaign/hooks/merge-gate.mjs (the file campaign/README.md wires for `mcp__.*`, with the same timeout and `|| exit 2`), which reads `tool_name` and `tool_input` and judges an MCP merge of an engine PR. On a Bash call it repeats the merge gate pr-gate.mjs runs first; both are deny-only. Checked through `sh -c` with the payload on stdin, as Claude Code runs a command hook: a benign Bash call and a benign MCP call exit 0 for both commands; with the hook file missing each exits 2. This is the last commit before the final lab remote: a session loads its project hooks at start, so the session that wrote this commit keeps running the previous entry. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
1 parent 6a04d2b commit d3b753c

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

‎.claude/settings.json‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,17 @@
22
"hooks": {
33
"PreToolUse": [
44
{
5-
"matcher": "Bash",
5+
"matcher": "Bash|mcp__.*",
66
"hooks": [
77
{
88
"type": "command",
9-
"command": "node --no-warnings \"$HOME/code/pineforge-workflow/campaign/hooks/pr-gate.mjs\""
9+
"timeout": 120,
10+
"command": "node --no-warnings \"$HOME/code/pineforge-workflow/campaign/hooks/pr-gate.mjs\" || exit 2"
11+
},
12+
{
13+
"type": "command",
14+
"timeout": 120,
15+
"command": "node --no-warnings \"$HOME/code/pineforge-workflow/campaign/hooks/merge-gate.mjs\" || exit 2"
1016
}
1117
]
1218
}

0 commit comments

Comments
 (0)