Repository navigation
Triage bot: pass review comment bodies as files, not inline arguments - #5234
Merged
Merged
Conversation
PR #5229's /code-review found seven issues and posted none of them. Its POST was endpoint-first, which the scoped gh api allowlist covers, but the body went in as a double-quoted -f argument full of backticks. The shell reads those as command substitution, so the permission check saw extra commands no rule allows and dontAsk denied the whole call. Nearly every review comment quotes code, so this blocks almost every review. GH_API_ENDPOINT_FIRST_PROMPT now tells the agent to write each body to the scratch directory and pass it with -F body=@<file>, and its worked example does the same. No allowlist change: both flows that append the prompt (review and cleanup) already hold Write and the scratch Edit scope. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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.
Why
The bot's
/code-reviewof #5229 found seven issues and posted none of them. From the session transcript, the refused call was:The endpoint comes first, so
Bash(gh api repos/springfall2008/batpred/*)covers it; earliergh api repos/…/pulls/5229/filesreads in the same run went through. The problem is the body. It's inside double quotes and full of backticks, so the shell treats them as command substitution. The permission check then sees commands likecar_charging_nowthat no rule allows, anddontAskdenies the whole call. Review comments almost always quote code, so this blocks nearly every review from posting. The run exits 0, and the daemon labels the PRBOT_FAILEDbecause nothing was posted.Change
GH_API_ENDPOINT_FIRST_PROMPTnow tells the agent to write each comment body to a file in the scratch directory with the Write tool, then pass it as-F body=@<file>, never as an inline argument. The worked example in the prompt uses the same form.The allowlist doesn't change. Both flows that append this prompt, review and cleanup, already have
Writeand the scratchEditscope.Testing
GhApiFormPromptTests.test_steers_comment_bodies_into_a_scratch_file: fails before the change, passes after.python3 -m unittest test_triage_daemon: 264 tests pass.-F body=@filefrom a scratch directory.🤖 Generated with Claude Code