fix(review): bind exact reviews to the leased PR head - #981
Conversation
85284ab to
12b5e4b
Compare
|
Codex review: needs maintainer review before merge. Reviewed August 2, 2026, 5:05 PM ET / 21:05 UTC. ClawSweeper reviewWhat this changesThe PR adds a typed Git source guard that verifies an exact-review lease still matches the pull request head, skips review side effects when it moved, and materializes Codex source for OpenClaw contract review. Merge readinessKeep open. This is a MEMBER-authored, concrete automation-correctness fix with a credible narrow design, but its head is 31 current-main commits behind its merge base and GitHub reports a dirty merge, so the workflow integration must be reconciled before it can safely land. Priority: P2 Review scores
Verification
How this fits togetherExact event reviews lease a particular pull-request revision, check out the target repository, then produce review artifacts and publish queue/lifecycle results. The new source guard sits after checkout and before review work so a moved pull-request head is requeued instead of receiving a verdict for the wrong revision. flowchart LR
Queue[Exact review queue] --> Lease[Leased PR head]
Lease --> Checkout[Target repository checkout]
Checkout --> Guard[Verify fetched PR head]
Guard -->|Head matches| Review[Review and artifact creation]
Guard -->|Head moved| Requeue[Requeue latest source]
Review --> Publish[Queue and lifecycle publication]
Before merge
Agent review detailsSecurityNone. Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Rebase the typed source guard onto current main, preserve the current direct-publication and lifecycle flow, and prove that a moved leased head produces only the intended requeue result with no review, artifact, ledger, or lease-cleanup side effects. Do we have a high-confidence way to reproduce the issue? Yes, from source. The focused fixture creates real temporary Git remotes and models matching, moved, missing, and shallow divergent pull-request heads; this read-only review did not execute that fixture. Is this the best way to solve the issue? Unclear. A typed pre-review source guard is the right narrow boundary, but this branch must first be integrated with the newer direct-publication and lifecycle workflow paths on current main. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against de31c9959070. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (15 earlier review cycles; latest 8 shown)
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review |
What Problem This Solves
Fixes an issue where exact pull request reviews could claim one immutable head SHA while reviewing the target branch checkout instead, and OpenClaw reviews could run without the required sibling Codex source.
Why This Change Was Made
Exact PR runs now delegate leased-head fetch, validation, and detached checkout to a testable TypeScript command. A moved head returns a structured
source_driftresult that skips review, artifact creation, and lease cleanup while the durable queue requeues the latest source. OpenClaw review workers also materializeopenai/codexbeside the target checkout.User Impact
Maintainers can trust that an exact ClawSweeper verdict applies to the SHA named by its queue lease and that Codex-backed OpenClaw contract checks have the required dependency source. There is no new configuration.
Evidence
302b879791f77c94305190d1e8ce730421209497(signed).pnpm run build:repairpassed.node --test test/repair/exact-review-source.test.ts test/sweep-workflow.test.ts: 107/107 passed, including matching head, source drift, unfetchable ref, and a shallow divergent-history fixture with a 75-commit PR plus 60 newer base commits.git diff --check: clean.pnpm run check: build, format, lint, coverage thresholds, and 2,847 tests passed; five unchanged Linux Landlock fixture tests cannot import on macOS because Apple libc has nocapset. Exact-head Linux CI is the authoritative remaining gate.Real Behavior Proof
source_driftwithout changing the target checkout; missing refs fail closed. A shallow target whose base advanced 60 commits and whose PR contains 75 commits is fully unshallowed, preserves the original merge base, and exposes all 75 PR commits toorigin/main..HEAD. Parsed workflow coverage proves source drift skips reservation, review, ledger finalization, artifact bundling, and unsuccessful lease release while exportingrequeue_latest=true.ClawSweeper Finding Disposition - July 31, 2026
repair:exact-review-source; workflow YAML now only clones the target, invokes the command, and branches on structured outputs.requeue_latest=true; fetch failure remains a hard failure rather than a false requeue.origin/mainAGENTS.mdreserves the OpenClaw target repository'sCHANGELOG.mdduring foreign PR work;CONTRIBUTING.mdexplicitly says ClawSweeper follows its own release-note policy. This PR changes ClawSweeper itself, and the operationally meaningful exact-review change therefore keeps its ClawSweeper changelog entry.pnpm check, CodeQL, containment smoke, sparse repair build, Windows launcher, and production automerge E2E are green.