anomalyco / anomalyco/opencode

New prompt waits for a running bash tool to finish before it is answered

Open
#41,753 2 comments 1 reaction 1 assignee View on GitHub

@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
  1. Ask the model to call bash and run sleep 30 in the foreground.
  2. While the bash tool is running, submit a new prompt.
  3. Observe that the new prompt is not answered until the sleep 30 finishes.
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.