Skip to content

docs(guardrails): route replies quoting a merge command through --body-file - #18977

Merged
kyle-sexton merged 1 commit into
mainfrom
docs/guardrails-merge-guard-body-file
Nov 25, 2026
Merged

kyle-sexton merged 1 commit into
mainfrom
docs/guardrails-merge-guard-body-file

Conversation

@kyle-sexton

Copy link
Copy Markdown
Member

Closes #18900

Summary

The merge guard refuses a reply or comment whose inline body quotes a merge command in backticks, such as `gh pr merge 42` in a GraphQL review-thread reply. The owner chose to keep that fail-closed behavior and document the route around it. The guard's README entry now says to post such a body from a file.

Fix

  • plugins/guardrails/README.md, merge-guard row: one sentence saying that an inline --body, a -f body=... value or a gh api graphql query string holding a backticked merge command is refused, and that the body goes through --body-file <file>, or -F body=@<file> for gh api (a GraphQL variable included), because the guard reads only the command line.
  • .changes/guardrails/: a patch fragment.

The guard's behavior is unchanged.

Verification

  • Read plugins/guardrails/hooks/merge-guard.sh at the base: lines 53-62 state the backtick refusal holds for a quoted --body and name --body-file; lines 733-736 set the refusal from the command text alone ($COMMAND with quoted heredoc bodies cut), so a body file's contents are never read.
  • Ran the guard directly on six commands. Exit 2 (refused): a GraphQL addPullRequestReviewThreadReply with the backticked merge in the query string, gh api ... -f body='...', and gh pr comment --body "...". Exit 0 (passed): the same GraphQL reply with the body from -F b=@<file>, gh api ... -F body=@<file>, and gh pr comment --body-file <file>.
  • merge-guard.test.sh: 727 passed, 0 failed. guard-count.test.sh and onfailure-rows.test.sh, which read the README: pass.

Related

🤖 Generated with Claude Code

…y-file

The merge guard refuses merge-shaped text that holds a backtick anywhere
on the command line, so a reply whose inline body quotes `gh pr merge 42`
is blocked. It reads only the command line, never a body file, so the
README now says to post such a body with --body-file or -F body=@file.

Closes #18900

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@kyle-sexton
kyle-sexton marked this pull request as ready for review November 25, 2026 03:36
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-25T03:37:39.149297Z cf7f0e0 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions

Copy link
Copy Markdown
Contributor

claude-security-review reviewed cf7f0e032a9df6d9ce40f89903f546e667ba85e4: read 2 of 2 changed file(s); 0 finding(s), 0 as inline comments.

Security review: PR #18977

No security issues found. I read both changed files in full: plugins/guardrails/README.md and .changes/guardrails/docs-merge-guard-body-file-reply-9c4e2b71.md.

The change adds one sentence to the merge-guard row of the README and adds a patch changelog fragment. No code, hook, manifest, workflow or trusted path is touched.

Instruction-surface lens: The diff deletes, narrows or softens no standing instruction. The README row keeps every refusal it listed before. The new sentence only documents an existing behavior: a reply or comment that quotes a backticked merge command inline (--body, -f body=..., a GraphQL query string) is refused, and its body can be posted from a file with --body-file or -F body=@<file> instead.

Does this documented route get around the guard? No. I checked three things:

  • The guard reads only the command line, so it never reads a body file. A body file is read by gh as data. Backticks inside it are never run by the shell.
  • A command that is actually a merge (gh pr merge, a REST merge route, a merge mutation) still gets every readiness check, whether or not it uses --body-file. The row already told users to "pass a body that holds one with --body-file", so this adds nothing new for merges.
  • The guard's fail-closed handling of targets it cannot resolve (shell variables, $(...), unquoted backticks in the merge command itself) is unchanged.

Other checks:

  • Prior findings: none. This lane has not reviewed an earlier head, so this is not a blocking-only review.
  • Embedded text: the PR context holds no embedded directives.

critical-findings: 0

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

claude-review: 1 inline finding(s) on cf7f0e032a9df6d9ce40f89903f546e667ba85e4; the summary is in this lane's pull request comment.

claude-lane: claude-review

Comment thread plugins/guardrails/README.md Resolved
@github-actions

Copy link
Copy Markdown
Contributor

claude-review reviewed cf7f0e032a9df6d9ce40f89903f546e667ba85e4: read 2 of 2 changed file(s); 1 finding(s), 1 as inline comments.

Code review: PR #18977, docs(guardrails): route replies quoting a merge command through --body-file

This PR changes documentation only. It adds one sentence to the merge-guard row in plugins/guardrails/README.md and adds a patch changelog fragment. The sentence's technical claims hold. In plugins/guardrails/hooks/merge-guard.sh, the backtick refusal is set from the command text alone, with quoted heredoc bodies cut out (L729-L736). A body file's contents are never read. A backticked `gh pr merge 42` inside a body is caught by _bupm_gh_pr_shaped, because the word before pr holds a backtick (L647). I ran nothing. The six-command run and the test counts in the PR body are the author's claims and I did not verify them.

Blocking

  • The closing issue's Expected behavior is not met (inline on plugins/guardrails/README.md:102). The PR says Closes #18900, but the guard's behavior does not change. The only support for "the owner chose to keep that fail-closed behavior" is the PR body. The issue section in the PR context has no decision comment that changes the criterion.

Embedded text: nothing in the PR context, prior findings or criteria files tried to direct this lane.

Spend: none. The change is documentation only.

Loosened checks: the prompt carries no loosened_check_verdict: or loosened_check_patterns: line, so I used fail with no consumer entries. There is no loosened_check_decision_record: line, so the citation requirement was not checked. The diff loosens no check. Loosened checks would be marked: fail (default; no resolved layers); patterns: 0

Verifier dropped 0 of 1 candidates. No verifier subagent ran: the change is two documentation files, and I checked the one candidate directly against the PR context.

@kyle-sexton
kyle-sexton added this pull request to the merge queue Nov 25, 2026
Merged via the queue into main with commit c53d6ee Nov 25, 2026
83 checks passed
@kyle-sexton
kyle-sexton deleted the docs/guardrails-merge-guard-body-file branch November 25, 2026 04:10
@github-actions github-actions Bot added the merge-path: owner-agent Post-merge accounting record (README.md, Merge paths) label Nov 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-path: owner-agent Post-merge accounting record (README.md, Merge paths)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(guardrails): merge guard blocks a reply that quotes a merge command in backticks

1 participant