refactor(pty-effect): delegate spawnDaemon to @myobie/pty#643
Merged
schickling-assistant merged 1 commit intomainfrom May 8, 2026
Merged
Conversation
`@overeng/pty-effect/client`'s `spawnDaemon` previously reimplemented the daemon spawn pipeline (server module resolution, child process launch, socket wait, early-exit detection) to work around the lack of a Bun-on-Node escape hatch in upstream `@myobie/pty.spawnDaemon`. Upstream now ships a `launcher` option that covers exactly that case, so the in-house path is obsolete. Replace it with a thin wrapper that calls upstream `spawnDaemon` and sets `launcher` to `NODE_BIN ?? "node"` when running under Bun. Public API and `PtyDaemonSpec` schema unchanged. Consumers automatically inherit upstream improvements such as bundle-safe spawn (myobie/pty#38) without any local workaround. 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.
Problem
@overeng/pty-effect/client'sspawnDaemonreimplements the entire daemon spawn pipeline (server module resolution viarequire.resolve('@myobie/pty/server'), detached child launch withnode:child_process, socket wait, early-exit detection, cleanup-on-timeout) to work around the lack of a Bun-on-Node escape hatch in upstream@myobie/pty.spawnDaemon.The in-house copy then drifts from upstream and locks consumers out of upstream improvements — most importantly, the bundle-safe spawn work in myobie/pty#38 (embedded server source fallback for bundled callers) only kicks in when consumers actually call upstream
spawnDaemon.Change
Replace the in-house
spawnDaemonViaNode/spawnDaemonCompatpair with a thin wrapper that calls upstream@myobie/pty.spawnDaemondirectly. The Bun-on-Node case is now handled by upstream'slauncheroption (added in 0.9.0), set toNODE_BIN ?? "node"when running under Bun.PtyClientservice shape,PtyDaemonSpecschema, andPtyErrorreasons are identical.PtyDaemonSpec.env) still goes throughwithEnvOverrides— that one predates upstream'sextraEnvand operates without requiringisolateEnv, so it stays as the wrapper-side mechanism.node:child_process,node:module/createRequire, andupstreamWaitForSocketimports.spawn(...)arguments rewritten to assert the args passed to upstreamspawnDaemon(includinglauncher).Field mapping (
PtyDaemonSpec→SpawnDaemonOptions)All upstream-supported fields map 1:1 in
buildSpawnOpts. NoPtyDaemonSpecfield is dropped:name,command,args,displayCommand,cwd,ephemeral,tags→ upstream equivalentssize.rows/size.cols→rows/colsenv→ wrapper-sidewithEnvOverrides(mutatesprocess.envaround the call, restores after)launcher: { command: NODE_BIN ?? "node" }is set whenprocess.versions.bun !== undefinedUpstream
SpawnDaemonOptionsexposesdisplayName,isolateEnv,extraEnv, andlauncher. None are surfaced throughPtyDaemonSpectoday; this PR doesn't add them. The wrapper-sideenvmechanism is preserved so behavior for the existingenvfield is byte-identical.Test results
pnpm exec vitest run(pty-effect package): all 28 tests pass, including the 4 unit tests for the spawn wrapper.pnpm exec tsc --noEmit -p tsconfig.json: clean.oxlint: clean.Related
Posted on behalf of @schickling
agent_nameagent_session_idagent_toolagent_tool_versionagent_runtimeagent_modelworktreemachinetooling_profile