[Bug]: watch_pull_request silently stops waking on all comments and rereads every 2 minutes when review-thread reads fail #47963
Before submitting#
- I searched existing issues and did not find a duplicate.
- I included enough detail to reproduce or investigate the problem.
Area#
apps/server
Steps to reproduce#
- Configure T3 Code with a GitHub credential for which
GitHubPullRequestApi.listReviewThreadComments(ReviewThreads) fails with a non-rate-limit error whilegetPullRequestDetail(PullRequestCore) andgetPullRequestActivity(PullRequestActivity) succeed — for example, a token withrepoandwrite:discussionbut withoutread:org(the scope trigger itself is addressed separately by #40740), or any persistent GraphQL / HTTP 5xx error onlistReviewThreadComments. - Start watching an open pull request via
watch_pull_request. - While CI checks are still pending (or after checks finish), post a new top-level PR comment, submit a PR review, or add an inline review comment from another account.
- Observe the watched thread across multiple 2-minute watch sweeps (and inspect server logs and
pull_request_readoutput).
Expected behavior#
- A failed
listReviewThreadCommentscall should be logged (at least as a warning) rather than swallowed silently. - Persistent review-thread read failures should not cause a watched PR to silently suppress all comment/review wakes indefinitely with no visible error or notice to the watching thread.
- When
reviewThreadsTruncatedpersists across sweeps (whether from a persistent read error or a PR exceeding the 10-page review-thread cap), the watch reactor should not bypass unchanged fingerprints and force fulldetail+activityre-reads on every 2-minute sweep indefinitely.
Actual behavior#
- Silent error swallowing:
GitHubPullRequestProvider.getChangeRequestActivity(packages/source-control-github/src/server/GitHubPullRequestProvider.ts) catches every non-rate-limit error fromcli.listReviewThreadCommentswithEffect.catchIfand returns a synthetic empty fallback withtruncated: trueandreviewThreadsTruncated: true, without logging the failure. BecauseactivityReadreturnsExit.Success,PullRequestWatchReactornever hits itspull request watch activity read failedwarning path either. - Total silent blackout on all comments and reviews:
PullRequestWatchReactor.readRemarks(apps/server/src/orchestration-v2/PullRequestWatchReactor.ts) returnsnullwheneveractivity.commentsTruncated && activity.reviewThreadsTruncated !== false. Even whengetPullRequestActivitysucceeded and returned new top-level issue comments and reviews, all remarks are discarded silently (remarks = null), so the thread only ever wakes on check transitions and never on comments or reviews. - Unbounded 2-minute full rereads (quota burn): Because
readRemarksreturnsnull,lastReadsrecordsremarksComplete: false. On every subsequent 2-minute sweep,planReadsees!last.remarksCompleteand forces bothdetail: trueandactivity: trueregardless of unchanged fingerprints (defeatingFINGERPRINT_REREAD_MS).
Note: #40740 fixes the INSUFFICIENT_SCOPES trigger on Reactions / Team, which is how this was discovered, but this underlying silent-failure and reread-loop behavior affects any non-rate-limit listReviewThreadComments failure (or any PR whose review threads exceed the REVIEW_THREAD_PAGES cap) even after #40740 lands.
Impact#
Major degradation or frequent failure
Version or commit#
T3 Code 0.1.13 (main @ 5f982be5)
Environment#
macOS, T3 Code 0.1.13 (desktop/server), GitHub provider
Logs or stack traces#
# Direct GraphQL execution of ReviewThreads with a token lacking read:org
# produces INSUFFICIENT_SCOPES, which GitHubPullRequestProvider.getChangeRequestActivity
# catches silently and turns into:
# commentsTruncated: true
# reviewThreadsTruncated: true
# reviewThreads: []
#
# No warning is logged in GitHubPullRequestProvider or PullRequestWatchReactor,
# readRemarks returns null on every sweep, and remarksComplete remains false.
Workaround#
- For the
read:orgscope trigger specifically, grantingread:orgto the token (or landing #40740) restoreslistReviewThreadComments. - There is currently no workaround for the silent failure / unbounded reread behavior when
listReviewThreadCommentsfails for other non-rate-limit reasons or hits the review-thread page cap.
tanstack-source added labelsbug
yanruileo(GitHub profile, opens in a new tab) linked this to #48243
Sign in to join this conversation.