Repository navigation
Add onStdinEnd interrupt policy to stdio RPC and MCP servers - #10415
Merged
Merged
Conversation
🦋 Changeset detectedLatest commit: 47a8e45 The changes in this PR will be included in the next version bump. This PR includes changesets to release 33 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
effect-bot
force-pushed
the
v4/next-minor
branch
from
November 6, 2026 00:03
d875088 to
97e2192
Compare
Contributor
Bundle Size AnalysisGenerated from PR build output; treat the content below as untrusted.
|
- disconnect: drop the empty-fibers early return, Fiber.awaitAll handles it - handleDisconnect: use the lazy andThen form instead of an explicit suspend - layerProtocolStdio: remove the generic layer-memoization gotcha now that it is an ordinary layer constructor
effect-bot
force-pushed
the
v4/next-minor
branch
9 times, most recently
from
November 8, 2026 06:57
911715d to
fce945e
Compare
tim-smart
pushed a commit
that referenced
this pull request
Nov 16, 2026
effect-bot
added a commit
that referenced
this pull request
Nov 16, 2026
effect-bot
added a commit
that referenced
this pull request
Nov 19, 2026
effect-bot
added a commit
that referenced
this pull request
Nov 20, 2026
effect-bot
added a commit
that referenced
this pull request
Nov 20, 2026
effect-bot
added a commit
that referenced
this pull request
Nov 20, 2026
effect-bot
added a commit
that referenced
this pull request
Nov 20, 2026
effect-bot
added a commit
that referenced
this pull request
Nov 20, 2026
effect-bot
added a commit
that referenced
this pull request
Nov 20, 2026
effect-bot
added a commit
that referenced
this pull request
Nov 20, 2026
effect-bot
added a commit
that referenced
this pull request
Nov 20, 2026
effect-bot
added a commit
that referenced
this pull request
Nov 20, 2026
effect-bot
added a commit
that referenced
this pull request
Nov 20, 2026
effect-bot
added a commit
that referenced
this pull request
Nov 20, 2026
effect-bot
added a commit
that referenced
this pull request
Nov 20, 2026
effect-bot
added a commit
that referenced
this pull request
Nov 20, 2026
effect-bot
added a commit
that referenced
this pull request
Nov 20, 2026
effect-bot
added a commit
that referenced
this pull request
Nov 20, 2026
effect-bot
added a commit
that referenced
this pull request
Nov 22, 2026
effect-bot
added a commit
that referenced
this pull request
Nov 22, 2026
effect-bot
added a commit
that referenced
this pull request
Nov 23, 2026
effect-bot
added a commit
that referenced
this pull request
Nov 23, 2026
effect-bot
added a commit
that referenced
this pull request
Nov 23, 2026
effect-bot
added a commit
that referenced
this pull request
Nov 23, 2026
effect-bot
added a commit
that referenced
this pull request
Nov 23, 2026
effect-bot
added a commit
that referenced
this pull request
Nov 23, 2026
effect-bot
added a commit
that referenced
this pull request
Nov 23, 2026
effect-bot
added a commit
that referenced
this pull request
Nov 23, 2026
effect-bot
added a commit
that referenced
this pull request
Nov 23, 2026
effect-bot
added a commit
that referenced
this pull request
Nov 23, 2026
effect-bot
added a commit
that referenced
this pull request
Nov 23, 2026
effect-bot
added a commit
that referenced
this pull request
Nov 23, 2026
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
Add opt-in
onStdinEnd: "interrupt"toMcpServer.layerStdioand the stdio RPC protocol. The default remains"drain", preserving clients that half-close stdin and keep reading responses.In interrupt mode, stdin EOF ends the protocol's output queue. Already-queued output is flushed, then the existing stdout-completion path stops the server. Existing scope cleanup interrupts active handlers and waits for their finalizers. Output is closed before interruption, so finalizers cannot emit further responses or remote cancellation notifications.
This is a server stop, not a client-disconnect event:
onDisconnectis not called. Cleanup belongs in handler finalizers or the layer scope. The RPC disconnect implementation and MCP runtime are unchanged from the PR's original base; no disconnect tracking or cross-transport lifecycle changes are needed.API migration
The unstable
RpcServer.makeProtocolStdioandRpcServer.layerProtocolStdioexports become functions accepting optional{ onStdinEnd: "drain" | "interrupt" }. Existing callers must usemakeProtocolStdio()/layerProtocolStdio(). Each layer constructor call creates a distinct layer. Theeffect: minorchangeset includes migration instructions.Validation
All commands run through
nix develop -c:pnpm lint-fix,pnpm lint,pnpm check,pnpm jsdocs --checkpnpm test --run packages/effect/test/rpc/RpcServer.test.ts packages/effect/test/ai/McpServer/McpServer.test.ts packages/platform/node/test/RpcServer.test.ts: 257 passed.Coverage includes active-handler and idle EOF shutdown, pending MCP elicitation without remote cancellation, connected cancellation, and existing default-draining behavior. Tests are unchanged in the implementation simplification commit.
Closes #10412
Closes EFF-3436