Skip to content

feat(pty-effect): honor PTY_SERVER_MODULE_PATH env override#642

Closed
schickling-assistant wants to merge 1 commit intomainfrom
schickling-assistant/2026-05-06-pty-effect-server-module-env
Closed

feat(pty-effect): honor PTY_SERVER_MODULE_PATH env override#642
schickling-assistant wants to merge 1 commit intomainfrom
schickling-assistant/2026-05-06-pty-effect-server-module-env

Conversation

@schickling-assistant
Copy link
Copy Markdown
Collaborator

Summary

`spawnDaemonViaNode` in `@overeng/pty-effect` resolves `@myobie/pty/server` via `require.resolve()` to find the script the daemon child runs. Inside a `bun build --compile` single-file binary, that returns a `bunfs:` path the spawned `node` child can't read, and the spawn fails with:

```
Cannot find module '@myobie/pty/server' from '/$bunfs/root/'
```

Add a `PTY_SERVER_MODULE_PATH` env override that `resolvePtyServerModulePath` honors first, before falling back to `require.resolve`. Consumers that ship a bun-bundled binary (forge does) can wrap it with a small shell that exports the env to a real on-disk copy of `node_modules/@myobie/pty/dist/server.js`. No public API changes; existing consumers behave identically when the env isn't set.

Verification

Verified end-to-end on dev3: forge built as a bun single-file binary, wrapped to set the env, was previously failing every `workspace.create` RPC at `spawnDaemonViaNode` and now spawns the daemon successfully.

Stack

Downstream consumer (forge wrapper): https://github.com/schickling/dotfiles/pull/836

🤖 Generated with Claude Code

Posted on behalf of @schickling
field value
agent_name 🌸 cl2-glade
agent_session_id 246b956a-0258-4209-8265-143eb77329b1
agent_tool Claude Code
agent_tool_version 2.1.121
agent_runtime Claude Code 2.1.121
agent_model claude-opus-4-7
worktree effect-utils/main
machine dev3
tooling_profile dotfiles@unknown-dirty

`spawnDaemonViaNode` resolves `@myobie/pty/server` via `require.resolve`
to find the script the daemon child runs. Inside a `bun build --compile`
single-file binary that returns a `bunfs:` path the spawned `node` child
can't read — it crashes with `Cannot find module '@myobie/pty/server'
from '/\$bunfs/root/<bin>'`.

Honor `PTY_SERVER_MODULE_PATH` first so consumers that need to point at
a real on-disk copy (forge wraps its bun bundle and exports the env to
the resolved path) can do so without changes to @overeng/pty-effect's
public API. Falls back to the existing require.resolve when the env
isn't set, preserving today's behavior for everyone else.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 6, 2026

Storybook Previews

Package Latest URL Last Deploy (Europe/Berlin)
megarepo https://megarepo-pr-642--overeng-utils.netlify.app 2026-05-06 11:32 CEST
notion-react https://notion-react-pr-642--overeng-utils.netlify.app 2026-05-06 11:32 CEST
tui-react https://tui-react-pr-642--overeng-utils.netlify.app 2026-05-06 11:32 CEST
tui-stories https://tui-stories-pr-642--overeng-utils.netlify.app 2026-05-06 11:32 CEST
genie https://genie-pr-642--overeng-utils.netlify.app 2026-05-06 11:32 CEST
notion-cli https://notion-cli-pr-642--overeng-utils.netlify.app 2026-05-06 11:32 CEST
react-inspector https://react-inspector-pr-642--overeng-utils.netlify.app 2026-05-06 11:32 CEST
effect-schema-form-aria https://effect-schema-form-aria-pr-642--overeng-utils.netlify.app 2026-05-06 11:32 CEST
effect-react https://effect-react-pr-642--overeng-utils.netlify.app 2026-05-06 11:32 CEST
Per-Commit Deploy History

Commit 4868803 · 2026-05-06 11:33 CEST

Package URL
megarepo https://69fb0aa054b7e0050c4068c3--overeng-utils.netlify.app
Alias: https://megarepo-pr-642--overeng-utils.netlify.app
notion-react https://69fb0aa602417d00dd205fb7--overeng-utils.netlify.app
Alias: https://notion-react-pr-642--overeng-utils.netlify.app
tui-react https://69fb0aae3deb520a831a5171--overeng-utils.netlify.app
Alias: https://tui-react-pr-642--overeng-utils.netlify.app
tui-stories https://69fb0aaf286ba006c654b46b--overeng-utils.netlify.app
Alias: https://tui-stories-pr-642--overeng-utils.netlify.app
genie https://69fb0ab67f217900caf70d67--overeng-utils.netlify.app
Alias: https://genie-pr-642--overeng-utils.netlify.app
notion-cli https://69fb0abd49253c063ce50920--overeng-utils.netlify.app
Alias: https://notion-cli-pr-642--overeng-utils.netlify.app
react-inspector https://69fb0abe1f72df072e022321--overeng-utils.netlify.app
Alias: https://react-inspector-pr-642--overeng-utils.netlify.app
effect-schema-form-aria https://69fb0ac35e2ee00c913b88cc--overeng-utils.netlify.app
Alias: https://effect-schema-form-aria-pr-642--overeng-utils.netlify.app
effect-react https://69fb0ac3ee8bef00cb8d2e2e--overeng-utils.netlify.app
Alias: https://effect-react-pr-642--overeng-utils.netlify.app

@schickling schickling closed this May 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants