Keep NodeTerminal readline alive briefly between prompts - #7106
Conversation
🦋 Changeset detectedLatest commit: d7d57ed The changes in this PR will be included in the next version bump. This PR includes changesets to release 30 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 |
There was a problem hiding this comment.
Important
Add a changeset for the @effect/platform-node-shared runtime behavior change before merging.
Reviewed changes
This PR keeps NodeTerminal's readline RcRef alive for 10 ms after its last use to avoid bouncing TTY raw mode between adjacent prompts.
packages/platform-node-shared/src/NodeTerminal.tsaddsidleTimeToLive: "10 millis"to the readlineRcRef.packages/effect/test/RcRef.test.tsadds aTestClock-driven test verifying resources are reused within the TTL and released after it.packages/platform-node-shared/test/NodeTerminal.test.tsand its fixture update the disposal test to wait out the TTL.
⚠️ Add a changeset for @effect/platform-node-shared
The NodeTerminal change is a user-facing runtime behavior change; per repo convention it needs a patch changeset. The RcRef test-only change does not need one.
Technical details
# Missing changeset
## Affected sites
- `packages/platform-node-shared/src/NodeTerminal.ts:86` — new `idleTimeToLive` option changes readline/TTY lifecycle
## Required outcome
- Add `.changeset/*.md` with `@effect/platform-node-shared: patch` describing the 10 ms readline idle TTL and the Windows/Bun bug it mitigates.@v0 or keep the SHA fresh with Dependabot | Fix it ➔ | View workflow run | Using Kimi K2 (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
This incremental review covers the commits since the prior pullfrog review at 5e1c4e1.
- Added the missing changeset for
@effect/platform-node-shared, describing the 10 ms readline idle TTL and the Windows/Bun TTY raw-mode hang it mitigates. - Simplified the
RcRefidleTimeToLivetest by removing the manualScope; it now relies onit.effect's scope and still verifies reuse within the TTL and release after it. - Updated
NodeTerminalandDenoTerminaldisposal tests and fixtures to assert the stdindatalistener count both during the 10 ms TTL and after a 20 ms sleep, matching the new lifecycle.
@v0 or keep the SHA fresh with Dependabot | View workflow run | Using Kimi K2 (free via Pullfrog for OSS) | 𝕏
Bundle Size AnalysisGenerated from PR build output; treat the content below as untrusted.
|
4192af0 to
d7d57ed
Compare

Summary
NodeTerminal's readlineRcRefalive for 10ms between usesRcRefreacquisition inside the idle TTL reuses the resourceWhy
On Windows, immediately releasing and reacquiring the terminal resource can bounce TTY raw mode and trigger the libuv cancellation-state bug observed with Bun. A short idle TTL lets adjacent prompts reuse the same readline resource while preserving eventual cleanup.
Validation
pnpm test --run packages/effect/test/RcRef.test.ts packages/platform-node-shared/test/NodeTerminal.test.tspnpm --filter effect checkpnpm --filter @effect/platform-node-shared checkInteractive verification in a real Windows console remains external.
Closes EFF-539
Closes #7101