Skip to content

Triage bot: pass review comment bodies as files, not inline arguments - #5234

Merged
springfall2008 merged 1 commit into
mainfrom
fix/triage-bot-gh-api-body-file
Sep 25, 2026
Merged

springfall2008 merged 1 commit into
mainfrom
fix/triage-bot-gh-api-body-file

Conversation

@springfall2008

Copy link
Copy Markdown
Owner

Why

The bot's /code-review of #5229 found seven issues and posted none of them. From the session transcript, the refused call was:

gh api repos/springfall2008/batpred/pulls/5229/comments -f commit_id=… -f path=apps/predbat/plan.py -F line=349 -f side=RIGHT -f body="**Bug (high): … `car_charging_now` … `raw = self.get_arg(\"car_charging_now\", …)` …"

The endpoint comes first, so Bash(gh api repos/springfall2008/batpred/*) covers it; earlier gh api repos/…/pulls/5229/files reads 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 like car_charging_now that no rule allows, and dontAsk denies 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 PR BOT_FAILED because nothing was posted.

Change

GH_API_ENDPOINT_FIRST_PROMPT now 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 Write and the scratch Edit scope.

Testing

🤖 Generated with Claude Code

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>
@springfall2008
springfall2008 merged commit f0dc5bc into main Sep 25, 2026
2 checks passed
@springfall2008
springfall2008 deleted the fix/triage-bot-gh-api-body-file branch September 25, 2026 17:36
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