perf(server): a slow host no longer delays other watched PRs' wakes (935 ms → 65 ms median) #30291
main fromrefs/pull/30291/head·merged by maria-rcks View on GitHubProblem#
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 median | This branch median | |
|---|---|---|
| First healthy PR's wake | 936 ms | 66 ms (14×) |
| Whole sweep | 969 ms | 936 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
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:S
Note
Written by
gpt-6.1-solon behalf of MariaVerified in a real dev environment#
verified unchanged head
be7648cb43dd513ad77b216096e498cfea61e8e6on a linux boat vm. i ranvp iand the real dev app ongithub/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 codexgpt-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


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.
maria-rcks merged this56a8542
maria-rcks closed this
Sign in to join this conversation.
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
apps/server/src/orchestration-v2/PullRequestWatchReactor.ts,apps/server/src/orchestration-v2/runtimeLayer.test.tsEstimated code review effort: 2 (Simple) | ~12 minutes
Change: Bug fix
Suggested reviewers:
juliusmarminge,only21mil,yash-singh1Merge Risk:
Minimal · up to
be764Reads can start earlier while remaining limited to four at a time. No actionable merge risk was identified.
Pre-merge checks:
4
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)
CodeRabbit Verify#
dc0f29c8-01c2-4e81-a5d0-224f694adfc1Reviewing files that changed from the base of the PR and between 30724e2e9ae1c2f5da495b590e22e41e425b8db5 and be7648cb43dd513ad77b216096e498cfea61e8e6.
apps/server/src/orchestration-v2/PullRequestWatchReactor.tsapps/server/src/orchestration-v2/runtimeLayer.test.tsIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.