You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(guardrails): merge guard blocks a reply that quotes a merge command in backticks #18900
The guardrails merge guard refused a gh api graphql review-thread reply because the reply body quoted a merge command inside markdown backticks. The command merged nothing.
Steps to reproduce
Run a GraphQL mutation whose body text contains a backticked merge command, for example an addPullRequestReviewThreadReply whose body includes the text `gh pr merge 42`.
Expected
The guard passes it: the command text is inside a quoted argument (hook-precision rule 2 in the guard's header), and no merge path runs.
Actual
The guard blocks it as a merge whose target it cannot resolve (the backtick branch that fails closed).
Seen with guardrails 4.0.0 block-unresolved-pr-merge.sh on 2026-11-24 while replying on claude-code-plugins#18835. Whether the renamed merge-guard.sh from #18835 keeps the behavior is UNVERIFIED.
Suggested fix location
The target-resolution check that treats a backtick as an unresolvable target: apply it only at a command position, not inside a quoted argument, with a test for a backticked merge command in a GraphQL body.
Size: Small
Complexity: Medium
Uncertainty: Knowable
Flags: intent
Blocked by: none
Blast radius: the guardrails merge guard (plugins/guardrails/hooks/merge-guard.sh) and its tests; every Bash command in sessions running the plugin passes through it.
Reversible: yes; revert the change to the hook and its tests.
Claims checked:
The guard blocks a merge-shaped command with a backtick even inside a quoted argument: held, plugins/guardrails/hooks/merge-guard.sh:53-62. The header says this is deliberate ("a backtick in a quoted --body is refused too; pass such a body with --body-file").
The script is named block-unresolved-pr-merge.sh: not held in this checkout; it is now plugins/guardrails/hooks/merge-guard.sh. The renamed guard still has the behavior, so the issue's UNVERIFIED point is answered.
The header carries a hook-precision rule 2 that says quoted text passes: not verified. The header says the opposite for backticks, so the issue's expectation conflicts with the documented design.
Open questions:
Should the guard stop treating a backtick inside a quoted argument as unresolvable? The header says the pre-filter tracks no quotes on purpose, because a quote tracker can be fooled by a comment or heredoc apostrophe. Quote tracking would weaken a fail-closed security choice.
RECOMMENDED: keep the fail-closed behavior and document --body-file for GraphQL and REST bodies. If the owner wants the narrower rule, accept it only if a test shows 5echo 0`` style substitutions at command position are still blocked. Basis: merge-guard.sh:53-62.
To answer, post a comment that starts with this line:
Refinement. A read-only run explored this repository, searched its issues and pull requests, and read the allowed docs to draft what follows. On an issue a listed human filed, it counts as the issue's spec once posted, while unedited; it is still model text, so check it.
Intended outcome: Either keep the fail-closed backtick refusal and document --body-file for GraphQL and REST reply bodies, or narrow the refusal to command position with tests; the owner has not chosen.
Should the guard keep refusing a backtick inside a quoted argument on a merge-shaped command, as designed, or allow it?
RECOMMENDED: Keep the fail-closed behavior. Document --body-file for GraphQL and REST bodies in the refusal message and the header. This is a decision for the owner. Basis: plugins/guardrails/hooks/merge-guard.sh:53-62
If the owner wants the narrower rule, what quote handling is acceptable, given the header says the pre-filter tracks no quotes on purpose because a comment or heredoc apostrophe can fool a quote tracker?
RECOMMENDED: Accept it only if tests show that 5echo 0`` style substitutions at command position, and merge text inside backticks, are still blocked. Also require a passing test for a backticked gh pr merge 42 inside a GraphQL body. Basis: plugins/guardrails/hooks/merge-guard.sh:57-62
Is the issue's claim that hook-precision rule 2 says quoted text passes correct for backticks?
RECOMMENDED: No. The header applies rule 2 to the matched merge paths (lines 20-21) and then makes an explicit exception for backticks (lines 53-62). Treat the issue as a request to change a documented design, not as a bug. Basis: plugins/guardrails/hooks/merge-guard.sh:20-21
Sources read
/home/runner/work/claude-code-plugins/claude-code-plugins/.base/plugins/guardrails/hooks/merge-guard.sh:48-62: an unresolvable target fails closed. A merge-shaped Bash command that holds a backtick is blocked, and a backtick in a quoted --body is refused too, so pass the body with --body-file.
/home/runner/work/claude-code-plugins/claude-code-plugins/.base/plugins/guardrails/hooks/merge-guard.sh:20-21: merge paths match at a command position, never inside a quoted argument (hook-precision rule 2).
To answer, post a comment that starts with this line:
**Decision recorded.** <answer>
Automated refinement by the lanes App. Answer with a comment whose first line is **Decision recorded.**.
Owner decision on this issue (option A), given in session 2026-11-25T03:15Z.
verbatim: /session-flow:go-with-recommendations, accepting option (A) as recommended.
Options shown: (A) keep the guard and document that a reply or comment quoting a merge command goes through --body-file (or -F body=@file for gh api), which the guard does not scan as a command line; (B) apply the backtick check only at a command position, with a test for a quoted merge command in a GraphQL body; (C) no change.
Decision: (A). The guard keeps failing closed on a backticked merge command in the command text, and this issue's expected behavior becomes "the documented --body-file route passes". Revisit (B) only if quoting a command in a reply keeps recurring.
Activity
github-actions commentedon Nov 24, 2026
Size: Small
Complexity: Medium
Uncertainty: Knowable
Flags: intent
Blocked by: none
Blast radius: the guardrails merge guard (
plugins/guardrails/hooks/merge-guard.sh) and its tests; every Bash command in sessions running the plugin passes through it.Reversible: yes; revert the change to the hook and its tests.
Claims checked:
plugins/guardrails/hooks/merge-guard.sh:53-62. The header says this is deliberate ("a backtick in a quoted --body is refused too; pass such a body with --body-file").block-unresolved-pr-merge.sh: not held in this checkout; it is nowplugins/guardrails/hooks/merge-guard.sh. The renamed guard still has the behavior, so the issue's UNVERIFIED point is answered.Open questions:
RECOMMENDED: keep the fail-closed behavior and document
--body-filefor GraphQL and REST bodies. If the owner wants the narrower rule, accept it only if a test shows5echo 0`` style substitutions at command position are still blocked. Basis:merge-guard.sh:53-62.To answer, post a comment that starts with this line:
Automated triage. A maintainer reviews it.
melodic-automation-lanes commentedon Nov 24, 2026
The triage verdict left this issue at
needs-owner-decision:Reason:
intentmelodic-automation-lanes commentedon Nov 24, 2026
Refinement. A read-only run explored this repository, searched its issues and pull requests, and read the allowed docs to draft what follows. On an issue a listed human filed, it counts as the issue's spec once posted, while unedited; it is still model text, so check it.
Intended outcome: Either keep the fail-closed backtick refusal and document --body-file for GraphQL and REST reply bodies, or narrow the refusal to command position with tests; the owner has not chosen.
Related work
Open questions
RECOMMENDED: Keep the fail-closed behavior. Document --body-file for GraphQL and REST bodies in the refusal message and the header. This is a decision for the owner. Basis: plugins/guardrails/hooks/merge-guard.sh:53-62
RECOMMENDED: Accept it only if tests show that
5echo 0`` style substitutions at command position, and merge text inside backticks, are still blocked. Also require a passing test for a backtickedgh pr merge 42inside a GraphQL body. Basis: plugins/guardrails/hooks/merge-guard.sh:57-62RECOMMENDED: No. The header applies rule 2 to the matched merge paths (lines 20-21) and then makes an explicit exception for backticks (lines 53-62). Treat the issue as a request to change a documented design, not as a bug. Basis: plugins/guardrails/hooks/merge-guard.sh:20-21
Sources read
To answer, post a comment that starts with this line:
Automated refinement by the lanes App. Answer with a comment whose first line is
**Decision recorded.**.kyle-sexton commentedon Nov 25, 2026
Owner decision on this issue (option A), given in session 2026-11-25T03:15Z.
verbatim:
/session-flow:go-with-recommendations, accepting option (A) as recommended.Options shown: (A) keep the guard and document that a reply or comment quoting a merge command goes through
--body-file(or-F body=@fileforgh api), which the guard does not scan as a command line; (B) apply the backtick check only at a command position, with a test for a quoted merge command in a GraphQL body; (C) no change.Decision: (A). The guard keeps failing closed on a backticked merge command in the command text, and this issue's expected behavior becomes "the documented
--body-fileroute passes". Revisit (B) only if quoting a command in a reply keeps recurring.