anomalyco / anomalyco/opencode
New prompt waits for a running bash tool to finish before it is answered
@rekram1-node is already working on this.
Since Aug 11, 2026.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
What happened
When the assistant is mid-task and calls the built-in bash tool with a long-running command (e.g. sleep 30), submitting a new prompt is not handled until the command finishes. The new prompt appears to be ignored (the user message is saved, but no response arrives) until the running tool exits, then the prompt is answered.
Expected behavior
Submitting a new prompt while a run is active should take over: the running tool is interrupted/cancelled and the new prompt is processed promptly.
Steps to reproduce
- Ask the model to call bash and run
sleep 30in the foreground. - While the bash tool is running, submit a new prompt.
- Observe that the new prompt is not answered until the
sleep 30finishes.
Root cause
Runner.ensureRunning in packages/opencode/src/effect/runner.ts treats an active run as a single-flight/join point: a second ensureRunning call (the new prompt's loop) simply awaits the current run's completion and drops the new work. The new prompt is only eventually answered because the current run loop picks up the newly-saved user message after the tool finishes.
Related
- #40829 (session abort waits for a model-invoked bash tool) — related cancellation-path issue.
- #36375 (queue work when already running) — related but does not address waiting on a long-running tool.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.