#6059·rushstack

[rush] rushd: daemon-side errors are hidden or misattributed (input-snapshot error replayed on the next request; shutdown during a build exits 1 silently)

Author: TheLarkInnCreated Sep 24, 2026Updated Sep 24, 2026

Summary

Two cases where daemon-side errors are hidden from the user or shown to the wrong request.

  1. An input-snapshot failure is replayed on the next request. On a warm daemon, if computing the repo state fails (for example git Permission denied on a source file), the failing request only gets rush-client: Daemon rejected the request (routingFailed): Rush could not capture the next workspace inputs snapshot. The real error (Error calculating the state of the repo. (inner error: ... fatal: could not open 'packages/p03/src/index.js' for reading: Permission denied ...) plus a stack) is printed later on the stderr of the next, successful request, which may belong to another user or agent and exits 0. On a cold daemon the failing request does get the full text. Root cause: the bound graph keeps the EngineTerminalProvider of the request that bound it (ProductionDaemonRequestResolver.ts:81-95). Warm reconciliation logs the git error into that terminal's buffer (EngineTerminalProvider.ts:14-17), WorkspaceEngineComponentFactory.ts:265-268 throws a generic error without it, and the next request's configureIteration flushes the stale buffer (EngineTerminalProvider.ts:31-33).
  2. Daemon shutdown during a build makes in-flight clients exit 1 silently. rush-client daemon stop from another shell, or SIGTERM/SIGINT to the daemon, cancels running builds. The victim's output just stops after the last completed operation, and it exits 1 (the same code as a compile error) with no explanation. daemon stop prints {"state":"shutdownAccepted"} with no hint that it cancelled N running requests. Root cause: DaemonControlSession.ts:447-473 aborts every request with a generic The daemon control session is closing. The client never prints result.errorMessage (apps/rush-cli-client/src/launchClient.ts:188-195). #shutdownHostAsync (:236-243) acknowledges shutdown without reporting active requests.

Repro steps

bash
# (1) warm daemon, RUSH_DAEMON=1
chmod 000 packages/p03/src/index.js; rush-client build   # A: generic message, exit 1
chmod 644 packages/p03/src/index.js; rush-client build   # B: exit 0, but prints A's git error + stack on stderr
# (2)
rush-client build > b.log 2>&1 &  sleep 3;  rush-client daemon stop;  wait $!; echo $?   # 1; b.log just stops

Expected result: Each request gets its own complete error, with native parity for the message text, and no diagnostics leak into later requests. A client whose build is cancelled by a daemon shutdown prints the cause (for example the daemon was shut down (daemon stop) while this build was running; re-run the command). daemon stop reports how many active requests it cancelled, or requires --force while builds are running.

Actual result: As described above.

Details

Suggested fix: make buffered engine diagnostics request-scoped. Drain them into the thrown error and clear the buffer at the start of each request. Abort requests with a typed shutdown reason (initiator: signal, control client, idle, or restart) that the client renders. Have the client print result.errorMessage for non-zero results. Include activeRequests in shutdownAck.

This was found during an automated performance/behavior analysis of rush-client/rushd on Linux and independently reproduced.

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