[rush] rushd: coalesced builds return each client's result only when the largest coalesced request finishes (head-of-line blocking)
Summary
When several compatible rush-client build requests are coalesced into one daemon batch, each client receives its terminal result only when the whole batch finishes. A small request whose operations finished long ago still waits for the largest coalesced request. For example, build --to p04 has complete output at 10.9 s but its client exits at 68.4 s, because it waits for a coalesced build --to p16. For multi-agent use, a quick check by one agent inherits the latency of another agent's full build.
Repro steps
16-project synthetic workspace (layered, 1.5 s ops, p16 slow). RUSH_DAEMON=1, rush-client from main @ 60007c9a8c, one shell:
rush-client build --to p16 & # large request
sleep 0.2; rush-client build --to p04 & # small request, coalesced into the same batch
waitExpected result: A client gets its result as soon as every operation in its own selection has reached a terminal state. The batch keeps running for the other participants.
Actual result: The --to p04 client prints all of its output by 10.9 s but exits only at 68.4 s (a 49.6 s wall versus about 10 s). A 1-operation cache-restore request queued behind a full rebuild got its first byte after 11-14.5 s, even though its operation was the first one in the running batch.
Details
Root cause (main @ 60007c9a8c): libraries/rush-daemon/src/PhasedRequestRouter.ts publishes participants' terminal results only at batch completion, after the batch barrier.
Suggested fix: track each participant's enabled operation set. When all of them are terminal, publish that participant's result early (drain its output first). Keep the lease and the batch for the remaining participants. A prototype of this approach cut the --to p04 client from 49.6 s to 10.1 s with identical output, and passed the rush-daemon suite with one new test.
This was found during an automated performance/behavior analysis of rush-client/rushd on Linux (multi-agent concurrency) and independently confirmed. Related: #6051 (queue timeout).
Standard questions
| Question | Answer |
|---|---|
@microsoft/rush globally installed version? |
built from main @ 60007c9a8c (5.179.0) |
rushVersion from rush.json? |
5.179.0 |
pnpmVersion, npmVersion, or yarnVersion from rush.json? |
[email protected] |
(if pnpm) useWorkspaces from pnpm-config.json? |
true |
| Operating system? | Linux (WSL2 Ubuntu 24.04) |
| Would you consider contributing a PR? | Yes |
Node.js version (node -v)? |
22.23.2 |
Source: microsoft/rushstack