Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): keep PR watch notifications when inline threads fail #48243

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

Problem

A failed or capped GitHub review-thread read can suppress PR watch notifications even when GitHub returned the top-level comments and submitted reviews. The watch also rereads full detail and activity on quiet sweeps despite an unchanged fingerprint.

Change

Process top-level comments and reviews when GitHub completed that list. Keep their cursor separate until inline threads are readable again so older inline replies can still be reported. Keep known partial reads on the usual fingerprint cadence and log GitHub review-thread read failures.

Scope

Closes #47963.

Verification

Reproduced on macOS 26.5 arm64 with Node 26.13.1 using the server's watch integration test and simulated GitHub responses.

  • With the upstream watcher, a fresh top-level comment produced zero notifications. When both lists were truncated, the next two-minute sweep made a second activity read despite the unchanged fingerprint.
  • With the fix, the comment produced one notification. The unchanged two-minute sweep made no additional full detail or activity reads. When the review-thread read recovered on the periodic refresh, the watch reported two older inline replies without repeating the top-level comment.
  • vp run check:changed upstream/main --concurrency 3 passed, including 482 tests across 9 files and typechecking 39 packages.

Implemented with GPT-6.2 Sol (xhigh) in the Codex harness via T3 Code.

    1. yanruileo(GitHub profile, opens in a new tab) linked this to fix #47963

    2. tanstack-source added labelsbug

    3. chatgpt-codex-connector[bot](GitHub profile, opens in a new tab)commented
      Codex Review Summary: ✅ Completed

      This comment shows the latest Codex review activity on this pull request.

      ReviewStatusCommitReview trigger
      📝 Code Review✅ Completed 2026-12-03T13:05:55.225972Z2c35aacPR opened
      ℹ️ About Codex in GitHub

      Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

      • Open a pull request for review
      • Mark a draft as ready
      • Comment "@codex review" or "@codex security review".

      Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

    4. Approvability

      Verdict: Approved at 2c35aac

      Macroscope's review found this PR approvable — PR watches can continue reporting top-level comments and reviews when inline-thread reads fail, using separate progress tracking. The change is limited to existing notification handling and additive metadata, with no obvious material risk requiring human judgment.

      You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    5. Explain Change →

      No actionable comments were generated in the recent review.

      Walkthrough

      The GitHub provider now reports top-level comment truncation and logs non-rate-limit review-thread read failures. The watch can deliver readable top-level remarks while review-thread data is incomplete, track separate remark cursors, and avoid repeated reads when fingerprints remain unchanged.

      Changes: Partial remark watch flow

      Layer / File(s)Summary
      Report top-level comment truncation
      packages/source-control-core/src/server/PullRequestProvider.ts, packages/contracts/src/pullRequest.ts, packages/source-control-github/src/server/GitHubPullRequestProvider.ts, packages/source-control-github/src/server/GitHubPullRequestProvider.test.ts, apps/server/src/pullRequest/PullRequestService.ts
      The provider activity contract and pull request activity include optional top-level comment truncation status. The GitHub provider logs non-rate-limit review-thread read failures.
      Track complete and top-level remark progress
      packages/contracts/src/threadPullRequest.ts, apps/server/src/orchestration-v2/pullRequestWatch.ts
      The watch accepts complete, top-level-only, or unavailable remarks. It tracks separate cursors and checks freshness using timestamps and remark IDs.
      Read partial remarks and verify watch cadence
      apps/server/src/orchestration-v2/PullRequestWatchReactor.ts, apps/server/src/orchestration-v2/runtimeLayer.test.ts
      The reactor handles explicitly truncated review-thread lists, tracks whether remarks were read, and compares top-level cursor progress. Runtime tests cover partial remark delivery and read timing.

      Estimated code review effort: 3 (Moderate) | ~20 minutes

      Change: Bug fix · Severity of issue fixed: Medium

      Sequence Diagram(s)

      sequenceDiagram
        participant GitHubPullRequestProvider
        participant PullRequestService
        participant PullRequestWatchReactor
        participant evaluatePullRequestWatch
        GitHubPullRequestProvider->>PullRequestService: Return activity and top-level truncation status
        PullRequestService->>PullRequestWatchReactor: Provide pull request activity
        PullRequestWatchReactor->>evaluatePullRequestWatch: Pass complete, top-level-only, or unavailable remarks
        evaluatePullRequestWatch->>PullRequestWatchReactor: Return updated watch cursors

      Suggested reviewers: juliusmarminge, yash-singh1, stienswout, saphid

      Merge Risk: Minimal · up to 2c35a

      The change keeps pull request watch notifications flowing when GitHub review-thread reads fail or are capped. It also avoids repeated full reads on quiet sweeps. No concrete merge-blocking defect was found in the reviewed changes.

      Pre-merge checks: Passed 4

      Check nameStatusExplanation
      Title checkPassedThe title "fix(server): keep PR watch notifications when inline threads fail" matches the main change. The PR keeps top-level comment and review notifications when GitHub review-thread reads fail or a…
      Description checkPassedThe description follows the template. It has Problem, Change, Scope, and Verification sections. The Problem and Change sections clearly state the bug and the fix. Scope links issue #47963 and the Veri…
      Linked Issues checkPassedIssue #47963 has four coding requirements. (1) Log review-thread read failures: GitHubPullRequestProvider.getChangeRequestActivity now logs a warning with host, repository, PR number, and error on non…
      Out of Scope Changes checkPassedAll changes support the watch fix for #47963. The reactor diff, pullRequestWatch.ts, and runtimeLayer.test.ts implement the remark handling and reread behavior. The contract additions (topLevelRemarkC…
      Full details: Title check

      Explanation

      The title "fix(server): keep PR watch notifications when inline threads fail" matches the main change. The PR keeps top-level comment and review notifications when GitHub review-thread reads fail or are capped, and the objectives describe the same goal. It follows the conventional commit format with a clear scope.

      Full details: Description check

      Explanation

      The description follows the template. It has Problem, Change, Scope, and Verification sections. The Problem and Change sections clearly state the bug and the fix. Scope links issue #47963 and the Verification section gives specific reproduction steps, the environment, and results. It does not mention the agent/model line required by the template's closing comment, but it does include one ("Implemented with GPT-6.2 Sol (xhigh) in the Codex harness via T3 Code."). The description is mostly complete.

      Full details: Linked Issues check

      Explanation

      Issue #47963 has four coding requirements. (1) Log review-thread read failures: GitHubPullRequestProvider.getChangeRequestActivity now logs a warning with host, repository, PR number, and error on non-rate-limit failures (per the change summary; source not re-read). (2) Do not silently discard top-level comments and reviews: PullRequestWatchReactor.readRemarks now returns the top-level list when reviewThreadsTruncated === true and topLevelCommentsTruncated === false, instead of returning null. The new topLevelRemarkCursor (threadPullRequest.ts) and the separate cursor logic in pullRequestWatch.ts keep older inline replies reportable after recovery. (3) Do not force full detail and activity rereads on unchanged fingerprints: the reactor diff replaces remarksComplete with remarksRead. A known partial read sets remarksRead to true, so planRead follows the normal FINGERPRINT_REREAD_MS and QUIET_REREAD_MS cadence. Failed reads still retry. (4) Tests: runtimeLayer.test.ts adds a 'both lists truncated' case that asserts no detail or activity reread on a steady-fingerprint sweep. The test was not re-run. The reactor diff was read directly; the provider logging and test changes rely on the change summary. The PR does not depend on #40740, which the issue treats as a separate scope fix.

      Full details: Out of Scope Changes check

      Explanation

      All changes support the watch fix for #47963. The reactor diff, pullRequestWatch.ts, and runtimeLayer.test.ts implement the remark handling and reread behavior. The contract additions (topLevelRemarkCursor in ThreadPullRequestWatch, topLevelCommentsTruncated in PullRequestActivity) carry the top-level truncation signal and the separate cursor from the provider to the reactor. PullRequestService.activity and ProviderChangeRequestActivity pass that field through. The GitHubPullRequestProvider change adds the warning log and the flag. The provider test adds an assertion for the same failure path. No unrelated behavior change was found in the reviewed hunks.

      Finishing Touches

      Generate unit tests (beta)

      • Create a new PR
      • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
      Recent review info

      Run configuration

      Commits

      Reviewing files that changed from the base of the PR and between 7b6a2c96f646830f10183339c2031141dd2801ca and 2c35aacae97ff3ec591144c22fb27dc1a4bf184c.

      Files selected for processing: 9

      • apps/server/src/orchestration-v2/PullRequestWatchReactor.ts
      • apps/server/src/orchestration-v2/pullRequestWatch.ts
      • apps/server/src/orchestration-v2/runtimeLayer.test.ts
      • apps/server/src/pullRequest/PullRequestService.ts
      • packages/contracts/src/pullRequest.ts
      • packages/contracts/src/threadPullRequest.ts
      • packages/source-control-core/src/server/PullRequestProvider.ts
      • packages/source-control-github/src/server/GitHubPullRequestProvider.test.ts
      • packages/source-control-github/src/server/GitHubPullRequestProvider.ts

      Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

Sign in to join this conversation.