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
guardrails: block-unresolved-pr-merge fires on merge-endpoint text inside a heredoc body #8949
agent-readyFully specified and briefed; eligible for autonomous pickup from the frontier.status: readyTriaged, unblocked, and fully specified; eligible to pick up.
block-unresolved-pr-merge.sh (guardrails) blocked a Bash call that merges nothing. The command was python3 -I - <file> <<'EOF' ... EOF: a heredoc script that edits deny-rule strings in a JSON file, holding text like "Bash(gh api *pulls/*/merge)" and a markdown line with backticks. The hook read it as a merge whose target it could not resolve:
BLOCKED: guardrails could not tell which pull request this merge targets (the command holds a backtick, ...)
Writing the same script to a file and running python3 -I <script> <args> passed, so the false positive costs one detour each time.
Expected
The hook fires only when the command runs gh pr merge or calls the merge endpoint, not when that text appears inside a quoted heredoc body passed to another program.
Fix
Per the hook-precision convention: land the fix with a stay-quiet test (heredoc body holding pulls/*/merge and backticks, fed to python3 -) that fails before the fix.
Proposed work class: work-class: scoped
Basis: automated intake triage; the lanes App applied this class.
Size: Small
Complexity: Medium
Uncertainty: Known
Flags: none
Blocked by: none
Decision recorded. The owner answered in the Refinement and Issue Triage sessions (2026-10-25), deciding the open items below on the facts:
[quote truncated; the full decision is at the link] #8949 (comment)
The decision settles the open questions: quoted-heredoc bodies are found through the shared parser, and shell-fed, unquoted or unreadable bodies keep today's refusal. The work is a focused fix to the merge-gate hook's pre-filter, with stay-quiet and still-refuse tests.
Two more instances on 2026-10-24 (guardrails 0.55.4, Claude Code 2.1.310), branch feat/session-flow-handoff-efficiency. Neither command merges anything:
A python3 - <<'EOF' ... EOF heredoc that edits eval-case JSON. Its Python source holds regex strings for the merge subcommand, for example a pattern matching a merge of PR 4231. Denied with "could not tell which pull request this merge targets (the command holds a backtick ...)".
A git commit -q -F - <<'MSG' ... MSG whose commit message described, in backticks, a probe that missed the merge subcommand with a flag before the PR number. Denied the same way. Writing the message to a file and using git commit -F <file> went through.
In both, the merge text is data inside a heredoc, as in this issue's report. A stay-quiet test for each shape would cover them: a heredoc body or a -F - message that mentions the merge subcommand.
Not admitted to the issue lane: no trusted-human acceptance criteria: a listed human must put the confirmed - [ ] criteria in the body or post them as their own comment, or, on an issue a listed human filed, intake's newest refinement comment must hold them unedited. Admission takes the issue once each of those is met, when intake triages it again (.github/actions/resolve-config/admission-rules.json).
melodic-automation-lanes commented on Oct 26, 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: block-unresolved-pr-merge.sh no longer refuses on a backtick when the merge-shaped text sits only inside the body of a quoted-delimiter heredoc, including the python3 - and git commit -F - shapes, and still refuses a real merge outside the body.
Acceptance criteria
In plugins/guardrails/hooks/block-unresolved-pr-merge.sh the backtick refusal (the branch near line 557) and the backslash-newline refusal (near line 561) test merge-shaped text with the bodies of quoted-delimiter heredocs (<<'X', <<"X", <<-'X') removed
A new quiet case in block-unresolved-pr-merge.test.sh feeds python3 -I - file <<'EOF' with a body holding "Bash(gh api pulls//merge)" and a markdown line with backticks, and expects exit 0 with no output
A new quiet case feeds git commit -q -F - <<'MSG' with a body that mentions pr merge with a flag before the PR number, in backticks, and expects exit 0
A new quiet case feeds python3 - <<'EOF' with a body of regex strings for the merge subcommand of PR 4231 and a backtick, and expects exit 0
Each new quiet case fails when run against the hook as it is today and passes after the fix
A real merge outside the heredoc body still refuses: for example gh pr merge 5echo 0 -R acme/widgets placed after a quoted heredoc is still unresolvable
The existing unresolvable cases at test.sh:656 (unquoted heredoc, then a backtick merge) and test.sh:665 (quoted heredoc ending in a backslash, then a merge) still pass
An unquoted-delimiter heredoc body is not stripped, because bash expands backticks in it, so a backtick merge inside it still refuses
The header comment of block-unresolved-pr-merge.sh (lines 58-60, which says quoting is not judged and heredoc text is refused) is updated to describe the quoted-heredoc exemption
none; #9887 (closed PR on target-resolution gaps) touches the same hook, but the checkout has no heredoc handling from it, so expect small merge conflicts if it is reopened
plugins/guardrails/hooks/block-unresolved-pr-merge.sh:557: the backtick refusal fires on any command holding a backtick plus rest_re, gql_re or a gh-pr-shaped match, with no heredoc handling
plugins/guardrails/hooks/block-unresolved-pr-merge.sh:495: rest_re matches pulls/<x>/merge anywhere in the text, so heredoc data matches
plugins/guardrails/hooks/block-unresolved-pr-merge.sh:58: the header says quoting is not judged and a heredoc backtick is refused
plugins/guardrails/hooks/block-unresolved-pr-merge.test.sh:656: an unquoted heredoc followed by a backtick merge must stay refused
plugins/guardrails/hooks/block-unresolved-pr-merge.test.sh:687: existing quiet case for a git commit -F - heredoc whose body only mentions merge and pulls/, without the merge route
plugins/guardrails/hooks/block-unresolved-pr-merge.test.sh:809: existing quiet case for a gh pr merge heredoc body with no backtick
Automated refinement by the lanes App. Intake triages the issue again with it.
Decision recorded. The owner answered in the Refinement and Issue Triage sessions (2026-10-25), deciding the open items below on the facts:
go with whatever the facts/data/metrics + /discovery:research says and ensure we're aligned with SOLID, DRY/SSOT principles
I should only ever be in the loop ONLY when necessary (intent/vision changed, something came up during implementation that impacts trajectory/alignment, OR a high security risk) - I've covered this all before
No owner ledger (.work/*/interview-checklist.md, .work/gh-monitor-owner-decisions/) names this issue. Read against origin/main at a6ba1c4c18.
The over-fire is still on main. block-unresolved-pr-merge.sh refuses any Bash command that holds a backtick and merge-shaped text (:557-560). It runs that test on the raw text, before any parse. The REST pattern matches pulls/<x>/merge anywhere (:495). The header says why the pre-filter judges no quoting: "a comment or heredoc apostrophe would fool a quote tracker" (:58-60). The kyle-sexton comment of 2026-10-24 reports two more cases of the same kind: a python3 - <<'EOF' body and a git commit -q -F - <<'MSG' message.
This hook is a merge gate, so the fix must not let a real merge through. Two facts bound it:
The shared parser already finds heredoc bodies with quote awareness. Quoted spans are consumed before the << check, so an opener inside quotes is not an opener. The parser records the delimiter, whether it was quoted, and the <<- tab strip, and skips the body as stdin (plugins/guardrails/hooks/hook-utils.sh:4620-4622, :4745-4760, :4843-4852). The existing quiet case test.sh:809 (cat <<'EOF' > notes.md holding gh pr merge 42) shows that.
A quoted heredoc fed to a shell runs its body as commands. Today the backtick pre-filter refuses bash <<'EOF' holding a backtick merge, because it fires on any backtick plus merge text (:557). Stripping that body would make the command pass, which is a weakening.
How are quoted-heredoc bodies found?
Decided: through the shared parser's heredoc detection, not a second quote tracker in the pre-filter. The pre-filter tests the backtick and continuation patterns on the command text with only the bodies of quoted-delimiter heredocs (<<'X', <<"X", <<\X, <<-'X') removed, as that parser bounds them. Basis: one quote-aware source of heredoc spans (DRY), and the header's reason for not judging quotes (:58-60) applies to a new tracker, not to that parser.
Which bodies stay unstripped?
Decided: an unquoted-delimiter body, since bash expands backticks in it. Also a quoted body whose command word is a shell (bash, sh, zsh, dash, ksh, eval, source, .) or cannot be read (holds $ or a backtick, as _bupm_gh_pr_shaped treats it at :524-525). Those keep today's refusal.
Acceptance criteria:
In plugins/guardrails/hooks/block-unresolved-pr-merge.sh, the backtick refusal and the backslash-newline refusal test the command with quoted-delimiter heredoc bodies removed, as the shared parser bounds them, except for the bodies named in decision 2.
New quiet cases in block-unresolved-pr-merge.test.sh, each failing against today's hook and passing after the fix: python3 -I - file <<'EOF' whose body holds "Bash(gh api *pulls/*/merge)" and a markdown line with backticks; python3 - <<'EOF' whose body holds regex strings for the merge subcommand and a backtick; git commit -q -F - <<'MSG' whose message mentions the merge subcommand, with a flag before the PR number, in backticks.
New unresolvable cases still refuse: an opener inside quotes (echo "<<'EOF'" then gh pr merge 5echo 0 -R acme/widgets); a backtick merge after a quoted heredoc closes; a backtick merge inside an unquoted heredoc body; a backtick merge inside a quoted heredoc fed to bash; a backtick merge after two heredocs opened on one line; a <<-'X' body with tab-indented delimiter followed by a backtick merge.
The existing unresolvable cases at test.sh:656 and test.sh:665 still pass.
The header comment (:58-60) states the quoted-heredoc exemption and its limits.
agent-readyFully specified and briefed; eligible for autonomous pickup from the frontier.status: readyTriaged, unblocked, and fully specified; eligible to pick up.
Activity
github-actions commentedon Oct 21, 2026
Proposed work class: work-class: scoped
Basis: automated intake triage; the lanes App applied this class.
Size: Small
Complexity: Medium
Uncertainty: Known
Flags: none
Blocked by: none
The decision settles the open questions: quoted-heredoc bodies are found through the shared parser, and shell-fed, unquoted or unreadable bodies keep today's refusal. The work is a focused fix to the merge-gate hook's pre-filter, with stay-quiet and still-refuse tests.
Automated triage, applied by the lanes App.
kyle-sexton commentedon Oct 24, 2026
Two more instances on 2026-10-24 (guardrails 0.55.4, Claude Code 2.1.310), branch
feat/session-flow-handoff-efficiency. Neither command merges anything:python3 - <<'EOF' ... EOFheredoc that edits eval-case JSON. Its Python source holds regex strings for the merge subcommand, for example a pattern matching a merge of PR 4231. Denied with "could not tell which pull request this merge targets (the command holds a backtick ...)".git commit -q -F - <<'MSG' ... MSGwhose commit message described, in backticks, a probe that missed the merge subcommand with a flag before the PR number. Denied the same way. Writing the message to a file and usinggit commit -F <file>went through.In both, the merge text is data inside a heredoc, as in this issue's report. A stay-quiet test for each shape would cover them: a heredoc body or a
-F -message that mentions the merge subcommand.github-actions commentedon Oct 26, 2026
The triage sweep dispatched intake triage for this issue (attempt 1 of 2).
melodic-automation-lanes commentedon Oct 26, 2026
Not admitted to the issue lane: no trusted-human acceptance criteria: a listed human must put the confirmed
- [ ]criteria in the body or post them as their own comment, or, on an issue a listed human filed, intake's newest refinement comment must hold them unedited. Admission takes the issue once each of those is met, when intake triages it again (.github/actions/resolve-config/admission-rules.json).melodic-automation-lanes commentedon Oct 26, 2026
The latest triage verdict holds nothing: the issue is at
status: ready.melodic-automation-lanes commentedon Oct 26, 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: block-unresolved-pr-merge.sh no longer refuses on a backtick when the merge-shaped text sits only inside the body of a quoted-delimiter heredoc, including the python3 - and git commit -F - shapes, and still refuses a real merge outside the body.
Acceptance criteria
echo 0-R acme/widgets placed after a quoted heredoc is still unresolvableDependencies
Related work
Sources read
Automated refinement by the lanes App. Intake triages the issue again with it.
kyle-sexton commentedon Oct 26, 2026
Decision recorded. The owner answered in the Refinement and Issue Triage sessions (2026-10-25), deciding the open items below on the facts:
No owner ledger (
.work/*/interview-checklist.md,.work/gh-monitor-owner-decisions/) names this issue. Read against origin/main ata6ba1c4c18.The over-fire is still on main.
block-unresolved-pr-merge.shrefuses any Bash command that holds a backtick and merge-shaped text (:557-560). It runs that test on the raw text, before any parse. The REST pattern matchespulls/<x>/mergeanywhere (:495). The header says why the pre-filter judges no quoting: "a comment or heredoc apostrophe would fool a quote tracker" (:58-60). The kyle-sexton comment of 2026-10-24 reports two more cases of the same kind: apython3 - <<'EOF'body and agit commit -q -F - <<'MSG'message.This hook is a merge gate, so the fix must not let a real merge through. Two facts bound it:
<<check, so an opener inside quotes is not an opener. The parser records the delimiter, whether it was quoted, and the<<-tab strip, and skips the body as stdin (plugins/guardrails/hooks/hook-utils.sh:4620-4622,:4745-4760,:4843-4852). The existing quiet casetest.sh:809(cat <<'EOF' > notes.mdholdinggh pr merge 42) shows that.bash <<'EOF'holding a backtick merge, because it fires on any backtick plus merge text (:557). Stripping that body would make the command pass, which is a weakening.Decided: through the shared parser's heredoc detection, not a second quote tracker in the pre-filter. The pre-filter tests the backtick and continuation patterns on the command text with only the bodies of quoted-delimiter heredocs (
<<'X',<<"X",<<\X,<<-'X') removed, as that parser bounds them. Basis: one quote-aware source of heredoc spans (DRY), and the header's reason for not judging quotes (:58-60) applies to a new tracker, not to that parser.Decided: an unquoted-delimiter body, since bash expands backticks in it. Also a quoted body whose command word is a shell (
bash,sh,zsh,dash,ksh,eval,source,.) or cannot be read (holds$or a backtick, as_bupm_gh_pr_shapedtreats it at:524-525). Those keep today's refusal.Acceptance criteria:
plugins/guardrails/hooks/block-unresolved-pr-merge.sh, the backtick refusal and the backslash-newline refusal test the command with quoted-delimiter heredoc bodies removed, as the shared parser bounds them, except for the bodies named in decision 2.block-unresolved-pr-merge.test.sh, each failing against today's hook and passing after the fix:python3 -I - file <<'EOF'whose body holds"Bash(gh api *pulls/*/merge)"and a markdown line with backticks;python3 - <<'EOF'whose body holds regex strings for the merge subcommand and a backtick;git commit -q -F - <<'MSG'whose message mentions the merge subcommand, with a flag before the PR number, in backticks.echo "<<'EOF'"thengh pr merge 5echo 0-R acme/widgets); a backtick merge after a quoted heredoc closes; a backtick merge inside an unquoted heredoc body; a backtick merge inside a quoted heredoc fed tobash; a backtick merge after two heredocs opened on one line; a<<-'X'body with tab-indented delimiter followed by a backtick merge.test.sh:656andtest.sh:665still pass.:58-60) states the quoted-heredoc exemption and its limits.bash plugins/guardrails/hooks/block-unresolved-pr-merge.test.shexits 0.