Repository navigation
fix(mothership): classify a cancel the worker reports as an explicit stop - #10329
Merged
Merged
Conversation
…stop A turn is cancelled when this node's abort signal fired or when the worker's terminal said cancelled. The worker sends a cancelled terminal only for a Stop, but when that Stop reached it another way (another Sim node, or the worker's own stop handling), live or replayed during recovery, this node's signal never fired. recordCancelled read only the signal, so a user Stop was logged at ERROR as "Stream cancelled with unknown abort reason" with an undefined reason, although finalize correctly reported an explicit stop. recordCancelled now takes AbortReason.WorkerTerminalStop when the signal is still live: that is the only other source of a cancelled verdict. Nothing aborts with it, so the controller, its listeners and the SSE close telemetry are unchanged. The start test's session mock now delegates to the real classifier.
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
[Medium impact] The PR appears safe to merge. SummaryClassifies a worker-reported cancellation as an explicit Stop when this node's abort signal has not fired.
No actionable issues were found. Tests were inspected but not run.
|
This branch was previously deployed
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
cancelled. The worker sends a cancelled terminal only for a Stop. When that Stop reached it another way (another Sim node, or the worker's own stop handling), live or replayed during recovery, this node's signal never fired, andrecordCancelledread only the signalrecordCancelleduses the newAbortReason.WorkerTerminalStopwhen the signal is still live, because that is the only other source of a cancelled verdict. Nothing aborts with it, so the controller, its listeners and the SSE close telemetry are unchanged.isExplicitStopReasonaccepts it, so the span is recorded as an expected stopotel.tsthat listed only two of the explicit-stop reasonsType of Change
Testing
start.test.ts: the existing "cancelled without abortSignal aborted" test now also asserts that no unknown-reason error is logged; it fails on the previous code. The session mock'sisExplicitStopReasondelegates to the real classifier, so its list can't drifttsc --noEmitandbun run lintclean;lib/mothership/requestplus the slack-search assistant (which shares the classifier) pass/simplifyreview (reuse, simplification, efficiency, altitude). The altitude pass moved the fix from the stream loop to where the verdict is consumed, so recovery replays are covered tooChecklist