Skip to content

docs(agents): pass long gh message bodies through a file - #1363

Merged
potiuk merged 1 commit into
apache:mainfrom
potiuk:docs/agents-gh-body-files
Sep 23, 2026
Merged

potiuk merged 1 commit into
apache:mainfrom
potiuk:docs/agents-gh-body-files

Conversation

@potiuk

@potiuk potiuk commented Sep 23, 2026

Copy link
Copy Markdown
Member

Summary

  • New AGENTS.md rule: long or multi-line message bodies go to gh (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.
  • Why: under the secure agent setup gh escapes the sandbox only as a plain gh … command; any $(…), pipe or redirect keeps it sandboxed, where it cannot read ~/.config/gh and 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.
  • The gh pr create --web bullet now says --body-file instead 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 quoted gh issue close --comment "…" both failed with failed to read configuration: open ~/.config/gh/config.yml: operation not permitted; the same text posted fine via --body-file.

Type of change

  • Cross-cutting (RFC, AGENTS.md, sandbox, privacy-LLM)

Test plan

  • prek run --files AGENTS.md passes

Linked issues

None.


Generative-AI disclosure: drafted with Claude Code (Claude Opus 5); reviewed by the submitter.

🤖 Generated with Claude Code

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
@potiuk
potiuk merged commit 6f4b191 into apache:main Sep 23, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant