Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): PR reads no longer join canceled cache lookups #14654

Closedfilipgutica(GitHub profile, opens in a new tab)wants to merge 1 commit intomain fromrefs/pull/14654/headopened View on GitHub

Problem

Fixes #14113. When the last caller cancels a pending cache lookup, another read arriving during cleanup can join that dying lookup and receive All fibers interrupted without error.

We encountered this while working on PR detail loading in our T3 Code Workbench fork. The fork has carried this cache fix since September 21; this PR brings only that fix and its regression test to upstream.

Change

  • Expire the abandoned entry before interrupting its lookup, in Effect's source and compiled code through the existing dependency patch. New readers start a fresh lookup while the old one cleans up.
  • Add one deterministic PullRequestService regression using gated cleanup. It checks that the second read succeeds and its cached result survives completion of the abandoned lookup.
  • Regenerate the lockfile. Its changes are limited to the patch checksum and derived peer-snapshot references; dependency versions and specifiers are unchanged.

Scope and approval

Maintainer triage confirms the bug and identifies rejecting a dying entry as a valid cache-level fix. Related PRs #14122 and #14162 recover by retrying cache reads; this PR fixes lookup admission in the existing Effect patch.

Verification

  • On upstream 094fb230e9, the existing 166 PR-service tests pass. The new regression fails with All fibers interrupted without error before the patch and passes afterward.
  • From apps/server, run vp test run src/pullRequest/PullRequestService.test.ts src/pullRequest/PullRequestReadCache.test.ts src/sourceControl/GitHubCli.test.ts: all 192 tests pass.
  • Server typecheck, changed-test lint/format, diff checks, and frozen installation pass with Node 24.13.1 and pnpm 11.10.0.
  • Independent adversarial review and focused test audit completed. Live UI reproduction was not rerun; verification uses the real service with an existing provider fixture and Deferred gates, without sleeps.

Implemented with GPT-6 in Codex.

    1. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched

    2. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      Approvability

      Verdict: Approved at b380d44

      Macroscope's review found this PR approvable — This is a narrowly scoped cancellation-race fix in the shared cache used by PR reads, backed by a deterministic regression test and matching source/compiled dependency patches. Existing successful cache behavior, dependency versions, schemas, defaults, and static-analysis settings are otherwise unchanged.

      Notes:

      • All code in this push has already been reviewed. Approvability was decided on eligibility alone.
      You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    3. coderabbitai[bot](GitHub profile, opens in a new tab)commented
      Review in Change Stack →

      Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

      Important

      Review skipped

      Review was skipped as selected files did not have any reviewable changes.

      ⛔ Files ignored due to path filters (1)
      • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
      ⚙️ Run configuration

      Configuration used: Repository: pingdotgg/t3code/.coderabbit.yaml

      Review profile: CHILL

      Plan: Advanced

      Run ID: 5638c3a3-54f9-4969-9431-c3ff1c42fa74

      📥 Commits

      Reviewing files that changed from the base of the PR and between 518243db2614cfd802841fb6ecdbc572defd472e and b380d44f2a86f3b260bffb9682bedcd905eb7c5d.

      ⛔ Files ignored due to path filters (1)
      • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml

      You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

      Use the checkbox below for a quick retry:

      • 🔍 Trigger review

      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: c5d5f326-6eb4-4e5a-b6e4-0ae36cd60a00

      📥 Commits

      Reviewing files that changed from the base of the PR and between 094fb230e90ffb0af303a318ca716fecefd66c80 and 518243db2614cfd802841fb6ecdbc572defd472e.

      ⛔ Files ignored due to path filters (1)
      • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
      📒 Files selected for processing (2)
      • apps/server/src/pullRequest/PullRequestService.test.ts
      • patches/effect@4.0.0-rc.115.patch

      Included 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

      The cache now sets an abandoned lookup’s expiry to zero before interrupting its running fiber. A regression test checks that a second pull-request detail read, started during cleanup, returns fresh detail and that the provider is called exactly twice.

      Changes

      Cache lookup recovery

      Layer / File(s)Summary
      Reset expiry before interrupting abandoned lookups
      patches/effect@4.0.0-rc.115.patch, apps/server/src/pullRequest/PullRequestService.test.ts
      When no awaiters remain and the lookup fiber is still running, the cache sets expiresAt to 0 before interrupting it. The regression test checks that a second detail read during cleanup returns fresh data, as does a subsequent strict read, with exactly two provider calls.

      Priority: ➖ Normal

      Estimated code review effort: 2 (Simple) | ~10 minutes

      Change: Bug fix · Severity of issue fixed: Medium

      Suggested reviewers: juliusmarminge

      Merge Risk: ⚪ Minimal · up to 51824

      This change lets a pull-request read that arrives during cleanup start a fresh lookup instead of receiving an interrupt. No merge-blocking risk was found.

      Security Architecture Review

      Security architecture risk: 🔵 Low · up to 51824

      The change fixes canceled lookup reuse without an identified expansion of access or credential authority. The regression checks that fresh results survive abandoned cleanup. Risk remains low rather than minimal because broader concurrent cancellation and eviction behavior across shared cache consumers is not fully verified.

      Retained concerns No architecture-level concerns identified.

      Security review details

      Security Blast Radius

      • inferred — The changed behavior concerns admission to abandoned cache lookups across consumers of the patched dependency. A replacement may overlap the old lookup's finalization; broader resource-lifecycle behavior cannot be established from the single detail-read regression alone.

      Trust Boundaries and Controls

      • observed — The existing WebSocket detail method remains assigned orchestration read scope and invokes the viewer-aware detail path. These production control points are outside the supplied implementation-change ranges; the patch does not edit them.

      Resilience and Maintainability Implications

      • inferred — Expiring only a still-running entry with no remaining waiters improves failure containment: later readers need not inherit an abandoned lookup's interruption. The regression supports this outcome without establishing every repeated-cancellation or eviction interleaving.
      🚥 Pre-merge checks | ✅ 5
      ✅ Passed checks (5 passed)
      Check nameStatusExplanation
      Title check✅ PassedThe title clearly and concisely describes the main fix: preventing PR reads from joining canceled cache lookups.
      Description check✅ PassedThe description covers the problem, change, scope and approval, verification results, limitations, and implementation agent. It matches the required template and provides specific test evidence.
      Linked Issues check✅ PassedPR #14654 addresses the server cache-admission race in directly linked issue #14113. The Effect cache patch sets expiresAt to 0 before it interrupts an abandoned lookup, so a new detail reader d…
      Out of Scope Changes check✅ PassedThe reviewed changes are limited to the cache behavior required by #14113 and its server regression test. The test directly verifies the changed behavior. The Effect patch is supporting implementation…
      Docstring Coverage✅ PassedNo functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1…
      ✨ Finishing Touches
      🧪 Generate unit tests (beta)
      • Create a new PR
      • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

      Autopilot is currently an internal CodeRabbit preview.


      Comment `@coderabbitai help` to get the list of available commands.
    4. juliusmarminge added labelsmacroscope-review

    5. Note

      Written by claude-opus-5-5 on behalf of Maria

      Hi! We are cleaning up open PRs, and this one appears to have been created with an older model (gpt-6). If this change is really important, we recommend rebuilding the PR with a newer model if possible.

    6. maria-rcks closed this

Sign in to join this conversation.