Skip to content

security-guidance: record only the commits a review read - #7165

Draft
mhegazy wants to merge 1 commit into
mainfrom
mhegazy/sg-record-read-commits
Draft

mhegazy wants to merge 1 commit into
mainfrom
mhegazy/sg-record-read-commits

Conversation

@mhegazy

@mhegazy mhegazy commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Issue

When one Bash call makes several commits whose output is hidden (git commit -qm a && git commit -qm b), the commit review finds them in the reflog and reads each with git show. If git show fails or hits its 15 s limit on one of them, the review goes on with the others, and then all of them are recorded as reviewed. The next push review skips the commit nobody read, and a push in the same command does not take it over.

Not a regression: 2.0.0 to 2.0.20 do the same.

Fix

Only the commits git could show are recorded as reviewed and marked as under review. The next push review, or the next quiet commit within the reflog window, reviews the rest. A file renamed into code is shown up to the newest commit that was read, so an unread newer one does not hide it.

Effect

  • Nothing changes when every commit was read.
  • After an unread commit there is one more review, at the push. Commits after the unread one are in its diff again, as for any unreviewed commit.
  • If the push review cannot take the unread commit either (over 300 files, or a diff that takes over 30 s), it skips the push, with the later unreviewed commits in it. That is already so when such a commit is alone in its call; until now it was not so when it came with others.

Not covered

When two commits of one call change the same file, only the newer commit's diff of that file is sent, as before.

Tests

Scenario Linux macOS Windows x64 Windows ARM64
New tests (8 of 10 fail on main) 10 pass 10 pass 10 pass 10 pass
Plugin suite 2344 pass, 10 skipped 2348 pass, 6 skipped 2116 pass, the same 15 failures as main 2116 pass, the same 15 failures as main
Hook runs: missing object and time limit, older or newer commit, then a push, a push in the same command, or another quiet commit (12 runs) main: 12 lost; this: 0 main: 12 lost; this: 0 main: 12 lost; this: 0 main: 12 lost; this: 0
Claude Code: two quiet commits, one unreadable, then a push main: finding lost; this: delivered same same same
same, push in the same command main: finding lost; this: delivered same same same
same, both readable same on both same on both same on both same on both
Claude Code: Stop, commit, push, no change, two quiet commits, commit then push, commit and push, re-commit, amend, merge conflict, rename into code same reviews and findings as main same same same
Regression scenarios 21 of 21 21 of 21 8 of 8 that run there, the others are skipped not run
Commit hook killed during the review (SIGKILL, SIGTERM) nothing recorded, the push reviews both not run not run not run

The model was scripted. On the ARM64 runner reviews are single-shot only, on main too.


Generated by Claude Code

When one command makes several quiet commits and git show fails or times
out on one of them, the commit review goes on with the others and then
recorded all of them as reviewed. The next push review skipped the commit
nobody had read.

Record, and mark as under review, only the commits git could show. The
next push or quiet commit reviews the rest.

Co-authored-by: mhegazy <mhegazy@anthropic.com>
@mhegazy mhegazy self-assigned this Nov 18, 2026
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.

2 participants