Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): PR sync stops reading missing pull requests every minute #17800

Mergedabiassi(GitHub profile, opens in a new tab)merged 8 commits intomain fromrefs/pull/17800/headmerged by juliusmarminge View on GitHub

Missing pull requests were read on every one-minute sync sweep, including links without snapshots on settled threads. This consumes quota without making progress. Fixes #17799.

A not-found response now starts the existing fifteen-minute retry cadence for active threads. Settled links no longer trigger periodic reads. Sibling syncs, link updates, and pending stack retries respect that backoff; an explicit reader refresh still reads immediately. A successful response restores normal polling. Current main's missing-merge-time recovery and refresh-generation handling are retained.

Maintainer takeover of @abiassi's focused fix in #17800. Contributor history is preserved, with main merged rather than rebased. The original implementation and tests were rebuilt against current main; coverage was consolidated into four new tests and an extension to the settled-thread test.

Verification on headless Linux:

  • Main baseline: 20 tests pass in PullRequestSyncReactor.test.ts.
  • Rebuilt regression suite on unchanged main: 19 pass, 4 fail. The failures show 16 settled-link reads instead of zero, 30 missing-link reads instead of two before backoff expires, event-triggered extra reads, and stack retries bypassing backoff.
  • With the fix: all 24 tests pass in that same file. The real reactor is exercised with injected host responses and TestClock, including fifteen-minute retries, recovery, explicit refresh, and both link event paths.
  • Server-only typecheck, targeted lint, formatting, and whitespace checks pass. Lint retains two existing unused-parameter warnings in the test harness.
  • Independent Opus/Sol full-diff review round 1 found no blockers. Macroscope subsequently found that changing the representative project could inherit its predecessor’s missing pause. A new regression failed before the correction, and the missing state now resets when the reading project changes. All 24 tests and the server typecheck pass. Both reviewers found no blockers in full-diff round 2 at b41599d. Current-head checks that ran pass, including Macroscope correctness and approvability; convention and label-definition jobs skipped. Macroscope marks its earlier finding obsolete. The PR remains unmerged for maintainer review.

A PR that initially returns not-found can stay without a snapshot for fifteen minutes; explicit reader refresh still bypasses this. Settled-only links also stop background stack retries until explicitly refreshed.

No visual UI changes; screenshots do not prove read cadence. No live GitHub quota was exhausted and no production server was used. Live-provider behavior, macOS, Windows, iOS, Android, and Electron desktop were not exercised in this takeover. No wire contracts or client entry points change.

Tests: Codex GPT-6-Astra (high). Implementation: Codex GPT-6.1-Sol (high). Review: Claude Opus 5.5 and Codex GPT-6-Sol. Maintainer integration: GPT-6.1-Sol through the Codex harness in T3 Code.

Fixes pingdotgg/t3code#17799

    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: Needs Human Approval

      Macroscope's review found this PR requires human approval — Missing pull requests will retry automatically every 15 minutes rather than every minute, while explicit refresh remains available. Human review is needed to accept this default refresh-policy change and its longer automatic recovery delay.

      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
      Explain Change →

      No actionable comments were generated in the recent review.

      Walkthrough

      The pull-request sync reactor now considers thread and pull-request state when scheduling reads. It tracks not-found summaries, retries them on a 15-minute cadence, and filters event-triggered requests for known-missing links.

      Changes: Pull-request sync polling

      Layer / File(s)Summary
      Due checks and missing-request cadence
      apps/server/src/orchestration-v2/PullRequestSyncReactor.ts, apps/server/src/orchestration-v2/PullRequestSyncReactor.test.ts
      Automatic sync eligibility now considers active links and their snapshots. Missing pull requests use a 15-minute cadence. A not-found summary records the missing key and sweep time, and a successful summary clears the marker. Tests cover retry timing and stack-read failures.
      Event-triggered refreshes
      apps/server/src/orchestration-v2/PullRequestSyncReactor.ts, apps/server/src/orchestration-v2/PullRequestSyncReactor.test.ts
      Link-update and pull-request-synced events use a helper that requests unsynced links unless their project-and-key is marked missing. Tests cover settled-thread links, sibling-link syncs, and reader refreshes.

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

      Change: Bug fix · Severity of issue fixed: Medium

      Possibly related issues

      • pingdotgg/t3code#21888 reports repeated pull-request sweep reads and provider cost; this change modifies polling behavior for missing and settled pull requests.
      • pingdotgg/t3code#33407 reports repeated reads of missing pull requests; this change adds backoff and suppresses event-triggered requests for known-missing links.

      Possibly related PRs

      • pingdotgg/t3code#24760 adds pull-request refreshes after matching merge or close commands; both changes involve forced refresh behavior in PullRequestSyncReactor.
      • pingdotgg/t3code#33879 applies a similar pause-and-refresh pattern to provider-unsupported failures.

      Suggested reviewers: advaitpaliwal

      Merge Risk: Minimal · up to 0dda9

      The missing-pull-request backoff preserves explicit reader refreshes. No actionable merge-blocking issue remains after normal checks.

      Security architecture risk: Low · up to a294d

      Background reads are reduced without adding access paths or permissions, and reader-triggered refresh remains available. The main uncertainty is retry behavior across restarts and projects using different credentials.

      Retained concerns No architecture-level concerns identified.

      Security review details

      Security Blast Radius

      • inferred — The changed behavior affects refresh timing for projected links sharing a pull-request identity. It does not add a caller, enlarge provider-read authority, or introduce a new event ingress in the compared changes.

      Trust Boundaries and Controls

      • observed — Link references still pass through existing project and repository routing before provider reads, and credential-aware service wrapping remains unchanged. The new scheduling decisions do not replace these controls.

      Resilience and Maintainability Implications

      • observed — Known-missing links no longer generate immediate refreshes merely because another link synced. Reader-triggered refresh remains available, while existing project/host rate-limit pauses continue to gate reads.
      Pre-merge checks: Passed 4

      Check nameStatusExplanation
      Title checkPassedThe title clearly and concisely describes the main change: preventing repeated one-minute reads of missing pull requests.
      Description checkPassedThe description provides the problem, change, scope and approval context, verification results, limitations, test coverage, and reviewer status. It does not use the template headings, but it is otherw…
      Linked Issues checkPassedIssue #17799 is an active direct link. PullRequestSyncReactor.ts now excludes settled threads before no-snapshot polling, records not-found responses, and applies the 15-minute retry cadence to ac…
      Out of Scope Changes checkPassedThe pull request changes only PullRequestSyncReactor.ts and its regression tests. The reactor changes implement the polling behavior in issue #17799. The tests directly verify the required behavior.…
      Full details: Description check

      Explanation

      The description provides the problem, change, scope and approval context, verification results, limitations, test coverage, and reviewer status. It does not use the template headings, but it is otherwise complete and directly related to the pull request.

      Full details: Linked Issues check

      Explanation

      Issue #17799 is an active direct link. PullRequestSyncReactor.ts now excludes settled threads before no-snapshot polling, records not-found responses, and applies the 15-minute retry cadence to active links. Sibling syncs, link updates, and stack retries respect the missing-link backoff. Explicit reader refresh remains immediate, and successful reads clear the missing state. The added tests cover settled links, retry cadence, recovery, sibling and link-update events, reader refresh, and stack retries.

      Full details: Out of Scope Changes check

      Explanation

      The pull request changes only PullRequestSyncReactor.ts and its regression tests. The reactor changes implement the polling behavior in issue #17799. The tests directly verify the required behavior. No unrelated UI, API, configuration, or product changes are shown.

      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 a294da720e52e36826302f9d563b50c5f0073692 and 0dda989317add7d6479aec8b177b88f8147808fa.

      Files selected for processing: 2

      • apps/server/src/orchestration-v2/PullRequestSyncReactor.test.ts
      • apps/server/src/orchestration-v2/PullRequestSyncReactor.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.

    4. juliusmarminge added labelsmacroscope-review

    5. juliusmarminge assignedjuliusmarminge

    6. Taking over this one for batch pull-request-09. I’ll keep the focused backoff behavior, reduce the regression coverage to the cases that matter, merge current main, and verify the link-update and explicit-refresh paths before publishing. This remains unmerged.

    7. juliusmarminge added labelsbugfix

    8. juliusmarminge added labelspr:needs-julius

    9. juliusmarminge removed labelspr:needs-julius

    10. juliusmarminge added labelspr:gate-failed

    11. Evidence

      Run identical CLI/RPC steps against fresh state: link a missing PR and found sibling; sync the sibling and relink the missing PR; settle threads containing missing and found links; fail a periodic stack lookup after obtaining a snapshot, then settle that thread. Observe settlement, unsettle the missing link, explicitly refresh twice, wait through fifteen-minute backoff, restore visibility, refresh, and observe automatic polling.

      Both sides use unchanged real T3 servers and a controlled local HTTPS GitHub Enterprise fixture, with real HTTP/WebSocket, persistence, caches, and wall-clock intervals. Images are transcript frames; MP4s are 30x output playbacks, not browser recordings. Original recordings and raw evidence are supplied.

      Before — a03d9bce02After — 0dda989317
      Before: sibling sync and relinkAfter: sibling sync and relink
      Before: settled links and stack retryAfter: settled links and stack retry
      Before: backoffAfter: backoff
      Before: recoveryAfter: recovery
      Before playbackAfter playback
      Before original recordingAfter original recording
      Before server spansAfter server spans

      Sibling sync and relink advanced missing-read totals to 2 and 3 on base; head stayed at 1. During the 190-second settled window, base made four additional reads of each missing link; head made none. The stack case had a persisted snapshot before its periodic failure: after settlement, base made 21 additional summary reads and head made zero.

      After the second explicit not-found response, base retried in 57.724 seconds; head retried in 901.377 seconds, with zero periodic reads inside the first 900 seconds. Four explicit refreshes per side are individually recorded: two not-found responses, one unreachable-fixture attempt, and one successful recovery response. The fixture interruption and restoration remain visible in the recordings; neither app server was restarted.

      The same head PR key then returned found and persisted a snapshot. Automatic reads followed at 08:12:53.115 and 08:13:53.191 UTC, 60.076 seconds apart, without further refreshes. All 133 captured HTTPS summary reads correlate with server summary spans beneath PullRequestSyncReactor.sweep.

      Driver · HTTPS fixture · Recovery driver · Polling observer · State setup · Run instructions

      Measurements · Complete evidence bundle · Interactive timeline

      AI-assisted; verified with the tests and tools listed above.

      Not shown:

      • Live GitHub deleted/private-repository authorization and production stack responses were not exercised: the external host boundary was a controlled local HTTPS GitHub Enterprise fixture.
      • Browser, desktop, and mobile UI interaction was not exercised. This server proof uses real CLI/RPC, captured HTTP traffic, and matching server spans; supplied images and videos are transcript renderings.
    12. tanstack-source added labelsbug

    13. juliusmarminge merged this7f65c9c

    14. juliusmarminge closed this

Sign in to join this conversation.