Fixes #14113
What Changed#
PullRequestService now reaches its caches through one small helper, cacheReadAfterInterrupt, instead of calling Cache.get directly. When a read comes back with an interrupt-only cause, the helper drops the dying cache entry with Cache.invalidate and reads again, bounded to three attempts. Everything else about those reads is unchanged, including the stale-while-revalidate windows and the coalescing on the cache key.
The helper is applied to the list, detail, preview, activity, diff, and list-stats caches in apps/server/src/pullRequest/PullRequestService.ts. All six share the same Cache.makeWith shape and all sit behind the panel's refresh signal, so they all had the same hole.
Two tests in apps/server/src/pullRequest/PullRequestService.test.ts pin the behavior:
reads a detail again when the cache answers with an interrupt drives the provider to interrupt on its first call and asserts the read still resolves.
recovers when a resent detail read joins the lookup being torn down reproduces the actual race with a gated teardown and asserts the second read succeeds.
Why#
Opening a pull request panel for the first time after any completed turn could show "Could not load pull requests — All fibers interrupted without error", with a Retry button that then worked. Three things line up to cause it.
effect/Cache removes an entry only once its lookup fiber has exited, and it interrupts that fiber when the last caller walks away. The map removal lives in the fiber's own observer, so between "last caller left" and "fiber finished" the entry is still in the map while its lookup is shutting down. A read that arrives in that window finds the entry, joins the dying fiber, and comes back with a bare Interrupt instead of a value.
That window only opens because something cancels and resends the read. subscribeRefreshes is SubscriptionRef.changes(pullRequestRefreshes) filtered to revision > 0, and a SubscriptionRef replays its current value as soon as it is subscribed. Once the server has finished any turn, the first panel to mount subscribes, receives that value immediately, and Atom.makeRefreshOnSignal refreshes on it. The client interrupts the in-flight detail request and sends the same request again, and that second request is what can land inside the teardown window. Stopping the gh process takes a few milliseconds, which is exactly the size of the gap.
The client then treats the interrupt as final. useEnvironmentQuery squashes an interrupt-only cause to that "All fibers interrupted without error" string, and the panel renders the unavailable state. Commands already ignore interrupt-only results, but queries do not, and a first open has no earlier success for the client to fall back on. Pressing Retry works because by then the dying entry is gone.
A caller that was not itself interrupted should never observe a lookup that is shutting down, so the fix drops the dead entry and reads again. The retry is bounded on purpose: the entry is gone after the first invalidate, and a genuinely cancelled caller never reaches the recovery at all, because Effect does not run it for the fiber's own interrupt. Real cancellations still propagate untouched.
Verification#
Reproduced both failure modes as tests first, and confirmed they failed against the old code before applying the fix. The first failed with Error: All fibers interrupted without error, the same message the panel shows, and the second failed on the exit check because the resent read inherited the dying lookup's interrupt.
Checks run against the rebased branch:
vp test run apps/server/src/pullRequest/ — 803 passed across 21 files
vp test run on PullRequestSyncReactor, ThreadSettlementReactor, and ThreadPullRequestReactor — 90 passed
tsc --noEmit on apps/server — clean
vp lint and vp fmt --check on the changed files — clean
No UI change, so there are no screenshots to attach.
Checklist#
Written with DeepSeek-V4.1-Flash, running in ZCode.
Summary by CodeRabbit#
- Bug Fixes
- Improved reliability when loading pull request lists, details, previews, activity, diffs, and statistics. Interrupted cache lookups are retried, helping affected information load successfully instead of failing.
- Fixed cases where pull request detail requests could fail during cache cleanup; subsequent and overlapping requests can now complete successfully.
Navigate logical layers of code changes, visualize relationships, and explore their blast radius.
No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
⚙️ Run configuration
Configuration used: Repository: pingdotgg/t3code/.coderabbit.yaml
Review profile: CHILL
Plan: Advanced
Run ID:
4c6d041b-cf39-4093-a669-972c1b2f9eef📥 Commits
Reviewing files that changed from the base of the PR and between ba79610d166dcc7a9b8beb013d18304bc6261307 and 08aa300bd29264f14166773a55a1ee4d4448925f.
📒 Files selected for processing (2)
apps/server/src/pullRequest/PullRequestService.test.tsapps/server/src/pullRequest/PullRequestService.tsIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
📝 Walkthrough
Walkthrough#
Pull request cache reads now retry after interrupt-only lookup failures. The change applies to list, detail, preview, activity, diff, and list-stats reads. New detail-read tests cover retry and lookup teardown timing.
Changes#
Cache read recovery
apps/server/src/pullRequest/PullRequestService.tsapps/server/src/pullRequest/PullRequestService.test.tsPriority: ➖ Normal
Estimated code review effort: 3 (Moderate) | ~20 minutes
Change: Bug fix · Severity of issue fixed: Medium
Suggested reviewers:
maria-rcksMerge Risk: ⚪ Minimal · up to
08aa3No actionable issue is established before merge. Concurrent cache invalidation behavior remains unverified.
Security Architecture Review#
Security architecture risk: 🔵 Low · up to
08aa3Recovery is limited to interrupted pull-request reads, and the review found no new access path or permission change. Concurrent replacement of a cache entry remains unverified.
Retained concerns No architecture-level concerns identified.
Security review details
Security Blast Radius
Trust Boundaries and Controls
Resilience and Maintainability Implications
Hardening Proposals
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
#14113requires the PR read to recover from an interrupt caused by a cache lookup that is being torn down.cacheReadAfterInterruptdetects interrupt-only causes, invalidates the cache key, and…#14113. The generalized helper updates the same pull-request cache reads identified in the issue. The added tests verify the required re…✨ Finishing Touches
🧪 Generate unit tests (beta)
Comment `@coderabbitai help` to get the list of available commands.