Skip to content

Commit c764914

Browse files
RealDoc06claude
andcommitted
fix(server): re-read held merged summaries that lack a merge time
PullRequestService serves a held merged summary without asking the host, so the slow-cadence re-read for a snapshot missing mergedAt could return the same gap. Invalidate the reference first in that case. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent feac738 commit c764914

2 files changed

Lines changed: 13 additions & 1 deletion

File tree

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -671,10 +671,13 @@ describe("PullRequestSyncReactor", () => {
671671
Effect.scoped(
672672
Effect.gen(function* () {
673673
yield* TestClock.setTime(Date.parse(NOW));
674+
const invalidated = yield* Ref.make<ReadonlyArray<number>>([]);
674675
const fixture = yield* makeHarness({
675676
snapshot: makeSnapshot([
676677
makeThread("merged", { pullRequests: [makeLink(1, { state: "merged" })] }),
677678
]),
679+
invalidate: ({ reference }) =>
680+
Ref.update(invalidated, (numbers) => [...numbers, reference?.number ?? -1]),
678681
summary: (input) =>
679682
Effect.succeed(
680683
makeSummary(input, { state: "merged", mergedAt: "2026-08-27T00:00:00.000Z" }),
@@ -684,6 +687,8 @@ describe("PullRequestSyncReactor", () => {
684687
yield* Effect.gen(function* () {
685688
const reactor = yield* startAndSweep(fixture);
686689
const firstSweep = yield* Ref.get(fixture.syncCommands);
690+
// The held merged summary is dropped so the read reaches the host.
691+
assert.deepStrictEqual(yield* Ref.get(invalidated), [1]);
687692
assert.strictEqual(firstSweep.at(-1)?.snapshot.mergedAt, "2026-08-27T00:00:00.000Z");
688693
yield* Ref.update(fixture.snapshots, (snapshot) => applySync(snapshot, firstSweep));
689694

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,14 @@ export const make = Effect.gen(function* () {
293293
number: first.link.number,
294294
};
295295
const generation = requested.get(key);
296-
if (generation !== undefined) yield* pullRequests.invalidate({ reference: ref });
296+
// A held merged summary is served without asking the host, so a snapshot still missing its
297+
// merge time has to drop it or the slow-cadence re-read would hand back the same gap.
298+
const missingMergedAt = entries.some(
299+
(entry) => entry.link.snapshot?.state === "merged" && entry.link.snapshot.mergedAt == null,
300+
);
301+
if (generation !== undefined || missingMergedAt) {
302+
yield* pullRequests.invalidate({ reference: ref });
303+
}
297304
const summary = yield* pullRequests.summary(ref, { recoverTransientFailure: false });
298305
const fields = snapshotFieldsOf(summary);
299306
const needsStack =

0 commit comments

Comments
 (0)