The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 22, 04:30 UTC
fix(server): PR watches wake again when a push leaves the branch conflicting (#29767)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: maria-rcks <maria@kuuro.net>
Alex Southwell committed
Nov 3, 2026 at 23:38 UTC
b95ff1131706d4c1a8dc7de325ce2b3920c8bb47
3 files changed
+25
-4
apps/server/src/orchestration-v2/PullRequestWatchReactor.ts
+1
-1
@@ -508,9 +508,9 @@ export const make = Effect.gen(function* () {
508
}
509
readFailures.delete(group.key);
510
const [detail, activity] = read.value;
511
- const headSha = detail.headSha ?? null;
511
for (const target of group.targets) {
512
const life = lifeOf(target);
513
+ const headSha = detail.headSha ?? life.headSha;
514
const pushed = life.headSha !== null && headSha !== life.headSha;
515
lives.set(lifeKey(target), {
516
...life,
apps/server/src/orchestration-v2/pullRequestWatch.test.ts
+18
@@ -356,6 +356,10 @@ describe("evaluatePullRequestWatch", () => {
356
const conflicting = detail({ mergeability: "conflicting" });
357
const first = evaluatePullRequestWatch(watch(), conflicting, noRemarks);
358
assert.deepEqual(first.changes, [{ kind: "conflicting" }]);
359
+ const { headSha: _unreadHead, ...headUnread } = conflicting;
360
+ const unread = evaluatePullRequestWatch(first.next, headUnread, noRemarks);
361
+ assert.deepEqual(unread.changes, []);
362
+ assert.deepEqual(evaluatePullRequestWatch(unread.next, conflicting, noRemarks).changes, []);
363
const recomputing = evaluatePullRequestWatch(
364
first.next,
365
detail({ mergeability: "unknown" }),
@@ -369,6 +373,20 @@ describe("evaluatePullRequestWatch", () => {
373
assert.deepEqual(evaluatePullRequestWatch(clean.next, conflicting, noRemarks).changes, [
374
{ kind: "conflicting" },
375
]);
376
+ const pushed = { headSha: "bbbbbbbbbb" };
377
+ const recomputed = evaluatePullRequestWatch(
378
+ first.next,
379
+ detail({ ...pushed, mergeability: "unknown" }),
380
+ noRemarks,
381
+ );
382
+ assert.deepEqual(
383
+ evaluatePullRequestWatch(
384
+ recomputed.next,
385
+ detail({ ...pushed, mergeability: "conflicting" }),
386
+ noRemarks,
387
+ ).changes,
388
+ [{ kind: "conflicting" }],
389
+ );
390
});
391
392
it("does not spend the comment wake limit on check results", () => {
apps/server/src/orchestration-v2/pullRequestWatch.ts
+6
-3
@@ -41,7 +41,8 @@ export function evaluatePullRequestWatch(
41
now: number,
42
): PullRequestWatchReport {
43
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;
46
const headMoved = headSha !== watch.headSha;
47
48
// Hosts can return no checks on read failure; preserve prior state.
@@ -126,12 +127,14 @@ export function evaluatePullRequestWatch(
127
...atLatest.map((remark) => remark.id),
128
];
129
129
- if (detail.mergeability === "conflicting" && !watch.conflicting) {
130
+ // Like a failed check, a conflict a push did not resolve is news for the new head.
131
+ const toldConflict = !headMoved && watch.conflicting;
132
+ if (detail.mergeability === "conflicting" && !toldConflict) {
133
changes.push({ kind: "conflicting" });
134
}
135
// "unknown" is a host still computing after a push; only a clean answer clears a conflict.
136
const conflicting =
134
- detail.mergeability === "unknown" ? watch.conflicting : detail.mergeability === "conflicting";
137
+ detail.mergeability === "unknown" ? toldConflict : detail.mergeability === "conflicting";
138
139
const commentsOnly = changes.length > 0 && changes.every((change) => change.kind === "remarks");
140
const progress = headMoved || (changes.length > 0 && !commentsOnly);