Skip to content

Commit 6a63408

Browse files
t3dotggclaude
andcommitted
fix(server): a partial check rerun restarts the comment wake count
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
1 parent 8a9c5d1 commit 6a63408

2 files changed

Lines changed: 20 additions & 8 deletions

File tree

‎apps/server/src/orchestration-v2/pullRequestWatch.test.ts‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,21 @@ describe("evaluatePullRequestWatch", () => {
194194
assert.equal(result.next.wakes, 0);
195195
});
196196

197+
it("restarts the comment wake count when a partial rerun starts", () => {
198+
const tired = watch({
199+
headSha: "aaaaaaaaaa",
200+
checks: "failed",
201+
wakes: PULL_REQUEST_WATCH_WAKE_LIMIT - 1,
202+
});
203+
const rerun = evaluatePullRequestWatch(
204+
tired,
205+
detail({ checks: [check("lint", "failure"), check("test", "pending")] }),
206+
[remark("reviewer", "2026-10-02T12:10:00Z")],
207+
);
208+
assert.isFalse(rerun.exhausted);
209+
assert.equal(rerun.next.wakes, 1);
210+
});
211+
197212
it("stops after the wake limit unless the head moves", () => {
198213
const comments = [remark("reviewer", "2026-10-02T12:10:00Z")];
199214
const tired = watch({ headSha: "aaaaaaaaaa", wakes: PULL_REQUEST_WATCH_WAKE_LIMIT - 1 });

‎apps/server/src/orchestration-v2/pullRequestWatch.ts‎

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,8 @@ export function evaluatePullRequestWatch(
7777
let checks = restarted ? null : watch.checks;
7878
// An early failure is reported while other checks run, and the final result once they finish.
7979
// A rerun that leaves another failure in place is recorded quietly and reported when it ends.
80-
if (checks === "failed" && outcome === "failing") {
80+
const rerun = checks === "failed" && outcome === "failing";
81+
if (rerun) {
8182
checks = "failing";
8283
} else if (outcome !== null && outcome !== "pending" && outcome !== checks) {
8384
changes.push(
@@ -123,14 +124,10 @@ export function evaluatePullRequestWatch(
123124
const conflicting =
124125
detail.mergeability === "unknown" ? watch.conflicting : detail.mergeability === "conflicting";
125126

127+
// A new check run, a push, or any check or conflict news is progress, so the count restarts.
126128
const commentsOnly = changes.length > 0 && changes.every((change) => change.kind === "remarks");
127-
const wakes = commentsOnly
128-
? (restarted ? 0 : watch.wakes) + 1
129-
: changes.length > 0
130-
? 0
131-
: restarted
132-
? 0
133-
: watch.wakes;
129+
const progress = restarted || rerun || (changes.length > 0 && !commentsOnly);
130+
const wakes = (progress ? 0 : watch.wakes) + (commentsOnly ? 1 : 0);
134131
return {
135132
changes,
136133
next: {

0 commit comments

Comments
 (0)