Skip to content

feat(child-process): support writable stdin for spawned processes - #314

Open
euxaristia wants to merge 2 commits into
vercel-labs:mainfrom
euxaristia:main
Open

euxaristia wants to merge 2 commits into
vercel-labs:mainfrom
euxaristia:main

Conversation

@euxaristia

Copy link
Copy Markdown
Contributor

Summary

Enable persistent duplex communication with spawned processes, including MCP stdio servers. Explicit piped stdin currently fails compilation; this adds a writable child.stdin alongside the existing piped stdout and stderr.

Changes

  • Add static-native lowering, IR validation, and C/LLVM emission for child.stdin, string and byte writes, end(), destroy(), writable, and error/finish/drain listeners.
  • Implement queued nonblocking writes, backpressure, and stream lifecycle handling in the Windows and POSIX runtimes. Keep explicit diagnostics for unsupported overloads.
  • Add five Node differential cases covering duplex writes, 1 MiB backpressure, writes after end/finish, and destruction; update compatibility evidence.
  • Normalize diagnostic paths and pin diagnostic fixture line endings so the same snapshots work on Windows and Linux.

Validation

Validated commit c8b37bb against the repository-pinned Node 24.15.0:

  • Windows C backend: all five stdin differential cases match stdout, stderr, and exit status.
  • Ubuntu LLVM backend: all five cases pass in both plain and sanitized runs.
  • Windows LLVM object generation succeeds for the new cases; all 120 diagnostic snapshots pass.
  • Full Ubuntu plain suite: 3,992 passed, 4 failed. Full sanitized suite: 3,979 passed, 17 failed. Every failure reproduces on the unchanged baseline; neither lane has a patch-only failure.
  • Downstream native MCP stdio integration passes on Windows and Ubuntu.

The full suites are not entirely green. Windows LLVM executable linking still fails with the existing unresolved _fltused symbol, also reproduced with a pre-existing non-stdin program. Windows sanitizer execution is not validated. The passing Windows execution results use the C backend; they do not establish LLVM executable or sanitizer parity.

Refs #311.

Enable persistent duplex transports such as MCP stdio with piped child
stdin, queued string and byte writes, backpressure, end, destroy, and
error, finish, and drain listeners. Add frontend, IR, C, LLVM, and
Windows/POSIX runtime support with five differential regression cases.

Make diagnostic fixtures portable across Windows and Linux through LF
attributes and path normalization, and regenerate compatibility evidence.

Validate against Node 24.15.0: stdin cases pass on Windows through the C
backend and on Ubuntu through LLVM, including sanitizers. Windows LLVM
object generation and all 120 diagnostic snapshots pass. Full Linux
validation records 3992 passing plain tests and 3979 passing sanitized
tests; all 4 plain and 17 sanitizer failures reproduce on the unchanged
baseline. Windows LLVM executable linking retains the existing _fltused
failure, also reproduced with an existing non-stdin test.

Refs vercel-labs#311
@vercel

vercel Bot commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

@euxaristia is attempting to deploy a commit to the Vercel Labs Team on Vercel.

A member of the Team first needs to authorize it.

Comment thread packages/runtime/src/scr_child.c
Input streams do not register data listeners, so incrementing
scr_child_streams_watching pinned scr_children_wait into perpetual decline
and prevented event loop sleep. Revert scr_child_stream_watching and spawn
creation to exclude input streams from the watching counter, inspect
unwritten buffer, ending, and error states directly in pending checks, and
add regression corpus test 2865.

Refs vercel-labs#314
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant