Repository navigation
[2026.10.10-beta.5] fix(worker): keep fd 0 open when releasing file-backed stdin (#187516) - #187553
Conversation
* 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)
|
🦞👀 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. |
|
Codex review: needs maintainer review before merge. What this changesThis PR preserves file-backed stdin descriptor 0 during deployed-worker cleanup while continuing to release pipes, sockets, and terminals. Example: A relocated worker bundle runs under Node 26.12.1 with stdin connected to /dev/null.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep this maintainer-authored release backport open: the release base still contains the Node 26 worker crash, and main’s fix does not update that branch. No introduced correctness or security defect was found. Priority: P1 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherThe deployed-worker entry validates the runtime, runs or prewarms the worker, then releases inherited transports after execution settles. flowchart TD
A[Deployed worker entry] --> B[Runtime validation]
B --> C[Worker execution or prewarm]
C --> D[Stdin cleanup]
D --> E[Keep file descriptor open]
D --> F[Release pipe socket or terminal]
E --> G[Disconnect IPC]
F --> G
Technical reviewBest possible solution: Land the focused backport through the release branch’s existing gates, preserving descriptor 0 without changing worker lifetime ownership. Do we have a high-confidence way to reproduce the issue? The release base unconditionally destroys stdin, and the existing bundled-worker fixture supplies /dev/null before creating native workers; the author reports the matching exit-134 failure before the fix and passing runs afterward, but this review ran no target code. Is this the best way to solve the issue? The descriptor-type check addresses the reported cause while retaining Bun pipe cleanup and the existing settlement order; the mock-only helper table adds little confidence beyond the bundled-worker regression. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 2ce885030396. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +25, Tests +58. Total +83 across 5 files. Added test files: 1. View PR surface stats
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed October 29, 2026, 5:48 AM ET / 09:48 UTC. |
Problem
P1 for 2026.10.10-beta.5: on Linux and macOS Node 26.12.1,
test/scripts/worker-deploy-build-plugin.test.tsaborts (exit 134,uv__close: Assertion 'fd > STDERR_FILENO'). The worker deploy entry destroys a/dev/null-backed stdinReadStream. Node 26 now closes fd 0 on that destroy, and libuv reuses fd 0 for the next worker loop and aborts when it closes. Main had the same defect.Fix
Backport of main #187516 (
git cherry-pick -x a3dd92bd88c8):src/process/release-stdin.tskeeps fd 0 open for file and/dev/nullstdin and still releases pipe, socket and TTY stdin. It decides by fd type because Bun reports pipe stdin as a ReadStream. The deploy entry calls the helper.Conflict resolution: the release versions of
runtime-guard.test.tsandworker-deploy-entry.test.tshave a different case layout than main. I kept the release layout and applied only main's change: mock the helper (with its mock-isolation reason) and assert the helper call instead of spying on the runner's stdin.Evidence
worker-deploy-build-plugin.test.ts19/19 (release head before: 1 failed, exit 134).