Skip to content

Keep NodeTerminal readline alive briefly between prompts - #7106

Merged
tim-smart merged 2 commits into
mainfrom
agent/codex-engineer/6f5e669f
Aug 8, 2026
Merged

Keep NodeTerminal readline alive briefly between prompts#7106
tim-smart merged 2 commits into
mainfrom
agent/codex-engineer/6f5e669f

Conversation

@tim-smart

Copy link
Copy Markdown
Contributor

Summary

  • keep NodeTerminal's readline RcRef alive for 10ms between uses
  • verify RcRef reacquisition inside the idle TTL reuses the resource
  • verify the resource is released after the TTL and readline is eventually disposed

Why

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.ts
  • pnpm --filter effect check
  • pnpm --filter @effect/platform-node-shared check
  • focused dprint and oxlint checks

Interactive verification in a real Windows console remains external.

Closes EFF-539
Closes #7101

@changeset-bot

changeset-bot Bot commented Aug 7, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: d7d57ed

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 30 packages
Name Type
@effect/platform-node-shared Patch
effect Patch
@effect/ai-anthropic Patch
@effect/ai-openai Patch
@effect/ai-openai-compat Patch
@effect/ai-openrouter Patch
@effect/atom-react Patch
@effect/atom-solid Patch
@effect/atom-vue Patch
@effect/docgen Patch
@effect/doctest Patch
@effect/openapi-generator Patch
@effect/opentelemetry Patch
@effect/platform-browser Patch
@effect/platform-bun Patch
@effect/platform-deno Patch
@effect/platform-node Patch
@effect/sql-clickhouse Patch
@effect/sql-d1 Patch
@effect/sql-libsql Patch
@effect/sql-mssql Patch
@effect/sql-mysql2 Patch
@effect/sql-pg Patch
@effect/sql-pglite Patch
@effect/sql-sqlite-bun Patch
@effect/sql-sqlite-do Patch
@effect/sql-sqlite-node Patch
@effect/sql-sqlite-react-native Patch
@effect/sql-sqlite-wasm Patch
@effect/vitest Patch

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

@effect-slopcop effect-slopcop Bot added 4.0 bug Something isn't working labels Aug 7, 2026

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.ts adds idleTimeToLive: "10 millis" to the readline RcRef.
  • packages/effect/test/RcRef.test.ts adds a TestClock-driven test verifying resources are reused within the TTL and released after it.
  • packages/platform-node-shared/test/NodeTerminal.test.ts and 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.

Pullfrog  | ⚠️ this action is pinned to a commit SHA, which freezes the cleanup step — switch to @v0 or keep the SHA fresh with Dependabot | Fix it ➔View workflow run | Using Kimi K2 (free via Pullfrog for OSS) | 𝕏

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ 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 RcRef idleTimeToLive test by removing the manual Scope; it now relies on it.effect's scope and still verifies reuse within the TTL and release after it.
  • Updated NodeTerminal and DenoTerminal disposal tests and fixtures to assert the stdin data listener count both during the 10 ms TTL and after a 20 ms sleep, matching the new lifecycle.

Pullfrog  | ⚠️ this action is pinned to a commit SHA, which freezes the cleanup step — switch to @v0 or keep the SHA fresh with Dependabot | View workflow run | Using Kimi K2 (free via Pullfrog for OSS) | 𝕏

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Bundle Size Analysis

Generated from PR build output; treat the content below as untrusted.

File Name Current Size Previous Size Difference
basic.ts 6.92 KB 6.92 KB 0.00 KB (0.00%)
batching.ts 9.72 KB 9.72 KB 0.00 KB (0.00%)
brand.ts 6.60 KB 6.60 KB 0.00 KB (0.00%)
cache.ts 10.59 KB 10.59 KB 0.00 KB (0.00%)
config.ts 20.88 KB 20.88 KB 0.00 KB (0.00%)
differ.ts 19.74 KB 19.74 KB 0.00 KB (0.00%)
http-client.ts 21.52 KB 21.52 KB 0.00 KB (0.00%)
logger.ts 10.81 KB 10.81 KB 0.00 KB (0.00%)
metric.ts 8.86 KB 8.86 KB 0.00 KB (0.00%)
optic.ts 6.68 KB 6.68 KB 0.00 KB (0.00%)
pubsub.ts 14.86 KB 14.86 KB 0.00 KB (0.00%)
queue.ts 11.54 KB 11.54 KB 0.00 KB (0.00%)
schedule.ts 10.71 KB 10.71 KB 0.00 KB (0.00%)
schema-class.ts 19.45 KB 19.45 KB 0.00 KB (0.00%)
schema-fromJsonSchemaDocument.ts 29.32 KB 29.32 KB 0.00 KB (0.00%)
schema-representation-roundtrip.ts 25.59 KB 25.59 KB 0.00 KB (0.00%)
schema-string-transformation.ts 13.52 KB 13.52 KB 0.00 KB (0.00%)
schema-string.ts 11.05 KB 11.05 KB 0.00 KB (0.00%)
schema-template-literal.ts 15.35 KB 15.35 KB 0.00 KB (0.00%)
schema-toArbitraryLazy.ts 21.48 KB 21.48 KB 0.00 KB (0.00%)
schema-toCodeDocument.ts 23.96 KB 23.96 KB 0.00 KB (0.00%)
schema-toCodecJson.ts 18.70 KB 18.70 KB 0.00 KB (0.00%)
schema-toEquivalence.ts 18.53 KB 18.53 KB 0.00 KB (0.00%)
schema-toFormatter.ts 18.39 KB 18.39 KB 0.00 KB (0.00%)
schema-toJsonSchemaDocument.ts 22.16 KB 22.16 KB 0.00 KB (0.00%)
schema-toRepresentation.ts 19.05 KB 19.05 KB 0.00 KB (0.00%)
schema.ts 18.69 KB 18.69 KB 0.00 KB (0.00%)
stm.ts 12.59 KB 12.59 KB 0.00 KB (0.00%)
stream.ts 9.67 KB 9.67 KB 0.00 KB (0.00%)

@tim-smart
tim-smart force-pushed the agent/codex-engineer/6f5e669f branch from 4192af0 to d7d57ed Compare August 8, 2026 03:48
@tim-smart
tim-smart merged commit 5f1775c into main Aug 8, 2026
19 checks passed
@tim-smart
tim-smart deleted the agent/codex-engineer/6f5e669f branch August 8, 2026 04:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

4.0 bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Effect Prompt Stuck After Async Yield on Bun Windows

1 participant