docs(agents): pass long gh message bodies through a file - #1363
Merged
Merged
Conversation
Inline bodies break in two ways: `$(cat …)`, pipes and redirects keep `gh` inside the sandbox, where it cannot read ~/.config/gh, and the shell rewrites the backticks, `$` and quotes that markdown bodies are full of. A body file also guarantees that what gets posted is the text the maintainer approved. Generated-by: Claude Opus 5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
AGENTS.mdrule: long or multi-line message bodies go togh(and similar CLIs) through a file —--body-file,gh api --input,git commit -F— never as an inline quoted argument,$(cat …), pipe, or heredoc on the command line.ghescapes the sandbox only as a plaingh …command; any$(…), pipe or redirect keeps it sandboxed, where it cannot read~/.config/ghand fails. Markdown bodies are also full of backticks,$and quotes the shell rewrites when inlined. And the file is exactly the text the maintainer approved.gh pr create --webbullet now says--body-fileinstead of--body, consistent with the new rule; close-with-comment is split into a comment-from-file plus a plain close.Hit in practice while closing a PR and an issue:
gh pr close --comment "$(cat …)"and a long quotedgh issue close --comment "…"both failed withfailed to read configuration: open ~/.config/gh/config.yml: operation not permitted; the same text posted fine via--body-file.Type of change
Test plan
prek run --files AGENTS.mdpassesLinked issues
None.
Generative-AI disclosure: drafted with Claude Code (Claude Opus 5); reviewed by the submitter.
🤖 Generated with Claude Code