Repository navigation
fix(worker): keep fd 0 open when releasing file-backed stdin - #187516
Merged
Merged
Conversation
Contributor
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
RomneyDa
added a commit
that referenced
this pull request
Oct 29, 2026
#187553) * fix(worker): keep fd 0 open when the deploy entry releases file-backed stdin * fix(worker): decide stdin release by fd type so Bun pipes are still released * test(worker): assert the stdin release helper instead of the runner's stdin * test(worker): explain stdin helper mock isolation (cherry picked from commit a3dd92b)
This was referenced Oct 29, 2026
github-actions Bot
pushed a commit
to Desicool/openclaw
that referenced
this pull request
Oct 30, 2026
…w#187516) * fix(worker): keep fd 0 open when the deploy entry releases file-backed stdin * fix(worker): decide stdin release by fd type so Bun pipes are still released * test(worker): assert the stdin release helper instead of the runner's stdin * test(worker): explain stdin helper mock isolation
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.
Problem
On Node 26,
test/scripts/worker-deploy-build-plugin.test.tsaborts with exit status 134:Assertion failed: (fd > STDERR_FILENO), function uv__close. It reproduces on Linux (node:26.12.1-bookworm) and macOS, on main and onrelease/2026.10.10. Node 24.22.1 passes.Root cause: the
finallyinsrc/worker/worker-deploy-entry.tscallsprocess.stdin.destroy(). When stdin is/dev/null(spawned with stdio"ignore") or a regular file,process.stdinis anfs.ReadStream. Node 26 changedlib/internal/fs/streams.jsclose fromif (!stream.fd)toif (stream.fd == null), so destroying it now closes fd 0. Node 24 skipped the close because0is falsy. libuv then hands fd 0 to the next worker thread's epoll/kqueue fd, anduv__loop_closeasserts when that worker exits.Fix
A new
src/process/release-stdin.tsreleaseProcessStdin()decides by the type of fd 0: it leaves a regular file or a non-TTY character device (/dev/null) open, and keeps releasing pipes, sockets, TTYs and an unreadable fd 0 exactly as before. The decision cannot use the stream class: Bun reports even pipe stdin as anfs.ReadStream(probed with Bun 1.4.2), and skipping that destroy would keep the pipe open. The deploy entry calls the helper.runtime-guard.test.tsnow asserts the helper call instead of spying on the runner's real stdin, so its result no longer depends on how CI spawned the runner (the first revision failed exactly there under the Bun shard).Accepted scope: the other
process.stdin.destroy()callers either receive pipe stdin or destroy only immediately before exit, so they do not hit this today. Moving them to the helper is a follow-up.Evidence
pnpm test test/scripts/worker-deploy-build-plugin.test.ts→ 2 failed / 19 passed, uv__close assertion.Needed as a backport for 2026.10.10-beta.5 (P1 Linux Node 26 relocated-SQLite abort).