Skip to content

Conversation

@petebacondarwin
Copy link
Contributor

@petebacondarwin petebacondarwin commented Jan 21, 2026

Devin PR requested by @petebacondarwin

Adds support for the native node:tty module from workerd when the enable_nodejs_tty_module and experimental compatibility flags are enabled. This follows the same pattern as other experimental modules (inspector, sqlite, dgram, stream_wrap, repl).

The native code appears in workerd as of https://github.com/cloudflare/workerd/blob/main/src/node/tty.ts. It is currently experimental with no default enable date.

Implementation Comparison

Export workerd unenv Breaking change?
isatty returns false returns false No (same)
ReadStream constructor throws ERR_METHOD_NOT_IMPLEMENTED creates stub object No (workerd is stricter)
WriteStream constructor throws ERR_METHOD_NOT_IMPLEMENTED creates stub object No (workerd is stricter)

Breaking change analysis: There are no breaking changes when moving from unenv to workerd. Both implementations return false for isatty(). For ReadStream/WriteStream constructors, the unenv stub creates stub objects while workerd throws ERR_METHOD_NOT_IMPLEMENTED. This is a stricter behavior in workerd but not a breaking change since code that worked with unenv stubs would need to handle the objects anyway.

Human Review Checklist

  • Verify the getTtyOverrides() function follows the same pattern as other experimental modules
  • Confirm the test correctly validates throw behavior only when native module is enabled

Link to Devin run


  • Tests
    • Tests included
    • Automated tests not possible - manual testing has been completed as follows:
    • Additional testing not necessary because:
  • Public documentation
    • Cloudflare docs PR(s):
    • Documentation not necessary because: internal experimental feature, follows existing patterns

@changeset-bot
Copy link

changeset-bot bot commented Jan 21, 2026

🦋 Changeset detected

Latest commit: be6cbec

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

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

@devin-ai-integration
Copy link
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR that start with 'DevinAI' or '@devin'.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@pkg-pr-new
Copy link

pkg-pr-new bot commented Jan 21, 2026

create-cloudflare

npm i https://pkg.pr.new/create-cloudflare@12023

@cloudflare/kv-asset-handler

npm i https://pkg.pr.new/@cloudflare/kv-asset-handler@12023

miniflare

npm i https://pkg.pr.new/miniflare@12023

@cloudflare/pages-shared

npm i https://pkg.pr.new/@cloudflare/pages-shared@12023

@cloudflare/unenv-preset

npm i https://pkg.pr.new/@cloudflare/unenv-preset@12023

@cloudflare/vite-plugin

npm i https://pkg.pr.new/@cloudflare/vite-plugin@12023

@cloudflare/vitest-pool-workers

npm i https://pkg.pr.new/@cloudflare/vitest-pool-workers@12023

@cloudflare/workers-editor-shared

npm i https://pkg.pr.new/@cloudflare/workers-editor-shared@12023

@cloudflare/workers-utils

npm i https://pkg.pr.new/@cloudflare/workers-utils@12023

wrangler

npm i https://pkg.pr.new/wrangler@12023

commit: be6cbec

devin-ai-integration bot and others added 2 commits January 21, 2026 13:58
Co-Authored-By: pbacondarwin@cloudflare.com <pete@bacondarwin.com>
…abled

Co-Authored-By: pbacondarwin@cloudflare.com <pete@bacondarwin.com>
@petebacondarwin petebacondarwin force-pushed the devin/1768991072-native-node-tty branch from a6ede63 to be6cbec Compare January 21, 2026 13:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Untriaged

Development

Successfully merging this pull request may close these issues.

1 participant