From 2e7c5ed388ce0b7ef6a9a800819a1cced1bae969 Mon Sep 17 00:00:00 2001 From: Kyle Sexton <153232337+kyle-sexton@users.noreply.github.com> Date: Sun, 2 Aug 2026 17:49:27 -0400 Subject: [PATCH 1/3] fix(claude-review): direct the review lane to post line-anchored inline comments MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The lane has been granted `mcp__github_inline_comment__create_inline_comment` since the lanes landed, and the effective SDK `allowedTools` echo confirms it reaches the agent — but the assembled prompt never mentioned it, while the action's own base prompt routes every response into the single sticky comment ("Never create new comments. Only update the existing comment using mcp__github_comment__update_claude_comment") and lists submitting a formal PR review under what the agent cannot do. An unmentioned grant under that steering reads as unusable, and the lane has produced zero inline comments fleet-wide. The security lane carries the identical grant and DOES produce line-anchored comments; the only prompt-level difference is that its criteria body says "Report findings as a pull request review". This adds the equivalent instruction to the code-review lane, and names the tool outright so the grant is discoverable rather than merely present. Placed in the step's prompt wrapper rather than the `prompt` input default: the input's documented contract is "just the instructions for what to look for", so reporting mechanics belong with the structural header and permalink form — and the wrapper survives a caller that overrides the criteria body. The pre-existing permalink guidance is scoped rather than removed: it now covers findings no changed line can carry, so it no longer competes with the inline-comment instruction for the same finding. Co-authored-by: Claude Opus 5 (1M context) --- .github/workflows/claude-review.yml | 46 ++++++++++++++++++++++------- 1 file changed, 36 insertions(+), 10 deletions(-) diff --git a/.github/workflows/claude-review.yml b/.github/workflows/claude-review.yml index e262ab4a..40a7b56e 100644 --- a/.github/workflows/claude-review.yml +++ b/.github/workflows/claude-review.yml @@ -91,8 +91,10 @@ on: prompt: description: >- The review-criteria body. A REPO / PR NUMBER / HEAD SHA header and - commit-permalink guidance are prepended automatically, so this input - is just the instructions for what to look for. + the lane's reporting mechanics — inline-comment anchoring, and the + commit-permalink form for findings no changed line can carry — wrap + it automatically, so this input is just the instructions for what to + look for. type: string default: >- This is the CODE-REVIEW lane. Review this pull request for @@ -467,7 +469,13 @@ jobs: claude_args: ${{ steps.compose-args.outputs.args }} # github-context expressions must appear directly in the step (a value # carried in via inputs.prompt is NOT re-evaluated), so the structural - # header + permalink guidance live here and wrap the consumer's body. + # header + reporting mechanics live here and wrap the consumer's body. + # + # The inline-comment tool is NAMED, not merely granted in claude_args: + # the action's base prompt routes every response into the single + # sticky comment ("Never create new comments") and lists submitting a + # PR review under what the agent cannot do, so a grant the prompt + # never mentions reads as unusable and goes uncalled. prompt: | REPO: ${{ github.repository }} PR NUMBER: ${{ github.event.pull_request.number }} @@ -475,8 +483,17 @@ jobs: ${{ inputs.prompt }} - When referencing specific code locations in findings, link to the - commit blob (not the PR) using a permalink with line numbers: + Report findings as a pull request review: call + mcp__github_inline_comment__create_inline_comment to anchor each + finding to the changed line it is about. That tool is granted to + this lane, and a line-anchored comment is what puts a finding next + to the code it concerns. Keep your summary comment for the + overview. + + A finding no changed line can carry — cross-file, or about the PR + as a whole — goes in the summary comment instead; link its code + locations to the commit blob (not the PR) with a line-numbered + permalink: https://github.com/${{ github.repository }}/blob/${{ github.event.pull_request.head.sha }}/#L # ONE bounded, gated retry: this lane is advisory, but a zero-turn blip @@ -690,9 +707,9 @@ jobs: allowed_bots: ${{ inputs.allowed-bots }} exclude_comments_by_actor: ${{ inputs.exclude-comments-by-actor }} claude_args: ${{ steps.compose-args.outputs.args }} - # github-context expressions must appear directly in the step (a value - # carried in via inputs.prompt is NOT re-evaluated), so the structural - # header + permalink guidance live here and wrap the consumer's body. + # Verbatim copy of the first attempt's prompt (see its comment for why + # the reporting mechanics live here rather than in inputs.prompt); the + # two must not diverge. prompt: | REPO: ${{ github.repository }} PR NUMBER: ${{ github.event.pull_request.number }} @@ -700,8 +717,17 @@ jobs: ${{ inputs.prompt }} - When referencing specific code locations in findings, link to the - commit blob (not the PR) using a permalink with line numbers: + Report findings as a pull request review: call + mcp__github_inline_comment__create_inline_comment to anchor each + finding to the changed line it is about. That tool is granted to + this lane, and a line-anchored comment is what puts a finding next + to the code it concerns. Keep your summary comment for the + overview. + + A finding no changed line can carry — cross-file, or about the PR + as a whole — goes in the summary comment instead; link its code + locations to the commit blob (not the PR) with a line-numbered + permalink: https://github.com/${{ github.repository }}/blob/${{ github.event.pull_request.head.sha }}/#L # Collapse the two attempts into the one pair of facts the outcome step From 923a2d23e9a55019efc073111b0f543f1c1bffd5 Mon Sep 17 00:00:00 2001 From: Kyle Sexton <153232337+kyle-sexton@users.noreply.github.com> Date: Mon, 3 Aug 2026 18:14:34 -0400 Subject: [PATCH 2/3] fix(claude-review): make the inline-comment grant survive caller overrides MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The wrapper prompt names mcp__github_inline_comment__create_inline_comment unconditionally and asserts it is granted to this lane, but the grant lived in the `claude-args` input default — which a caller replaces wholesale. Any consumer passing claude-args for an unrelated reason (selecting a model, say) silently dropped it, leaving the prompt directing every line-anchorable finding at a tool that was not there. The failure is worse than an un-granted tool. In tag mode the action derives which GitHub MCP servers to install from these same args (`parseAllowedTools` -> `prepareMcpConfig({ allowedTools })`), so without the grant the inline-comment server is never installed at all. Fix: the compose step appends the grant unconditionally, and it comes out of the overridable default. That step feeds both the first attempt and the retry, so one edit covers both. Repeated --allowedTools flags accumulate and dedupe rather than overwrite (parse-sdk-options.ts ACCUMULATING_FLAGS, with tests), so the append only ever adds to whatever the caller passed — and tag mode already relies on that union, emitting its own --allowedTools before appending the caller's. `Bash(gh pr diff:*)` deliberately stays in the overridable default: the instruction that uses it lives in the equally overridable `prompt` input, so the two co-vary correctly. The invariant is that whatever the non-overridable wrapper prompt asserts must itself be non-overridable. Verified against the pinned action's own parser: the default path yields the same effective tool set as before this change, every override scenario keeps the grant, and the pre-fix override yields an empty tool list. Also records the widened trust surface in the SECURITY MODEL block. The inline tool is now on the hot path, so untrusted diff content reaches a rendered comment that can carry an appliable suggestion block. The action sanitizes bodies for hidden markup and leaked tokens but not for meaning, and its buffer-and-classify step targets test/probe comments and is skipped when the agent passes confirmed: true — neither is an injection control. Co-authored-by: Claude Opus 5 (1M context) --- .github/workflows/claude-review.yml | 34 +++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 7 deletions(-) diff --git a/.github/workflows/claude-review.yml b/.github/workflows/claude-review.yml index 40a7b56e..60f36023 100644 --- a/.github/workflows/claude-review.yml +++ b/.github/workflows/claude-review.yml @@ -68,6 +68,16 @@ name: claude-review # - The action gates triggering on the actor's write access; bots are blocked # unless named in `allowed-bots`. # - `display-report` / `show_full_output` stay off (public-repo log-leak risk). +# - The inline-comment tool is now on the hot path (the prompt routes every +# line-anchorable finding through it), so untrusted diff content — including +# an `allowed-bots` actor's third-party changelog text — reaches a rendered +# comment that can carry a one-click-appliable ```suggestion block. This is +# a WIDENED surface, not a new one: the grant predates this and the security +# lane already drives the same tool. Do not mistake the action's own +# controls for injection defences — it sanitizes bodies (hidden markup, +# invisible characters, leaked tokens) but not their meaning, and its +# buffer-and-classify step drops test/probe comments, not malicious ones, +# and is skipped outright when the agent passes `confirmed: true`. # - The standards-ref mount is opt-in and unenforced HERE by design (see the # CONSUMER CONTRACT note above): this workflow has no reliable way to know # a calling repo's own visibility from within a reusable-workflow context, @@ -122,16 +132,17 @@ on: Passed through to the Claude CLI. The universal extension point: model, turn budget, allowed tools, system prompt, MCP config all ride here (the standalone model / max_turns / allowed_tools action inputs are - deprecated upstream). The default allows the inline-comment MCP tool - so findings can land as line-anchored review comments, and a scoped - `Bash(gh pr diff:*)` grant so the prompt's "use `gh pr diff`" - instruction is actually sanctioned — a read-only diff-enumeration - command, matching the minimal-grant pattern the action's own - security docs recommend for `gh` subcommands. + deprecated upstream). A caller's value REPLACES this default outright, + so only overridable choices live here: the scoped `Bash(gh pr diff:*)` + grant that sanctions the prompt's "use `gh pr diff`" instruction — a + read-only diff-enumeration command, matching the minimal-grant pattern + the action's own security docs recommend for `gh` subcommands. The + inline-comment tool grant is deliberately NOT here — the compose step + appends it so an override cannot drop it. type: string default: >- --model claude-sonnet-5 --max-turns 75 - --allowedTools "mcp__github_inline_comment__create_inline_comment,Bash(gh pr diff:*)" + --allowedTools "Bash(gh pr diff:*)" track-progress: description: >- Create one tracking comment with progress checkboxes, sticky-updated @@ -437,6 +448,15 @@ jobs: if [ -n "$STANDARDS_REF" ]; then args="$args --add-dir $MOUNT_PATH" fi + # The prompt below names the inline-comment tool unconditionally, so + # the grant has to be unconditional too — it cannot sit in the + # claude-args default, which a caller replaces wholesale. Dropping it + # does not merely un-grant the tool: the action derives which MCP + # servers to install from these same args, so the server would never + # be installed and the prompt would direct findings at a tool that is + # not there. Repeated --allowedTools flags accumulate and dedupe, so + # this only ever adds to whatever the caller passed. + args="$args --allowedTools mcp__github_inline_comment__create_inline_comment" # claude-args may be multiline (callers can pass YAML `|`), so emit it # with the heredoc output form and a random delimiter — a single-line # `args=$args` write corrupts $GITHUB_OUTPUT on any newline. From 8d7ab14e24bed2fafe154131c4bf45c11e4466f4 Mon Sep 17 00:00:00 2001 From: Kyle Sexton <153232337+kyle-sexton@users.noreply.github.com> Date: Mon, 3 Aug 2026 18:33:11 -0400 Subject: [PATCH 3/3] docs(claude-review): correct two inaccurate claims in the lane's comments MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Independent verification of the previous commit turned up two statements that are not true, in a file where the comments are the contract. The SECURITY MODEL bullet said the action's buffer-and-classify step drops test/probe comments. It drops nothing in this lane: classification requires ANTHROPIC_API_KEY, and this lane passes only claude_code_oauth_token, so classifyComments returns null and every buffered comment posts. The error ran in the reassuring direction — it described a filter that is not there — so the note now says the step fails open here. The step comment claimed a granted tool the prompt never mentions "reads as unusable and goes uncalled". This repo's own security lane disproves it: that lane grants the tool, never names it in its prompt, runs in the same tag mode under the same base prompt, and does post inline comments. The load-bearing part is instructing the agent to report findings as a pull request review, which is what that lane has and this one lacked. Naming the tool is belt-and-braces, and the comment now says so. Also scoped the claude-args note: appending the grant defeats a caller replacing the default, not an explicit --disallowedTools for that tool. No behavior change; comments and input description only. Co-authored-by: Claude Opus 5 (1M context) --- .github/workflows/claude-review.yml | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/.github/workflows/claude-review.yml b/.github/workflows/claude-review.yml index 60f36023..62b39a9e 100644 --- a/.github/workflows/claude-review.yml +++ b/.github/workflows/claude-review.yml @@ -76,8 +76,10 @@ name: claude-review # lane already drives the same tool. Do not mistake the action's own # controls for injection defences — it sanitizes bodies (hidden markup, # invisible characters, leaked tokens) but not their meaning, and its -# buffer-and-classify step drops test/probe comments, not malicious ones, -# and is skipped outright when the agent passes `confirmed: true`. +# buffer-and-classify step filters nothing HERE: classification needs +# ANTHROPIC_API_KEY, which this lane never passes (OAuth only), so it fails +# open and posts every buffered comment — and `confirmed: true` skips the +# buffer outright anyway. # - The standards-ref mount is opt-in and unenforced HERE by design (see the # CONSUMER CONTRACT note above): this workflow has no reliable way to know # a calling repo's own visibility from within a reusable-workflow context, @@ -138,7 +140,8 @@ on: read-only diff-enumeration command, matching the minimal-grant pattern the action's own security docs recommend for `gh` subcommands. The inline-comment tool grant is deliberately NOT here — the compose step - appends it so an override cannot drop it. + appends it, so replacing this default cannot drop it (an explicit + `--disallowedTools` for that tool still wins, as it should). type: string default: >- --model claude-sonnet-5 --max-turns 75 @@ -491,11 +494,13 @@ jobs: # carried in via inputs.prompt is NOT re-evaluated), so the structural # header + reporting mechanics live here and wrap the consumer's body. # - # The inline-comment tool is NAMED, not merely granted in claude_args: - # the action's base prompt routes every response into the single - # sticky comment ("Never create new comments") and lists submitting a - # PR review under what the agent cannot do, so a grant the prompt - # never mentions reads as unusable and goes uncalled. + # The prompt has to ask for findings AS A PR REVIEW: the action's base + # prompt routes every response into the single sticky comment ("Never + # create new comments") and lists submitting a PR review under what + # the agent cannot do, so without a counter-instruction the grant goes + # uncalled. That instruction is the load-bearing part — the security + # lane carries it, never names the tool, and does post inline + # comments. Naming the tool here is belt-and-braces, not the mechanism. prompt: | REPO: ${{ github.repository }} PR NUMBER: ${{ github.event.pull_request.number }}