Repository navigation
feat(policy): make the review record refuse an author's own verdict - #116
Merged
Merged
Conversation
|
This PR doesn't fully meet our contributing guidelines and PR template. What needs to be fixed:
Please edit this PR description to address the above within 2 hours, or it will be automatically closed. If you believe this was flagged incorrectly, please let a maintainer know. |
The reader shipped in abadec9 and enforces nothing: the record is a plain file in the author's working tree, and a model can write a file. This adds the two pieces that make it mean something, and is explicit about the piece it cannot fix. write() stamps the reviewer from the caller's own session identity, never from a model-supplied argument, so a model can record a verdict but cannot record one *as* somebody else. It validates against the reader's own closed schema before writing — a record rejected here would be rejected on read too, and the round trip would look like a review that never happened rather than a refused write — and renames into place so a reader never sees a truncated file. gate() supplies the authorSessionID that mayMerge was already asking for but that no caller passed, so #111 stops being inert. It carries the record's own base as mergeBase, letting the driver apply its own unrelated-histories rule rather than second-guessing it. Does NOT close the hole, and this is pinned as a test rather than left in a comment: a record forged by shell naming a real reviewer is still accepted. The gate compares two ids; it cannot tell a real review from a fabricated one. Deny the path to models is task 1b.2 and does not change this for bash. Only OS separation would, and nothing here claims it. That is why the surrounding controls are bounded claims rather than proof of authorship. Identity comes from ctx.sessionID — in-process, not parsed from a message — so this does not wait on callback confirmation, which is not merged. Mutation-checked, each failing only the test that owns it: dropping the author comparison, and having the writer skip validation. test/policy 166 pass / 8 skip / 0 fail, typecheck clean, fork:verify clean.
androidand
force-pushed
the
review-record-authenticity
branch
from
October 4, 2026 17:10
de6eecf to
7a4a882
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The gap
The review record shipped in #107 reads, validates and maps onto merge evidence. It enforces nothing: the record is a plain file in the author's working tree, and a model can write a file. An author could write its own
LGTMnaming any reviewer it liked, and #111 stayed inert because no caller passed the author.What this adds
writestamps the reviewer from the caller's own session context — never from a model-supplied argument — so a model can record a verdict but cannot record one as somebody else. It validates against the reader's own closed schema before writing, so a record that would fail on read is refused at write time instead of becoming a review that silently never happened. Written atomically: a truncated file reads as corruption and loses a real verdict.gatesupplies theauthorSessionIDthatmayMergealready knew how to compare, so a verdict whose reviewer is the author is refused. It delegates rather than reimplementing — one place knows what a merge requires. It also carries the record'sbaseas the merge base, sincemayMergedeliberately refuses without one ("an approval of an unrelated history is not an approval of anything").Identity comes from
ctx.sessionID, which is in-process and not parsed from a message, so this does not wait on callback confirmation — which is not merged.What it does NOT do — task 1b.5, recorded not assumed
A record forged by shell, naming a real reviewer, is still accepted. The gate compares two ids; it cannot tell a real review from a fabricated one. Denying the path to models (1b.2) does not change this for bash. That test is pinned deliberately, so the limit stays visible. Only OS separation closes it, and nothing here claims it.
This is why the surrounding controls are bounded claims — human-granted, scoped, never-listed — rather than proof of authorship. Same conclusion as #112.
Verification
test/policy166 pass / 8 skip / 0 fail; gate suite 9 pass.openspec validate review-on-donepasses;fork:verify252/252 owned, 117/117 patched.Still missing
The tool registration (1b.1 wiring) and the path fence (1b.2). Neither is in this PR;
write()andgate()are the pieces they call.🤖 Generated with Claude Code