Skip to content
Source
Sign inSign up
pingdotgg/t3code

perf(server): a slow host no longer delays other watched PRs' wakes (935 ms → 65 ms median) #30291

MergedYuruzuu(GitHub profile, opens in a new tab)merged 1 commit intomain fromrefs/pull/30291/headmerged by maria-rcks View on GitHub

Problem

When several pull requests are watched, one slow host delays the wake for every other watched PR. Each sweep asks every watched PR's host for a fingerprint, then reads no PR at all until the slowest fingerprint answers. A GitHub Enterprise host taking a second, or a request heading toward its 30 s timeout, holds back healthy github.com PRs by that long.

Change

PullRequestWatchReactor.sweep ran Effect.forEach(groups, fingerprintOf, { concurrency: "unbounded" }) to completion before starting any readGroup.

Now every fingerprint is still requested at once, so GitHub's 25-alias batching is unchanged. Each group's read starts as soon as its own fingerprint arrives. A four-permit semaphore keeps the same limit of four group reads in flight. Rate-limited fingerprints still pause their group, and failed ones still fall back to a full read.

This is server-only, and every client benefits. GitHub is the only provider with fingerprints; other providers return null at once and read as before. Independent PRs may now wake in a different order. Targets within one PR still dispatch in order.

Scope and approval

This qualifies for the small, focused bug-fix exception in CONTRIBUTING.md. Work waiting on unrelated work is an obvious performance defect. There is no feature, product default, or contract change.

Verification

Benchmark: one sweep of the real reactor with injected host latency. There are 8 watched PRs: one host answers fingerprints in 900 ms, the other seven in 30 ms, and detail reads take 30 ms. main and this branch ran 7 times each, alternating which went first.

main medianThis branch median
First healthy PR's wake936 ms66 ms (14×)
Whole sweep969 ms936 ms

The whole sweep still waits on the slow host, as it should. Fingerprint, detail and activity call counts (8 / 8 / 8) are identical.

Test: runtimeLayer.test.ts › reads each watched PR as soon as its own fingerprint lands. PR #21's fingerprint only resolves after #22 has been read, so it hangs on main and passes here. vp run check:changed passes.

Not checked: a real slow Enterprise host, and the time from wake to an agent resuming.

Split from #30288. #30292 changes a different function in the same file; whichever lands second may need a small rebase.

Made with Claude Opus 5.5 via Claude Code in T3 Code, from an audit by GPT-6.1 Sol via Codex.

🤖 Generated with Claude Code

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

    2. Review in Change Stack →

      No actionable comments were generated in the recent review.

      Walkthrough

      The pull-request watch sweep now starts each group read when its fingerprint arrives and limits active reads to four. A regression test covers two watched pull requests whose reads otherwise wait on each other.

      Changes: Pull-request watch sweep

      Layer / File(s)Summary
      Start group reads as fingerprints arrive
      apps/server/src/orchestration-v2/PullRequestWatchReactor.ts, apps/server/src/orchestration-v2/runtimeLayer.test.ts
      The sweep starts group reads as fingerprint results arrive and limits active reads to four. Paused fingerprints still skip reads. The regression test checks that one sweep records messages for both watched pull requests.

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

      Change: Bug fix

      Suggested reviewers: juliusmarminge, only21mil, yash-singh1

      Merge Risk: Minimal · up to be764

      Reads can start earlier while remaining limited to four at a time. No actionable merge risk was identified.

      Pre-merge checks: Passed 4
      Check nameStatusExplanation
      Title checkPassedThe title uses the conventional commit form and names the main change: the server no longer makes other watched PRs wait on a slow host. The raw summary confirms that sweep now starts each group's rea…
      Description checkPassedThe description follows the template's main sections: Problem, Change, Scope and approval, and Verification. The Problem and Change sections explain the slow-host stall and the fix in detail. The Scop…
      Linked Issues checkPassedCheck skipped because no linked issues were found for this pull request.
      Out of Scope Changes checkPassedCheck skipped because no linked issues were found for this pull request.
      Full details: Title check

      Explanation

      The title uses the conventional commit form and names the main change: the server no longer makes other watched PRs wait on a slow host. The raw summary confirms that sweep now starts each group's read when its own fingerprint arrives. The title's figures (935 ms to 65 ms median) match the benchmark in the description, which reports 936 ms and 66 ms for the first healthy PR's wake. The title is long at 91 characters, but it is specific and on topic.

      Full details: Description check

      Explanation

      The description follows the template's main sections: Problem, Change, Scope and approval, and Verification. The Problem and Change sections explain the slow-host stall and the fix in detail. The Scope section cites the small bug-fix exception in CONTRIBUTING.md and explains why the change qualifies. The Verification section gives benchmark numbers, names the focused test, and lists what was not checked. The template's header comment asks for a conventional commit title, and the PR title meets that rule. The description does not link a triaged issue, but it argues for the small-fix exception, which the template allows.

      Finishing Touches
      Generate unit tests (beta)
      • Create a new PR
      • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

      CodeRabbit Verify

      • Run CodeRabbit Verify to test the changes in this pull request.
      Recent review info
      Run configuration
      Commits

      Reviewing files that changed from the base of the PR and between 30724e2e9ae1c2f5da495b590e22e41e425b8db5 and be7648cb43dd513ad77b216096e498cfea61e8e6.

      Files selected for processing: 2
      • apps/server/src/orchestration-v2/PullRequestWatchReactor.ts
      • apps/server/src/orchestration-v2/runtimeLayer.test.ts

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

    3. maria-rckscommented

      Note

      Written by gpt-6.1-sol on behalf of Maria

      Verified in a real dev environment

      verified unchanged head be7648cb43dd513ad77b216096e498cfea61e8e6 on a linux boat vm. i ran vp i and the real dev app on github/main (15707a84b0) in a separate worktree first, stopped that server, then ran the exact pr head with fresh isolated state. playwright drove /usr/bin/google-chrome. each app created a real project and thread, selected codex gpt-6.1-sol, and had the provider watch this pr separately on github.com and git.cafe. no mocks, fixtures, seeded data or source instrumentation.

      • main reproduced the wait: github's fingerprint finished at 535.5 ms; git.cafe's read started at 536.6 ms. a second main sweep with network delay to github held the healthy read until 6,498.4 ms.
      • the pr started git.cafe's read at 2.5 ms, before github's fingerprint finished at 727.1 ms. real host requests returned http 200. these are separate live sweeps, so no speedup multiplier is claimed.
      • both hosts' check results woke real codex continuations and appeared in the web client. later unchanged sweeps kept exactly two check notices, with no duplicate wakes.
      • the ui's stop/start controls changed two monitors to one and back, preserving both pr links. repeated stop/restart also passed. the verification watches were stopped afterward.

      command transcript and measured runtime spans

      real codex continuations for both hosts and two active monitors

      watch stop and restart preserve both links

      the recording was inspected, trimmed, uploaded, and played and sought in t3's browser.

      blacksmith ran the pipeline regression and both quiet-head deadline cases: 3 passed. an earlier combined selection including settling cases failed two quiet-head read-count assertions. replacing only the reactor with its pre-change version reproduced the same failures (expected 4/8 reads, got 5/9). isolated quiet-head cases pass before and after. no source changes were needed. the host currently reports passing ci.

      Not verified

      a real github enterprise host; 25-alias batching and saturation of the four-read limit; rate-limited or failed-fingerprint paths against real hosts; native desktop, ios or android clients; other agent providers; remote relay/tunnel connections. the vm's codex proxy required automatic retries, but the initial turn and both watch-triggered continuations completed. the transcript records the existing combined-test interference.

    4. maria-rcks merged this56a8542

    5. maria-rcks closed this

Sign in to join this conversation.