Skip to content

Commit 6809d98

Browse files
saphidclaude
andcommitted
fix(server): PR watches keep the last head when the host omits it
Azure DevOps leaves the head out when its iteration read fails. Treating that as a push re-told a conflict on every failed read and again when the head came back. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 4db326b commit 6809d98

3 files changed

Lines changed: 7 additions & 2 deletions

File tree

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -508,9 +508,9 @@ export const make = Effect.gen(function* () {
508508
}
509509
readFailures.delete(group.key);
510510
const [detail, activity] = read.value;
511-
const headSha = detail.headSha ?? null;
512511
for (const target of group.targets) {
513512
const life = lifeOf(target);
513+
const headSha = detail.headSha ?? life.headSha;
514514
const pushed = life.headSha !== null && headSha !== life.headSha;
515515
lives.set(lifeKey(target), {
516516
...life,

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,10 @@ describe("evaluatePullRequestWatch", () => {
339339
const conflicting = detail({ mergeability: "conflicting" });
340340
const first = evaluatePullRequestWatch(watch(), conflicting, noRemarks);
341341
assert.deepEqual(first.changes, [{ kind: "conflicting" }]);
342+
const { headSha: _unreadHead, ...headUnread } = conflicting;
343+
const unread = evaluatePullRequestWatch(first.next, headUnread, noRemarks);
344+
assert.deepEqual(unread.changes, []);
345+
assert.deepEqual(evaluatePullRequestWatch(unread.next, conflicting, noRemarks).changes, []);
342346
const recomputing = evaluatePullRequestWatch(
343347
first.next,
344348
detail({ mergeability: "unknown" }),

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ export function evaluatePullRequestWatch(
4141
now: number,
4242
): PullRequestWatchReport {
4343
const changes: Array<PullRequestWatchChange> = [];
44-
const headSha = detail.headSha ?? null;
44+
// Azure DevOps omits the head when its iteration read fails; that is not a push.
45+
const headSha = detail.headSha ?? watch.headSha;
4546
const headMoved = headSha !== watch.headSha;
4647

4748
// Hosts can return no checks on read failure; preserve prior state.

0 commit comments

Comments
 (0)