Repository navigation
fix(core): settle shell spawn failures - #41301
Closed
kitlangton wants to merge 3 commits into
Closed
kitlangton wants to merge 3 commits into
kitlangton wants to merge 3 commits into
Conversation
kitlangton
enabled auto-merge (squash)
August 8, 2026 17:15
kitlangton
disabled auto-merge
August 8, 2026 17:15
kitlangton
enabled auto-merge (squash)
August 8, 2026 17:20
Contributor
|
Automated PR Cleanup Thank you for contributing to opencode. Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions. This PR was closed because it matched the following cleanup criteria:
PRs created within the last month are not affected by this cleanup. If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate. Thanks again for taking the time to contribute. |
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.
What
Prevent shell commands that fail synchronously during process creation from leaving the shell tool and its session busy forever.
Before / After
Before: A command containing an invalid process argument, such as an embedded NUL byte, makes
cross-spawnthrow synchronously. The detached shell setup fiber dies before completing its readiness deferred, soShell.createwaits forever and the tool remainsrunning.After: Synchronous process-creation throws enter the adapter's existing
PlatformErrorchannel. The shell service maps that spawn failure to the existingAppProcessErrorand fails its readiness deferred, allowing the shell tool to settle with an error and the session to continue.How
packages/util/src/cross-spawn-spawner.tswraps synchronouscross-spawninvocation failures asPlatformError.packages/core/src/shell.tsmaps only process-spawn failures toAppProcessErrorbefore registering shell state, then fails the readiness deferred with that error.packages/core/test/tool-shell.test.tsreproduces the original NUL-byte trigger through the real shell tool and verifies that it settles with an error.Scope
This only addresses failures before a shell process is successfully created. It does not change timeout, process-tree termination, or background-shell behavior.
Testing
bun run typecheckbun run test test/tool-shell.test.tsfrompackages/core(20 passed)bun run testfrompackages/util(4 passed)bun run testfrompackages/core(1600 passed, 16 skipped, 2 unrelated failures: recorded HTTP transport timeout and user-plugin config pollution)bun run lint(existing repository-wide lint failure inpackages/session-ui/src/v2/components/prompt-input/index.tsx)bun run lint:effect-patterns(existing repository diagnostics outside this change)