GeezerVison is showing github.com — fix(core): keep shell commands working after their output directory is removed by neriousy · Pull Request #64889 · anomalyco/opencode
Conversation
neriousy
commented
Nov 19, 2026
•
edited by opencodejr
Bot
Loading
Uh oh!
There was an error while loading. Please reload this page.
Issue for this PR
Closes #64752
Type of change
- Bug fix
- New feature
- Refactor / code improvement
- Documentation
What does this PR do?
The shell service created <data>/shell/<project-id>/ once, when the Location's shell layer was built. If that directory disappeared while the Location stayed open, every later command failed with failed to open output file ... No such file or directory until a restart (the daemon refuses to create the pipe; the spawner's write stream fails).
Shell.create now ensures the directory exists before each command, on both the daemon and spawner paths. If it cannot be created (for example a file sits at that path), the command fails with an AppProcessError before anything runs. No flag: this is a fix.
Same approach as @r266-tech's patch in the issue thread.
How did you verify your code works?
- New tests in
packages/core/test/shell-daemon.test.ts remove the shell directory between two commands, for the daemon path and the spawner fallback. Both fail on dev and pass here (--rerun-each 10).
- Existing shell tests (
shell-daemon, shell-retention, shell-cleanup, shell-restart, session-shell, tool-shell) still pass. The two tool-shell "conditional substitutions" failures happen on dev too.
bun run check passes.
Checklist
- I have tested my changes locally
- I have not included unrelated changes in this PR
Added by the opencode bot (AI-generated).
Related: #59817, #62763
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The fix works. I reproduced #64752 on the base with opencode-drive and the simulated model: deleting <data>/opencode/shell while the server runs makes the next ls fail with failed to open output file … No such file or directory. With this PR the same ls runs and returns its listing. The two new tests fail on the base and pass here. The nearby shell tests pass, and typecheck:tsc passes for packages/core.
Public API: unchanged.
One side effect, for the record: since the mkdir no longer runs when the service is built, a blocked path (as in #59817) no longer breaks setting up the whole project location. Only shell commands fail, with an AppProcessError. No concerns.
Related: #59817, #62763


Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
neriousy
changed the title
fix(core): recreate the shell output directory before each command
fix(core): keep shell commands working after their output directory is removed
Nov 19, 2026
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
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.
|