Build the long-lived per-workspace daemon: a warm WorkspaceSession (config + all-projects graph + watcher + plugins) that routes phased and global commands with per-request cwd/env/terminal context, matches in-process exit-code / warnings-as-errors semantics, and forwards stdin/raw-mode for interactive commands. It also serializes and merges concurrent client requests via exclusivity classes, queue-and-wait admission, and shared-build merging instead of failing on 'another rush is running'.
Depends on: #5895; #5896
Scope
- Scaffold
@rushstack/rush-daemon + serve. Launched by the version-selected rush-lib; boots a transport listener and signals readiness.
- Warm
WorkspaceSession. A warm RushConfiguration + all-projects OperationGraph + plugins + inputs snapshot + a long-lived ProjectWatcher that keeps invalidating operations even with no client attached.
- Phased request routing. Map the selection via
setEnabledStates, reconcile pending watcher invalidations, subscribe the client to its operations' raw streams + events, schedule/execute one iteration, and translate final status → exit code.
- Per-request global-command context. Run global CLI actions with the client's
cwd/env/terminal injected per request (never via global process.chdir or shared process.env mutation).
- Exit-code parity. Match in-process exactly, including the
SuccessWithWarning path (stderr-with-exit-0 → warnings, honoring allowWarningsInSuccessfulBuild/RUSH_ALLOW_WARNINGS_IN_SUCCESSFUL_BUILD).
- Interactive I/O. Forward stdin bytes + raw-mode/resize control frames; classify PTY-only commands never-daemonize (run in-process on the client).
RequestScheduler. Exclusivity classes SHARED-BUILD/SHARED-READ/EXCLUSIVE + a static command-classification table; queue-and-wait admission (FIFO, an EXCLUSIVE "gate", queued-position progress events, clean Ctrl+C, --wait-timeout/--no-wait).
- Shared-build merging. Union concurrent clients' enabled sets into one iteration, while each client's exit code reflects only its own subset.
Acceptance criteria
Part of #5894.
Build the long-lived per-workspace daemon: a warm
WorkspaceSession(config + all-projects graph + watcher + plugins) that routes phased and global commands with per-request cwd/env/terminal context, matches in-process exit-code / warnings-as-errors semantics, and forwards stdin/raw-mode for interactive commands. It also serializes and merges concurrent client requests via exclusivity classes, queue-and-wait admission, and shared-build merging instead of failing on 'another rush is running'.Depends on: #5895; #5896
Scope
@rushstack/rush-daemon+serve. Launched by the version-selectedrush-lib; boots a transport listener and signals readiness.WorkspaceSession. A warmRushConfiguration+ all-projectsOperationGraph+ plugins + inputs snapshot + a long-livedProjectWatcherthat keeps invalidating operations even with no client attached.setEnabledStates, reconcile pending watcher invalidations, subscribe the client to its operations' raw streams + events, schedule/execute one iteration, and translate final status → exit code.cwd/env/terminal injected per request (never via globalprocess.chdiror sharedprocess.envmutation).SuccessWithWarningpath (stderr-with-exit-0 → warnings, honoringallowWarningsInSuccessfulBuild/RUSH_ALLOW_WARNINGS_IN_SUCCESSFUL_BUILD).RequestScheduler. Exclusivity classesSHARED-BUILD/SHARED-READ/EXCLUSIVE+ a static command-classification table; queue-and-wait admission (FIFO, anEXCLUSIVE"gate", queued-position progress events, clean Ctrl+C,--wait-timeout/--no-wait).Acceptance criteria
servestarts a listener at the workspace transport path and signals readiness; apingcontrol frame returns apong(carrying protocol + daemon version); the entrypoint is launched via the version-selectedrush-lib.rush build --to Xrequest enables X's subtree, runs one iteration, and returns the same result set as in-process; a no-op follow-up collapses to a warm skip; the client receives only its selected operations' streams/events and the correct exit code.cwd/envwhile the daemon's ownprocess.cwd()/process.envstay unchanged; two concurrent global commands from different cwds/envs do not cross-contaminate.SuccessWithWarning, and failure cases each return the same exit code as in-process, including under the warnings-as-errors settings/env (table-driven parity test).EXCLUSIVE); the scheduler admits compatible classes concurrently and serializes incompatible ones; anEXCLUSIVErequest gates later admissions until it finishes;--wait-timeoutexpires with the documented exit code and--no-waitfails fast.SHARED-BUILDselections run as one merged iteration (shared operations execute once), a failure in one client's subset does not fail another's succeeding subset, and each client gets only its subset's streams/events and a correct exit code.Part of #5894.