GeezerVison is showing github.com — ACP: auto-resumed parent turn after a background subagent has no start or end marker · Issue #63855 · anomalyco/opencode
ACP: auto-resumed parent turn after a background subagent has no start or end marker #63855DescriptionSummary
Follow-up to #55760. On v2.3.0 the parent's auto-resumed turn after a background subagent completes now reaches ACP clients (thanks), but nothing tells the client when that turn ends, or that it started. A client that tracks turn state has to show the session as busy until the next prompt it sends itself settles.
What the wire shows (v2.3.0, Linux x64, mock provider)
- Parent prompt starts a
subagent (background). session/prompt returns end_turn (~1695 ms).
- With
clientCapabilities._meta["opencode/child-session-updates"]: true, the client receives opencode/session/child_update for the child (created, running, its reply, completed at ~1707 ms).
- The parent auto-resumes server-side and its reply arrives as a root
session/update agent_message_chunk (messageId: "message-5", ~1766 ms).
- Then nothing for the remaining 60 s: no
usage_update, no session_info_update, no extension notification. Same without the capability (the chunk arrives at ~1948 ms, message-4).
Where it comes from (a6b15d3)
packages/cli/src/acp/turn.ts: after the prompt answers, handoff starts the background follower (followChildren), which forwards only what translate.ts produces.
packages/cli/src/acp/translate.ts rootEvent returns outputs: [] for session.execution.succeeded, interrupted and failed, so the resumed turn's end never reaches ACP; its start produces no output either.
sendUsageUpdate runs only when a prompt settles.
Request
Emit an explicit start and end for turns the server runs without a client prompt, for example a session_info_update (or an opencode/... extension notification) carrying the execution outcome (succeeded / interrupted / failed) and, if possible, the usage for that turn. Gating it behind a client capability, like opencode/child-session-updates, would be fine.
Why it matters
ACP has no StopReason for turns the client did not start, so without a marker clients either leave the session "running" indefinitely or guess with a timeout. We maintain an ACP client library (botiverse/oar) that maps OpenCode's background subagents through child_update and documents this as a known gap; the recorded frames and a reproduction script are in https://github.com/botiverse/oar/tree/main/experiments/opencode-child-background . Activityopencodejr commented on Nov 13, 2026 Thanks for the detailed follow-up and the recorded frames.
As I understand it, you're asking the ACP adapter to send an explicit start and end for turns the server runs without a client prompt. A typical case is the parent turn that auto-resumes after a background subagent reports. The end would carry the execution outcome (succeeded / interrupted / failed) and, ideally, the turn's usage, and it could be gated behind a client capability.
I checked this against the current code and it matches what you describe:
- In
packages/cli/src/acp/translate.ts, rootEvent returns no outputs for the parent's session.execution.succeeded / interrupted / failed events.
- In
turn.ts, sendUsageUpdate is only called when a prompt the client sent settles.
The resumed turn's content now arrives, as the fix for #55760 (#63395) intended. Nothing marks the turn's boundaries, though, and ACP has no stop reason for a turn the client didn't start. So I'm treating this as a feature request for a new notification rather than a bug. Maintainers will consider it.
Related issues:
ammarg-cloud commented on Nov 25, 2026 Additional data point on v2.4.1: beyond the missing start/end markers on an auto-resumed parent turn, chaining a second wave of background subagents from inside an auto-resumed turn drops the subsequent parent turn from ACP completely.
Observed trace (opencode acp, v2.4.1):
- Client sends
session/prompt; parent spawns 2 background subagents and returns stopReason: "end_turn".
- Subagents finish → first auto-resumed parent turn does stream over ACP, and spawns 2 more background subagents.
- Second wave of subagents finishes ~17s later; the parent auto-resumes, completes edits, and writes the final reply to
opencode.db (visible via session/load and session/list updatedAt), but nothing is sent over ACP (0 unread bytes on stdout).
Looking at the ACP background loop, once session.execution.succeeded hits w.terminal && !hasOpenBackground(state) (or resets started = false with start: undefined), the background event subscription appears to tear down or stop forwarding before a chained second auto-resume completes. An explicit start/end boundary for server-initiated turns (plus keeping the subscription alive across chained background waves) would close both gaps.
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|