[rush-daemon][WS2][9/9] Wire host request lifecycle - #5973
Merged
Mo Jazayeri (mojaza) merged 3 commits intoAug 28, 2026
Merged
Conversation
Mo Jazayeri (mojaza)
force-pushed
the
mojazayeri-microsoft-rushd-ws2-host-requests-upstream
branch
from
August 27, 2026 20:45
d0ff0a4 to
798f2dc
Compare
Mo Jazayeri (mojaza)
marked this pull request as ready for review
August 27, 2026 20:45
Contributor
There was a problem hiding this comment.
Pull request overview
Wires validated request lifecycles through the Rush daemon’s shared workspace session and transport.
Changes:
- Adds protocol contracts and validation for request execution, cancellation, rejection, and results.
- Introduces shared host dispatching, interactive I/O, cancellation, and shutdown handling.
- Adds end-to-end global and phased request coverage.
Reviewed changes
Copilot reviewed 38 out of 38 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
rigs/local-node-rig/profiles/default/config/jest.config.json |
Updates test discovery pattern. |
libraries/rush-daemon/src/test/DaemonRequestWireTestUtilities.ts |
Adds wire-test client utilities. |
libraries/rush-daemon/src/test/DaemonRequestWirePhased.test.ts |
Tests phased wire execution. |
libraries/rush-daemon/src/test/DaemonRequestWireGlobal.test.ts |
Tests global wire execution. |
libraries/rush-daemon/src/RushDaemonHost.ts |
Shares and disposes the dispatcher. |
libraries/rush-daemon/src/InteractiveRequestInputRouter.ts |
Changes completed-ID retention. |
libraries/rush-daemon/src/index.ts |
Exports dispatcher APIs. |
libraries/rush-daemon/src/DaemonWireRequestClient.ts |
Serializes request-scoped wire output. |
libraries/rush-daemon/src/DaemonRequestDispatcher.ts |
Resolves and routes wire requests. |
libraries/rush-daemon/src/DaemonControlSession.ts |
Implements request lifecycle state. |
libraries/rush-daemon/README.md |
Documents host request routing. |
libraries/rush-daemon-transport/src/DaemonFrameConnection.ts |
Adds abortive connection shutdown. |
libraries/rush-daemon-protocol/src/test/RequestResultValidation.test.ts |
Tests result validation. |
libraries/rush-daemon-protocol/src/test/RequestLifecycle.test.ts |
Tests lifecycle controls. |
libraries/rush-daemon-protocol/src/test/RequestEnvelopeBounds.test.ts |
Tests envelope bounds. |
libraries/rush-daemon-protocol/src/RequestResultValidation.ts |
Validates result fields. |
libraries/rush-daemon-protocol/src/RequestLifecycleCapabilityValidation.ts |
Validates lifecycle capability. |
libraries/rush-daemon-protocol/src/RequestIdentifierValidation.ts |
Validates request identifiers. |
libraries/rush-daemon-protocol/src/RequestEnvelopeValidation.ts |
Validates envelope options. |
libraries/rush-daemon-protocol/src/RequestControlValidation.ts |
Validates lifecycle messages. |
libraries/rush-daemon-protocol/src/index.ts |
Exports lifecycle contracts. |
libraries/rush-daemon-protocol/src/DaemonVerbosityFilter.ts |
Uses shared record validation. |
libraries/rush-daemon-protocol/src/DaemonRequestEnvelope.ts |
Defines request envelopes. |
libraries/rush-daemon-protocol/src/DaemonRequestControl.ts |
Defines lifecycle controls. |
libraries/rush-daemon-protocol/src/DaemonProtocolVersion.ts |
Introduces protocol minor 5. |
libraries/rush-daemon-protocol/src/DaemonEventValidation.ts |
Uses shared record validation. |
libraries/rush-daemon-protocol/src/DaemonControlMessage.ts |
Extends the control-message union. |
libraries/rush-daemon-protocol/src/DaemonControlKinds.ts |
Registers lifecycle message kinds. |
libraries/rush-daemon-protocol/src/DaemonClientCaps.ts |
Adds lifecycle negotiation. |
libraries/rush-daemon-protocol/src/ControlRecord.ts |
Extracts record detection. |
libraries/rush-daemon-protocol/src/ControlMessageValidation.ts |
Dispatches lifecycle validators. |
libraries/rush-daemon-protocol/README.md |
Documents lifecycle contracts. |
common/reviews/api/rush-daemon.api.md |
Records daemon API changes. |
common/reviews/api/rush-daemon-transport.api.md |
Records transport API changes. |
common/reviews/api/rush-daemon-protocol.api.md |
Records protocol API changes. |
common/changes/@rushstack/rush-daemon/mojazayeri-wire-host-requests_2026-08-22-09-30.json |
Adds daemon changelog entry. |
common/changes/@rushstack/rush-daemon-transport/mojazayeri-wire-host-requests_2026-08-22-09-30.json |
Adds transport changelog entry. |
common/changes/@rushstack/rush-daemon-protocol/mojazayeri-wire-host-requests_2026-08-22-09-30.json |
Adds protocol changelog entry. |
Suppressed comments (2)
libraries/rush-daemon/src/DaemonControlSession.ts:293
- If
requestCancelarrives whileresolveRequestAsync()is still pending, a cooperative resolver will reject with the abort reason. That reaches this branch as an ordinary error and is emitted asrequestRejected/routingFailed, so cancellation has the wrong terminal outcome instead of the standard abortedrequestResult. Add an abort-specific completion path (while preserving genuine cleanup failures) and cover cancellation of a deferred resolver.
if (dispatchError !== undefined && !state.client.terminalOutcomeSent && !this.#connectionClosed) {
const rejection: IClassifiedRejection = classifyRejection(dispatchError);
await state.client.writeRejectionAsync(rejection.code, rejection.message);
libraries/rush-daemon/src/DaemonControlSession.ts:301
- Every completed or rejected request ID is retained for the lifetime of the connection, and this PR also removes the corresponding 256-entry cap from
InteractiveRequestInputRouter. Because a connection can execute unlimited sequential requests—or flood distinct rejected starts while one request is active—both sets can grow without bound. Add a bounded connection lifetime/request-count policy (closing before IDs are evicted) or another bounded uniqueness strategy.
#completeRequest(requestId: string, state: IRequestState): void {
if (this.#requestById.get(requestId) !== state) return;
this.#requestById.delete(requestId);
this.#completedRequestIds.add(requestId);
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Mo Jazayeri (mojaza)
force-pushed
the
mojazayeri-microsoft-rushd-ws2-host-requests-upstream
branch
from
August 27, 2026 23:33
4e7bd6e to
cc1c8a2
Compare
Sean Larkin (TheLarkInn)
approved these changes
Aug 27, 2026
Base automatically changed from
mojazayeri-microsoft-rushd-ws2-shared-build-merge-upstream
to
main
August 28, 2026 00:22
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Mo Jazayeri (mojaza)
force-pushed
the
mojazayeri-microsoft-rushd-ws2-host-requests-upstream
branch
from
August 28, 2026 00:22
cc1c8a2 to
2d9e070
Compare
Mo Jazayeri (mojaza)
deleted the
mojazayeri-microsoft-rushd-ws2-host-requests-upstream
branch
August 28, 2026 03:13
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Migrates the final WS2 layer 9/9 into
microsoft/rushstackas a dependent human-review draft, wiring validated host/control-session request lifecycles through the real daemon protocol and transport while preserving one shared warm-workspace scheduler, dispatcher, and phased-build coordinator across connections.Depends on #5972. Supersedes mojaza#9. Follows merged #5949 and references #5897 without closing it. No PBI is assigned to this integration-only layer.
Draft for explicit human review; do not merge without maintainer approval. Do not enable auto-merge.
Details
RushDaemonHostown one warm-workspace dispatcher so separate control connections share admission scheduling and phased-build coordination.DaemonControlSessionwith request identity/state validation, request-tagged stdin, ordered backpressured output/events/results, explicit/disconnect cancellation, and deterministic cleanup.DaemonFrameListenerend-to-end coverage for global and phased execution, warm no-op requests, shared builds across clients, admission/cancellation, interactive I/O, malformed state, graph recreation, disconnect cleanup, and host shutdown.Limitations
#5895 remains open and still blocks command-independent plugin/phase graph construction and complete per-iteration runner lifetime. This layer consumes an integration-owned real graph/request seam; it does not duplicate
PhasedScriptAction, load fake plugins, or construct a fake or empty graph.Warm-session recreation/reload remains WS3 work. Rush CLI parsing, launcher cutover, configuration, and consumption of the typed
requiresInProcessfallback remain WS4 work. Each control connection runs one active request at a time so binary operation output remains unambiguous; concurrent requests use separate connections while still sharing host scheduling and batching.How it was tested
node common/scripts/install-run-rush.js test --only @rushstack/rush-daemon-protocol --only @rushstack/rush-daemon-transport --only @rushstack/rush-daemonnode common/scripts/install-run-rush.js test --only @rushstack/rush-daemonnode common/scripts/install-run-rush.js checknode common/scripts/install-run-rush.js change --verifygit diff --checkand source-to-upstream range/file-list parity review