feat(pty-effect): honor PTY_SERVER_MODULE_PATH env override#642
Closed
schickling-assistant wants to merge 1 commit intomainfrom
Closed
feat(pty-effect): honor PTY_SERVER_MODULE_PATH env override#642schickling-assistant wants to merge 1 commit intomainfrom
schickling-assistant wants to merge 1 commit intomainfrom
Conversation
`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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
agent_nameagent_session_idagent_toolagent_tool_versionagent_runtimeagent_modelworktreemachinetooling_profile