fix(ce-code-review): stop the reviewer template from embedding the diff twice - #1512
Conversation
…ff twice
The closing note of the review-context block named {file_list} and {diff}
in slot syntax, so prompt assembly filled them a second time and then told
the reviewer the inline content "may be file paths" to Read. The note now
refers to the Changed files: and Diff: labels the reviewer actually sees
and applies only to a lone staged path. A contract test pins each
placeholder to one occurrence inside the fenced template.
Fixes #1509
Claude-Session: https://claude.ai/code/session_012uPY9QcVF4ueBgrpegPcvC
PR SummaryLow Risk Overview The note now refers to the Reviewed by Cursor Bugbot for commit c85d44a. Bugbot is set up for automated code reviews on this repo. Configure here. |
Every
ce-code-reviewreviewer prompt carried the changed-file list and the full diff twice, then ended with a note telling the reviewer that inline content "may be file paths" to Read from disk. The closing note of the template's<review-context>block named{file_list}and{diff}in slot syntax, so prompt assembly filled them a second time; the reporter measured the second copy at 33% of a nine-reviewer run's payload, and one reviewer stopped to verify the contradiction. The note now refers to theChanged files:andDiff:labels the reviewer actually sees after substitution and states the condition: inline content is authoritative, a lone staged path is Read. This matches the shape the validator template already used.A contract test pins each placeholder to exactly one occurrence inside the fenced template, so a future mention of
{diff}in the note failsbun run test.Fixes #1509
Validation
bun run test(3540 pass),bun run release:validateclean. The new test fails on the old template line and passes on the new one.Fresh-agent eval of the reviewer subagent, read-only, against a throwaway repo with a 2-file diff. Prompts were assembled from the real template (pre =
main, post = this branch) by filling every{slot}; the pre prompt reproduces the bug (diff present twice). Three arms on Claude (claude -p) and Codex (codex exec --sandbox read-only):git diffrather than trusting the promptdiff.txt, Readfiles.txt, then reviewedsedboth staged files, then reviewedNo regression on either host; the staged-path instruction still fires on both. The strong tiers absorbed the old contradiction rather than acting on it (matching 8 of 9 reviewers in the report), so this eval shows the fix holds rather than a before/after flip; the reporter's
testingreviewer that halted to verify is the observed failure the rewrite removes.Security Disclosure
No security-relevant changes.
Agent Disclosure
Claude Code · claude-fable-5https://claude.ai/code/session_012uPY9QcVF4ueBgrpegPcvC