fix(code-review): use --body-file to preserve newlines in summary comment#57199
Open
AoTo0330 wants to merge 1 commit intoanthropics:mainfrom
Open
fix(code-review): use --body-file to preserve newlines in summary comment#57199AoTo0330 wants to merge 1 commit intoanthropics:mainfrom
AoTo0330 wants to merge 1 commit intoanthropics:mainfrom
Conversation
…ment When the LLM generates `gh pr comment <PR> -b "## Code review\n\n..."`, bash does not interpret `\n` inside double quotes, so the body is stored on GitHub as literal backslash-n characters. The resulting comment renders as a single unreadable line. Fix the skill prompt to mandate `--body-file` with a heredoc-written temporary file, which preserves real newlines through bash → gh → GitHub API. Tracking upstream issue: anthropics#57197
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
The
code-reviewskill (plugins/code-review/commands/code-review.md) instructs the LLM to usegh pr commentfor the no-issue summary comment, but does not specify a safe quoting form. When the LLM generates:gh pr comment 449 -b "## Code review\n\n..."bash does not interpret
\ninside double quotes, so 2 literal characters (\+n) are passed toghand stored on GitHub as-is. The resulting comment renders as a single unreadable line in the GitHub UI.This fix updates §7 of the skill prompt to mandate
--body-filewith a heredoc-written temp file, preserving real newlines through bash → gh → GitHub API.Tracking issue
#57197 — includes reproduction (one occurrence in 8 PRs in a private downstream repo, ~12% rate; auto-recovered on next push).
Path coverage
This is the only LLM-driven path that handles raw bash strings:
mcp__github_inline_comment__create_inline_comment)claude-code-actionorchestration (run.tsetc.)gh pr commentinstruction (§7)Test plan
/code-review:code-review --comment <PR>against a PR with no issues\n)gh api repos/.../issues/<N>/comments) contains real LF characters, not\\n