fix(pr): stop expiring completed ClawSweeper reviews after twelve hours (#162249)

The landing gate treated a completed ClawSweeper review older than twelve hours as missing and forced a fresh bot review before merge-run even when head and findings were unchanged. Review age no longer matters: the gate requires a completed review marker, keeps the future-dated and conflicting-marker checks, and keeps the SHA-mismatch warning.
This commit is contained in:
Peter Steinberger 2026-09-30 18:20:03 -07:00 • committed by GitHub
parent 1783c5fd6f
commit 7c8d77bfd4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 6 deletions

View file

@ -73,9 +73,6 @@ for (const comment of pages.flat()) {
if (age < -5 * 60_000) { if (age < -5 * 60_000) {
fail("trusted review completion is materially future-dated."); fail("trusted review completion is materially future-dated.");
} }
if (age >= 12 * 60 * 60_000) {
continue;
}
const evidence = { const evidence = {
commentId: comment.id, commentId: comment.id,
reviewedAt: fields.reviewedAt, reviewedAt: fields.reviewedAt,
@ -88,7 +85,7 @@ for (const comment of pages.flat()) {
} }
if (completions.length === 0) { if (completions.length === 0) {
fail("completed review is missing or expired."); fail("completed review is missing.");
} }
completions.sort( completions.sort(
(a, b) => b.reviewedMs - a.reviewedMs || b.evidence.commentId - a.evidence.commentId, (a, b) => b.reviewedMs - a.reviewedMs || b.evidence.commentId - a.evidence.commentId,
@ -102,7 +99,7 @@ if (new Set(newest.map((candidate) => candidate.signature)).size !== 1) {
const selected = newest[0].evidence; const selected = newest[0].evidence;
if (selected.reviewedSha !== headSha) { if (selected.reviewedSha !== headSha) {
console.error( console.error(
`ClawSweeper review gate warning: reviewed SHA ${selected.reviewedSha} differs from current head ${headSha}; review is under 12 hours old.`, `ClawSweeper review gate warning: reviewed SHA ${selected.reviewedSha} differs from current head ${headSha}.`,
); );
} }
process.stdout.write(`${JSON.stringify(selected)}\n`); process.stdout.write(`${JSON.stringify(selected)}\n`);

View file

@ -59,7 +59,6 @@ describe("ClawSweeper review completion gate", () => {
["duplicate attribute", [reviewComment({ attributes: " sha=" + head })]], ["duplicate attribute", [reviewComment({ attributes: " sha=" + head })]],
["malformed source revision", [reviewComment({ sourceRevision: "not-a-revision" })]], ["malformed source revision", [reviewComment({ sourceRevision: "not-a-revision" })]],
["missing lease", [reviewComment({ leaseOwner: "unknown" })]], ["missing lease", [reviewComment({ leaseOwner: "unknown" })]],
["expired boundary", [reviewComment({ reviewedAt: ago(12 * 60 * 60_000) })]],
["future dated", [reviewComment({ reviewedAt: ago(-6 * 60_000) })]], ["future dated", [reviewComment({ reviewedAt: ago(-6 * 60_000) })]],
])("rejects %s evidence", (_name, comments) => { ])("rejects %s evidence", (_name, comments) => {
const result = run(comments); const result = run(comments);
@ -67,6 +66,12 @@ describe("ClawSweeper review completion gate", () => {
expect(result.stderr).toContain("ClawSweeper review gate failed:"); expect(result.stderr).toContain("ClawSweeper review gate failed:");
}); });
it("accepts a completion older than twelve hours", () => {
const result = run([reviewComment({ reviewedAt: ago(36 * 60 * 60_000) })]);
expect(result.status, result.stderr).toBe(0);
expect(JSON.parse(result.stdout)).toMatchObject({ commentId: 1, reviewedSha: head });
});
it("selects the newest valid completion and ignores a queued refresh", () => { it("selects the newest valid completion and ignores a queued refresh", () => {
const newer = reviewComment({ const newer = reviewComment({
id: 2, id: 2,