Skip to content

OpenCode 2: a queue-delivered prompt detaches a foreground wait:true call the moment it is enqueued #563

Closed

Description

@iceteaSA

Summary

On OpenCode 2, a prompt delivered with delivery: "queue" detaches a foreground wait: true shell call (and a sync bash_watch) the moment it is enqueued, exactly like delivery: "steer". A queued message is not shown to the agent until the current turn ends. So the detach hands control back for a message the agent cannot read yet, and the wait the caller asked for is lost.

Repro (aft-opencode 0.60.0 on OpenCode 2.0.31)

shell({command: "sleep 60", wait: true}). Then, from a plugin, ctx.session.prompt({sessionID, delivery, text}) with text containing no &detach:

delivery prompt hook → tool completion result
queue 4 ms Detached because a user message arrived., metadata status: "running"
steer 4 ms same

Neither call waited for the command to exit.

Where (main, 5ee867d)

packages/opencode-plugin/src/v2-prompt-detach.ts: the prompt hook (interruptBashWaitsForV2Prompt, line 110) interrupts every waiting call for the session through interruptBashWaitsForChatMessage. V2PromptHookEvent (line 33) reads only sessionID, prompt and metadata, so the delivery mode never reaches the decision.

Expected

A queue delivery does not detach a foreground wait, since the agent cannot act on it until the turn ends. A steer delivery, or typed operator text, still detaches. If the hook event does not expose the mode, the hook could defer the detach until the message is actually admitted to the conversation.

The current workaround, bash.detach_on_user_message: false, also stops steer deliveries and operator messages from detaching, which is the case the detach exists for (#366).

Activity

  1. aft-alfonso commented on Oct 20, 2026

    @aft-alfonso

    Fixed in v0.61.0. On OpenCode 2, a queued message no longer detaches a running wait: true command or bash_watch. Steer messages and &detach still detach it. Thanks for the report, @iceteaSA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions