Skip to content

fix(source-control): make the evidence step's body file get written with the Write tool - #17215

Merged
kyle-sexton merged 1 commit into
mainfrom
fix/evidence-body-write-tool
Nov 18, 2026
Merged

kyle-sexton merged 1 commit into
mainfrom
fix/evidence-body-write-tool

Conversation

@kyle-sexton

Copy link
Copy Markdown
Member

No related issue: an eval-measured weakness in one skill step, found while running the evidence suite; no issue tracks it.

session: AI Hero

Summary

The pull-request skill's evidence step 4 says to write the comment body with the Write tool, and sessions ignored it about half the time: the body-written-with-write grader in the four pull-request-evidence-* cases passed 6 of 12 runs on main. A reproduction of the small case at main (0 of 3) showed why. Each run folded steps 4, 5 and 8 into one Bash call, cat > $TMPDIR/body.md <<EOF, a grep scan, then gh pr comment --body-file. The body file's target was known only as $TMPDIR, and capture paths only as $PWD. The Write tool expands neither. The step also put the instruction mid-paragraph, ahead of a 60-line placeholder list, gave no reason, and named no literal file.

Fix

  • reference/evidence.md step 4 states the instruction once, after the placeholder list: write the body with the Write tool, in a call of its own, to <dir>/evidence-comment.md, where <dir> is the scratchpad or the absolute path mktemp -d prints, with every path and value filled in literally. The reason is one clause: the Write tool's content reaches no shell, so a $(...) or backtick in the criterion or summary text stays text. That text comes from the PR body, which the skill treats as data. The reproduction's unquoted <<EOF would have expanded it.
  • Steps 5 and 8 now name "the file step 4 wrote".
  • Changelog fragment under .changes/source-control/.

Verification

Rule, written before the measurement: the four evidence cases, Sonnet tested, Opus judge, 3 runs each, --ablation none, --scaffold, plugin content at ff7dd16. Support requires all four VALID, body-written-with-write at least 10 of 12 in total and at least 2 of 3 in every case, and no other grader below the main arm.

Case body-written-with-write, main this PR other graders, this PR
e2e-summary-collapsed 2/3 3/3 3/3 each
large-change-collapsed 2/3 3/3 3/3 each
record-fields 1/3 3/3 3/3 each
small-change-inline-table 1/3 3/3 3/3 each
total 6/12 12/12
  • Validity gate (run-validity.py --runs 3 --scaffolded): VALID, 12 of 12 traces, no permission denial.
  • One kept trace per case read: each run writes <TMPDIR>/evidence-comment.md with the Write tool, scans that file and posts it with --body-file. None uses a heredoc.
  • Spend: 4.00 USD list-price estimate (reproduction 0.61, smoke 0.68, measurement 2.71).

Left out: the without-plugin arm, since the grader measures a skill instruction the bare model never sees.

Related

The guardrails secret scan is not the reason for the Write tool here: plugins/guardrails/README.md ("Consumer seams") says secret scanning declines a temp-tree file. The reason given matches reference/create.md's "Why a file, not a shell variable".

🤖 Generated with Claude Code

…ith the Write tool

Step 4 of reference/evidence.md now gives the Write instruction once, after
the placeholder list, with a literal target (<dir>/evidence-comment.md, the
scratchpad or the path mktemp -d prints), every path and value filled in
literally, and its reason: the Write tool's content reaches no shell, so a
$(...) or backtick in the criterion or summary text stays text. Steps 5 and
8 read that file.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@kyle-sexton
kyle-sexton marked this pull request as ready for review November 18, 2026 19:00
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-18T19:01:49.891959Z ff7dd16 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions

Copy link
Copy Markdown
Contributor

claude-security-review reviewed ff7dd168c259b0848d09e5c7c7b9693f37d14efa: read 2 of 2 changed file(s); 0 finding(s), 0 as inline comments.

Security review: no security issues found

I read the whole change in both files: .changes/source-control/fix-evidence-body-write-tool-52d3c0a5.md, a new changelog fragment, and plugins/source-control/skills/pull-request/reference/evidence.md.

Removed instruction. The diff deletes the old step 4 line that said to write the body with the Write tool. I checked this under the instruction-surface lens. The rule is not gone: it now sits after the placeholder list and is stricter.

  • The Write tool must be used in a call of its own.
  • The target file is named: <dir>/evidence-comment.md, where <dir> is the scratchpad or the path mktemp -d prints.
  • Every path and value must be filled in literally.
  • It gives the reason: Write-tool content reaches no shell, so a $(...) or backtick in the criterion or summary text taken from the PR body stays text.

This closes a shell-injection path the old wording left open. Sessions had been writing the body with an unquoted cat <<EOF heredoc, which would expand $(...) in that text.

Steps 5 and 8. They now point at "the file step 4 wrote" instead of a vague "". The leak scan therefore runs on the same file that gets posted, so a scan-then-post mismatch can't happen.

Not affected:

  • No guard was narrowed, no trust control widened and no plugin manifest touched.
  • None of the owner's named friction holds changed.
  • I did not need the protected-class register (docs/contracts/instruction-exception-register/README.md), because the removed rule survives in stronger form.
  • The PR context file contains no embedded instructions.

critical-findings: 0

@github-actions

Copy link
Copy Markdown
Contributor

claude-review reviewed ff7dd168c259b0848d09e5c7c7b9693f37d14efa: read 2 of 2 changed file(s); 0 finding(s), 0 as inline comments.

Code review: no findings.

This PR moves the "write the body with the Write tool" instruction in the evidence reference. It now sits after the placeholder list in step 4, gives a literal target (<dir>/evidence-comment.md, where <dir> is the scratchpad or the path mktemp -d prints) and says why. Steps 8 and 9 now name "the file step 4 wrote" where they used to say "the body file".

What I checked:

  • References. The removed line in step 4 had no other readers. Step 5 now scans the written file. Steps 8 and 9 pass that same file to --body-file. Step 7's fallback ("render the body again from step 4 … scan it again as in step 5") still reads correctly against the new wording. Nothing else in plugins/source-control refers to the evidence body by the old phrase. The body-written-with-write grader samples in the four pull-request-evidence-* cases check that the Write tool was used, not a file name, so the new name evidence-comment.md doesn't break them.
  • Name clash. The template is also called evidence-comment.md, but it lives under the skill's templates/ directory and the body goes to the scratchpad or a temp directory, so they can't collide.
  • Path rules. .claude/rules/skill-bodies-state-current-rules.md and cost-claims.md both match the reference file. The reason the PR gives (Write-tool content never passes through a shell) is a basic property of the tool, not a changeable upstream detail, and the skill files gain no prices or cost figures.
  • Changelog fragment. bump: patch fits a fix to an instruction that ships with no new capability.
  • Closing issue. None. The PR body says no issue tracks this, so there are no acceptance criteria to check.
  • Verification. The PR's measurements (12 of 12 runs pass the grader, against 6 of 12 on main) are the author's claim. I did not run them.
  • Spend. None: the change is a skill instruction plus a changelog fragment.

Loosened-check verdict: fail (default; the wrapper supplied no verdict or patterns line); patterns: 0. The PR loosens no check.

Verifier dropped 0 of 0 candidates.

@kyle-sexton
kyle-sexton added this pull request to the merge queue Nov 18, 2026
Merged via the queue into main with commit a4827f2 Nov 18, 2026
77 checks passed
@kyle-sexton
kyle-sexton deleted the fix/evidence-body-write-tool branch November 18, 2026 19:18
@github-actions github-actions Bot added the merge-path: owner-agent Post-merge accounting record (README.md, Merge paths) label Nov 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-path: owner-agent Post-merge accounting record (README.md, Merge paths)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant