Repository navigation
Replies: 2 comments
|
Where this comes from in the code, and a proposed split (checked on nightly 20261007.2761):
Proposal:
That matches the Claude Code CLI and OpenCode's own behaviour, and keeps the fix for background work that couldn't be stopped. If this direction works for you, I'm happy to open a PR. Found and written with Claude Opus 5.5 in T3 Code (OpenCode 2 + cursor-opencode-provider). |
|
Following up now that #16852 was closed for size. This still reproduces on main (339179f): replaying the recorded Here's a much smaller fix, OpenCode 2 only: compare. About 100 source lines across 5 files, plus tests. Stop still ends the turn with its foreground tool calls and subagents, holds the queue, and stops delegated tasks and PR watches. Background subagents stay on the banner above the composer, and its Stop, or any Stop after the turn ended, still stops them. One known gap: if the turn finishes on its own between the Stop and the interrupt reaching OpenCode, background work is stopped as before. Would you take this as a PR? |
Uh oh!
There was an error while loading. Please reload this page.
With OpenCode 2 threads, pressing Stop while a turn is running also interrupts every background subagent the thread started. This is intended (
OpenCode2AdapterV2.interruptTurn→stopBackgroundwhenrequestRuntimeRestartis set, andProviderTurnControlService.interruptalways sets it). But Stop is also how you redirect an agent that's heading the wrong way, and then losing the background work isn't what you want.What happened to us (nightly 0.0.46-nightly.20261006.2735, OpenCode 2.0.24): the parent had three background subagents that had been working for about 80 minutes. The parent's turn started going down the wrong path, so the user pressed Stop and, 35 s later, sent a correction. The Stop interrupted all three child sessions 58–85 ms before the parent. OpenCode then queued three
<subagent … state="cancelled">Subagent cancelled</subagent>reports, which reached the parent together with the correction, and the parent model overlooked them. Two minutes later it told the user the three were "still running". Nothing in the UI warned that Stop would cancel them.Repro (deterministic, about 1 minute):
subagenttool,background: true) whose task runssleep 25four times, then counts lines. Right after launching it, the parent should runsleep 25three times in the foreground.interruptedwithin a few ms of the Stop, and the parent receivesSubagent cancelled.The same setup with the message sent mid-turn instead of pressing Stop keeps the child alive with every delivery: steer, auto, queue, and restart (
restart_activeinterrupts the parent's turn but doesn't passrequestRuntimeRestart, sostopBackgrounddoesn't run). In each case the child finished and reported its result.Ideas, from least to most change:
settleBackgroundWorkafter arun.interruptto skip the work the adapter left running.restart_active) next to queue and steer. It already redirects without touching background subagents, but web and mobile only offer queue and steer, and mobile sends "restart" as auto.Two smaller mobile points from the same incident:
showStopAction = !hasContent && canStopThread), so tapping it before the text is in stops everything.Model: Claude Opus 5.5 (1M). Harness: OpenCode 2 in T3 Code.
All reactions