The best way to control Claude Code, Codex and more from any computer or phone
fix(server): a failed comments read no longer hides PR check updates (#33452)
Co-authored-by: Emi Griffith <emi.g@jinemi.com> Co-authored-by: maria-rcks <maria@kuuro.net> Co-authored-by: Julius Marminge <julius0216@outlook.com>
Emi Griffith committed
Nov 14, 2026 at 10:20 UTC
01c84c7c021e78de74a378afbe97e4f4ae33c9c6
2 files changed
+32
-22
apps/server/src/orchestration-v2/PullRequestWatchReactor.ts
+21
-15
@@ -609,34 +609,26 @@ export const make = Effect.gen(function* () {
609
],
610
{ concurrency: 2 },
611
);
612
- // Activity failures must not cancel or hide a permanent detail failure.
613
- // Activity is irrelevant once the pull request is closed or merged, so it cannot block ending.
614
- const read = Exit.isFailure(detailRead)
615
- ? Exit.failCause(detailRead.cause)
616
- : detailRead.value.state !== "open"
617
- ? Exit.succeed([detailRead.value, Option.none<PullRequestActivity>()] as const)
618
- : Exit.isFailure(activityRead)
619
- ? Exit.failCause(activityRead.cause)
620
- : Exit.succeed([detailRead.value, activityRead.value] as const);
621
- if (Exit.isFailure(read)) {
622
- if (Cause.hasInterruptsOnly(read.cause)) return yield* Effect.failCause(read.cause);
612
+ if (Exit.isFailure(detailRead)) {
613
+ if (Cause.hasInterruptsOnly(detailRead.cause))
614
+ return yield* Effect.failCause(detailRead.cause);
615
lastReads.delete(group.key);
624
- const reason = providerFailureReason(read.cause);
616
+ const reason = providerFailureReason(detailRead.cause);
617
if (reason === "rate-limited") return;
618
// Transport and host failures can outlast the failure limit; keep the watch for recovery.
619
if (reason === "failed") {
620
readFailures.delete(group.key);
629
- return yield* Effect.failCause(read.cause);
621
+ return yield* Effect.failCause(detailRead.cause);
622
}
623
const failures = (readFailures.get(group.key) ?? 0) + 1;
624
readFailures.set(group.key, failures);
625
if (failures >= READ_FAILURE_LIMIT && (yield* eachTarget(group, giveUp))) {
626
readFailures.delete(group.key);
627
}
636
- return yield* Effect.failCause(read.cause);
628
+ return yield* Effect.failCause(detailRead.cause);
629
}
630
readFailures.delete(group.key);
639
- const [detail, activity] = read.value;
631
+ const detail = detailRead.value;
632
for (const target of group.targets) {
633
const life = lifeOf(target);
634
const headSha = detail.headSha ?? life.headSha;
@@ -659,6 +651,20 @@ export const make = Effect.gen(function* () {
651
);
652
}
653
654
+ // A failed comments read leaves remarks incomplete, so the next pass reads them again;
655
+ // checks, head and conflicts from the detail still reach the evaluator.
656
+ if (Exit.isFailure(activityRead)) {
657
+ threadTails.delete(group.key);
658
+ if (providerFailureReason(activityRead.cause) !== "rate-limited") {
659
+ yield* logFailure("pull request watch activity read failed", { pullRequest: group.key })(
660
+ activityRead.cause,
661
+ );
662
+ }
663
+ }
664
+ const activity = Exit.isSuccess(activityRead)
665
+ ? activityRead.value
666
+ : Option.none<PullRequestActivity>();
667
+
668
// Never advance the remark watermark past comments an incomplete read could have missed.
669
const remarks = Option.isSome(activity)
670
? yield* readRemarks(
apps/server/src/orchestration-v2/runtimeLayer.test.ts
+11
-7
@@ -5074,6 +5074,7 @@ it.layer(layerTest)("OrchestrationV2LayerLive lifecycle", (it) => {
5074
5075
const headSha = "6074dd48ff";
5076
let checks: PullRequestDetail["checks"] = [];
5077
+ let activityUnavailable = false;
5078
const host = Layer.mergeAll(
5079
NodeServices.layer,
5080
NodeCrypto.layer,
@@ -5089,13 +5090,15 @@ it.layer(layerTest)("OrchestrationV2LayerLive lifecycle", (it) => {
5090
checks,
5091
})),
5092
activity: () =>
5092
- Effect.succeed({
5093
- comments: [],
5094
- commentCount: 0,
5095
- commentsTruncated: false,
5096
- reviewThreads: [],
5097
- commits: [],
5098
- }),
5093
+ activityUnavailable
5094
+ ? Effect.die("comments unavailable")
5095
+ : Effect.succeed({
5096
+ comments: [],
5097
+ commentCount: 0,
5098
+ commentsTruncated: false,
5099
+ reviewThreads: [],
5100
+ commits: [],
5101
+ }),
5102
}),
5103
);
5104
const wakes = Effect.map(
@@ -5122,6 +5125,7 @@ it.layer(layerTest)("OrchestrationV2LayerLive lifecycle", (it) => {
5125
yield* sweep;
5126
assert.lengthOf(yield* wakes, 1);
5127
5128
+ activityUnavailable = true;
5129
checks = [{ name: "lint", status: "success", description: null, url: null, required: true }];
5130
yield* TestClock.adjust("10 minutes");
5131
yield* sweep;