Skip to content

Commit 4db326b

Browse files
saphidclaude
andcommitted
fix(server): PR watches wake again when a push leaves the branch conflicting
Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 5b9731c commit 4db326b

2 files changed

Lines changed: 18 additions & 2 deletions

File tree

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,20 @@ describe("evaluatePullRequestWatch", () => {
352352
assert.deepEqual(evaluatePullRequestWatch(clean.next, conflicting, noRemarks).changes, [
353353
{ kind: "conflicting" },
354354
]);
355+
const pushed = { headSha: "bbbbbbbbbb" };
356+
const recomputed = evaluatePullRequestWatch(
357+
first.next,
358+
detail({ ...pushed, mergeability: "unknown" }),
359+
noRemarks,
360+
);
361+
assert.deepEqual(
362+
evaluatePullRequestWatch(
363+
recomputed.next,
364+
detail({ ...pushed, mergeability: "conflicting" }),
365+
noRemarks,
366+
).changes,
367+
[{ kind: "conflicting" }],
368+
);
355369
});
356370

357371
it("does not spend the comment wake limit on check results", () => {

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,12 +126,14 @@ export function evaluatePullRequestWatch(
126126
...atLatest.map((remark) => remark.id),
127127
];
128128

129-
if (detail.mergeability === "conflicting" && !watch.conflicting) {
129+
// Like a failed check, a conflict a push did not resolve is news for the new head.
130+
const toldConflict = !headMoved && watch.conflicting;
131+
if (detail.mergeability === "conflicting" && !toldConflict) {
130132
changes.push({ kind: "conflicting" });
131133
}
132134
// "unknown" is a host still computing after a push; only a clean answer clears a conflict.
133135
const conflicting =
134-
detail.mergeability === "unknown" ? watch.conflicting : detail.mergeability === "conflicting";
136+
detail.mergeability === "unknown" ? toldConflict : detail.mergeability === "conflicting";
135137

136138
const commentsOnly = changes.length > 0 && changes.every((change) => change.kind === "remarks");
137139
const progress = headMoved || (changes.length > 0 && !commentsOnly);

0 commit comments

Comments
 (0)