-
Notifications
You must be signed in to change notification settings - Fork 710
[rush-daemon] Surface warm snapshot and daemon shutdown errors to the right client #6070
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Sean Larkin (TheLarkInn)
merged 11 commits into
main
from
thelarkinn-fix-rushd-error-surfacing
Sep 24, 2026
+620
−42
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
d3fb8cf
[rush-daemon] Surface warm snapshot and daemon shutdown errors to the…
TheLarkInn 1e987f9
Update API reports
TheLarkInn a107cd6
[rush-daemon] Report the shutdown reason for requests aborted before …
TheLarkInn 09ec313
[rush-daemon] Move request-scoped reconcile diagnostics into EngineTe…
TheLarkInn d7c71cd
Merge remote-tracking branch 'origin/main' into thelarkinn-fix-rushd-…
TheLarkInn d2b27bf
[rush-daemon] Address review: shutdown reason for queued and raw-mode…
TheLarkInn 2b7000b
[rush-daemon] Report the shutdown reason from global and graph reques…
TheLarkInn 9e87079
Format with prettier and update the protocol API report
TheLarkInn f1f3e5b
Update the protocol change file for minor 11
TheLarkInn c7fc639
Merge remote-tracking branch 'origin/main' into thelarkinn-fix-rushd-…
TheLarkInn ac46fb0
[rush-cli-client] Expect the cancelled request count from daemon stop…
TheLarkInn File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license. | ||
| // See LICENSE in the project root for license information. | ||
|
|
||
| import type { IDaemonCommandResult } from '@rushstack/rush-daemon-protocol'; | ||
|
|
||
| /** | ||
| * Returns the stderr line that explains a failed daemon result, if any. | ||
| * | ||
| * @remarks | ||
| * A non-zero result's error message (for example, a daemon shutdown that aborted the request) is the only | ||
| * place the daemon reports failures that are not attributed to an operation, so it must not be dropped. | ||
| * Returns `undefined` for `no-wait` and `wait-timeout` admission failures, which `formatAdmissionFailure` | ||
| * explains. | ||
| */ | ||
| export function getResultDiagnostic( | ||
| result: Pick<IDaemonCommandResult, 'admissionErrorCode' | 'errorMessage' | 'exitCode'> | ||
| ): string | undefined { | ||
| // A request aborted while waiting for admission carries the reason (such as a daemon shutdown) in its | ||
| // error message; other admission failures are explained by `formatAdmissionFailure`. | ||
| if (result.admissionErrorCode !== undefined && result.admissionErrorCode !== 'aborted') return undefined; | ||
| if (result.exitCode !== 0 && result.errorMessage) { | ||
| return `rush-client: ${result.errorMessage}\n`; | ||
| } | ||
| return undefined; | ||
| } |
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license. | ||
| // See LICENSE in the project root for license information. | ||
|
|
||
| import { getResultDiagnostic } from '../resultDiagnostics'; | ||
|
|
||
| describe(getResultDiagnostic.name, () => { | ||
| it('prints the error message of a failed result', () => { | ||
| expect( | ||
| getResultDiagnostic({ | ||
| exitCode: 1, | ||
| errorMessage: 'The Rush daemon was shut down (idle timeout) while this request was running.' | ||
| }) | ||
| ).toBe('rush-client: The Rush daemon was shut down (idle timeout) while this request was running.\n'); | ||
| }); | ||
|
|
||
| it('prefers the reason of a request aborted while waiting for admission', () => { | ||
| expect( | ||
| getResultDiagnostic({ exitCode: 1, admissionErrorCode: 'aborted', errorMessage: 'daemon shut down' }) | ||
| ).toBe('rush-client: daemon shut down\n'); | ||
| }); | ||
|
|
||
| it('leaves no-wait and wait-timeout admission failures to the admission formatter', () => { | ||
| expect( | ||
| getResultDiagnostic({ exitCode: 1, admissionErrorCode: 'wait-timeout', errorMessage: 'x' }) | ||
| ).toBeUndefined(); | ||
| expect( | ||
| getResultDiagnostic({ exitCode: 1, admissionErrorCode: 'no-wait', errorMessage: 'x' }) | ||
| ).toBeUndefined(); | ||
| expect(getResultDiagnostic({ exitCode: 1, admissionErrorCode: 'aborted' })).toBeUndefined(); | ||
| }); | ||
|
|
||
| it('stays silent for successful results and failures without a message', () => { | ||
| expect(getResultDiagnostic({ exitCode: 0, errorMessage: 'ignored' })).toBeUndefined(); | ||
| expect(getResultDiagnostic({ exitCode: 1 })).toBeUndefined(); | ||
| }); | ||
| }); |
11 changes: 11 additions & 0 deletions
11
common/changes/@rushstack/rush-cli-client/fix-rushd-error-surfacing_2026-09-24-01-50.json
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| { | ||
| "changes": [ | ||
| { | ||
| "packageName": "@rushstack/rush-cli-client", | ||
| "comment": "Print the error message of a failed daemon result (for example, a daemon shutdown that cancelled the build), and report cancelled requests from \"rush-client daemon stop\".", | ||
| "type": "patch" | ||
| } | ||
| ], | ||
| "packageName": "@rushstack/rush-cli-client", | ||
| "email": "selarkin@microsoft.com" | ||
| } |
11 changes: 11 additions & 0 deletions
11
common/changes/@rushstack/rush-client-core/fix-rushd-error-surfacing_2026-09-24-01-50.json
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| { | ||
| "changes": [ | ||
| { | ||
| "packageName": "@rushstack/rush-client-core", | ||
| "comment": "Return the daemon shutdown acknowledgement, including its optional active request count, from DaemonClient.shutdownAsync().", | ||
| "type": "patch" | ||
| } | ||
| ], | ||
| "packageName": "@rushstack/rush-client-core", | ||
| "email": "selarkin@microsoft.com" | ||
| } |
11 changes: 11 additions & 0 deletions
11
...n/changes/@rushstack/rush-daemon-protocol/fix-rushd-error-surfacing_2026-09-24-01-50.json
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| { | ||
| "changes": [ | ||
| { | ||
| "packageName": "@rushstack/rush-daemon-protocol", | ||
| "comment": "Add an optional \"activeRequests\" count to the shutdownAck control message; advertised as protocol minor 11 (`DAEMON_SHUTDOWN_ACTIVE_REQUESTS_PROTOCOL_MINOR`); older peers omit or ignore it.", | ||
| "type": "patch" | ||
| } | ||
| ], | ||
| "packageName": "@rushstack/rush-daemon-protocol", | ||
| "email": "selarkin@microsoft.com" | ||
| } |
11 changes: 11 additions & 0 deletions
11
common/changes/@rushstack/rush-daemon/fix-rushd-error-surfacing_2026-09-24-01-50.json
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| { | ||
| "changes": [ | ||
| { | ||
| "packageName": "@rushstack/rush-daemon", | ||
| "comment": "Report warm input-snapshot failures (with the engine diagnostics) to the failing request instead of replaying them into the next request, abort requests interrupted by a daemon shutdown with a typed DaemonShutdownError that names its initiator, and report running requests in the shutdown acknowledgement.", | ||
| "type": "patch" | ||
| } | ||
| ], | ||
| "packageName": "@rushstack/rush-daemon", | ||
| "email": "selarkin@microsoft.com" | ||
| } |
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
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
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
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
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
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
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
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
17 changes: 17 additions & 0 deletions
17
libraries/rush-daemon-protocol/src/ShutdownAckValidation.ts
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license. | ||
| // See LICENSE in the project root for license information. | ||
|
|
||
| import { DaemonProtocolError } from './DaemonProtocolError'; | ||
|
|
||
| const ZERO: number = 0; | ||
|
|
||
| /** Validates the optional active request count of a shutdown acknowledgement. @internal */ | ||
| export function validateShutdownAck(payload: Record<string, unknown>): void { | ||
| const value: unknown = payload.activeRequests; | ||
| if (value === undefined || isNonnegativeInteger(value)) return; | ||
| throw new DaemonProtocolError('malformedControlMessage', 'Invalid shutdownAck field "activeRequests".'); | ||
| } | ||
|
|
||
| function isNonnegativeInteger(value: unknown): boolean { | ||
| return typeof value === 'number' && Number.isSafeInteger(value) && value >= ZERO; | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.