Skip to content

[2026.10.10-beta.5] fix(worker): keep fd 0 open when releasing file-backed stdin (#187516) - #187553

Merged
RomneyDa merged 1 commit into
release/2026.10.10from
beta5/backport-187516
Oct 29, 2026
Merged

RomneyDa merged 1 commit into
release/2026.10.10from
beta5/backport-187516

Conversation

@RomneyDa

Copy link
Copy Markdown
Member

Problem

P1 for 2026.10.10-beta.5: on Linux and macOS Node 26.12.1, test/scripts/worker-deploy-build-plugin.test.ts aborts (exit 134, uv__close: Assertion 'fd > STDERR_FILENO'). The worker deploy entry destroys a /dev/null-backed stdin ReadStream. 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.ts keeps fd 0 open for file and /dev/null stdin 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.ts and worker-deploy-entry.test.ts have 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

  • Node 26.12.1: worker-deploy-build-plugin.test.ts 19/19 (release head before: 1 failed, exit 134).
  • Node 24.22.1, stdin on /dev/null: runtime-guard 81/81, worker-deploy-entry 6/6, release-stdin 5/5.

* 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)
@clawsweeper

clawsweeper Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 29, 2026
@clawsweeper

clawsweeper Bot commented Oct 29, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This 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.

  • Before: Cleanup closes fd 0, allowing a later native worker loop to reuse it and abort with the libuv fd assertion.
  • After: Cleanup leaves fd 0 open, preventing that reuse while preserving IPC disconnection.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) A focused, source-verified backport with reported production-boundary regression coverage, limited by harness-only evidence and a mock-only helper test.
Proof confidence 🦐 gold shrimp (3/6) This maintainer-authored backport is outside the ordinary contributor proof gate; its body reports before/after Node 26 bundled-worker regression runs and Node 24 focused tests, with no separate deployed-run artifact.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: A deployed worker using ignored or file-backed stdin can abort on supported Node 26 during subsequent native-worker cleanup.
Reason: The maintainer-authored backport restores worker reliability using the already merged main solution without adding configuration, dependencies, or persisted state.

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
Reviewed head: 8a7f70aa3dc71f7aa9600de18355479fb0824030

Before merge

None.

Findings

None.

Tests

  • Low-value test src/process/release-stdin.test.ts: Remove the mock-only helper table: it substitutes fd classification and asserts destroy call counts, so it cannot detect actual descriptor closure or the libuv abort.
  • Missing end-to-end proof: No standalone deployed-worker trace is supplied beyond the reported bundled-worker regression runs.
Agent review details

How this fits together

The 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
Loading

Technical review

Best 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

  • Deployed-worker cleanup keeps the original intent (98813c2: Replace forced exit with natural completion after owned work settles, releasing stdin and IPC even when startup fails.)
  • Entry and runtime-guard transport isolation keeps the original intent (98813c2: Tests isolate the runner’s real transports while checking worker cleanup; mocking the new release helper preserves that isolation.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Dallin Romney: Raw commit c1005a2 adds src/worker/worker-deploy-entry.ts:17 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: c1005a2ee593; files: src/worker/worker-deploy-entry.ts)

PR surface

Source +25, Tests +58. Total +83 across 5 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 2 26 1 +25
Tests 3 69 11 +58
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 5 95 12 +83

Root-cause cluster

Relationship: same_root_cause
Canonical: #187516
Summary: This is the release-branch backport of the merged main fix, with matching production code and release-specific test adjustments.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Labels

Label changes:

  • add P1: The release branch retains a reported process abort on supported Node 26.12.1 when the deployed worker releases ignored stdin.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P1: The release branch retains a reported process abort on supported Node 26.12.1 when the deployed worker releases ignored stdin.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed October 29, 2026, 5:48 AM ET / 09:48 UTC.

@RomneyDa
RomneyDa merged commit bbd34a9 into release/2026.10.10 Oct 29, 2026
123 checks passed
@RomneyDa
RomneyDa deleted the beta5/backport-187516 branch October 29, 2026 09:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant