Skip to content

Commit 8c74a8a

Browse files
aglowienkaclaude
andcommitted
fix(server): a passing rerun clears the finished notice too
A rerun that passed between two reads is never seen pending, so a watch started again on the same head kept the told state and could not send the final notice after a later failure. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01MrRujdnDgAgch35FAe2w5T
1 parent b4c5e2c commit 8c74a8a

2 files changed

Lines changed: 12 additions & 3 deletions

File tree

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,15 @@ describe("evaluatePullRequestWatch", () => {
289289
const done = detail({ checks: [check("lint", "success"), check("test", "failure")] });
290290
const told = watch({ headSha: "aaaaaaaaaa", failedChecks: ["test"], finished: true });
291291
assert.deepEqual(evaluatePullRequestWatch(told, done, noRemarks).changes, []);
292+
293+
// A rerun that passed between two reads was never seen pending, yet it ends the told state.
294+
const green = detail({ checks: [check("lint", "success"), check("test", "success")] });
295+
const passed = evaluatePullRequestWatch(told, green, noRemarks);
296+
assert.deepEqual(passed.changes, [{ kind: "checks-passed", count: 2, required: false }]);
297+
assert.isFalse(passed.next.finished);
298+
const red = evaluatePullRequestWatch(passed.next, done, noRemarks);
299+
assert.deepEqual(red.changes, [{ kind: "checks-failed", failed: [check("test", "failure")] }]);
300+
assert.isTrue(evaluatePullRequestWatch(red.next, done, noRemarks).finished);
292301
});
293302

294303
it("ends the message with the stop notice when the checks finished", () => {

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,11 @@ export function evaluatePullRequestWatch(
6868
const passedNow = gate.every((check) => check.status !== "pending" && !isFailedCheck(check));
6969
// A gate failure the agent already heard of can stand while the rest finish, and then nothing
7070
// short of a push can wake it: no check is new and the gate cannot pass. A rerun goes pending,
71-
// which arms this once more.
71+
// or passes between two reads, and either arms this once more.
7272
const pending = detail.checks.some((check) => check.status === "pending");
73-
if (pending) {
73+
if (pending || passedNow) {
7474
finished = false;
75-
} else if (!passedNow && failed.length > 0 && newlyFailed.length === 0 && !finished) {
75+
} else if (newlyFailed.length === 0 && !finished) {
7676
changes.push({ kind: "checks-finished", count: detail.checks.length, failed });
7777
finished = true;
7878
}

0 commit comments

Comments
 (0)