Repository navigation
feat(threads): Stop can keep delegated subagents running - #237
Merged
Merged
Conversation
Stop on a turn with delegated subagents still working asks whether to stop the turn only or everything. A turn-only Stop holds the queue but leaves the subagents running, keeps their completion wakes and pull request watches, and the existing Waiting strip keeps showing them. Mobile gets the same choice and a tappable background pill to stop leftover work. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hitting Stop on a thread whose turn had started delegated subagents stopped everything: the turn, every subagent, their completion wakes and the pull request watches. There was no way to stop just the turn and let the workers finish.
Stop on a running turn with delegated subagents still working now asks first:
After a turn-only stop, the existing "Waiting on" strip lists the subagents still working, with View and Stop. The subagent row still shows Running and the sidebar shows Waiting:
With no subagents running, Stop works as before with no prompt. The Stop keybinding takes the same path.
How
run.interruptgets akeepBackgroundWorkoption. With it,dispatchRunInterruptholds the queue but skips thedelegated-tasks.stopeffect, keeps completion wakes and watches, and leaves other provider threads alone. The settle step after the provider interrupt no longer marks the kept delegated rows as interrupted, because their child threads report them. That also fixest3_thread_interrupt, which never stopped delegated tasks but still marked their rows interrupted.runningDelegatedTaskshelper decides when to ask, on both web and mobile.Limitation: only T3's delegated subagents (
delegate_task) and pull request watches survive. Work a provider runs in its own process, such as Claude's background shells and agents, still ends with the turn, because the Claude adapter closes the CLI process on interrupt.Testing
ThreadStop.test.ts, and a test forrunningDelegatedTasks. The existingThreadStopandBackgroundWorkStop.integrationsuites pass.Done by Claude Opus 5.5 in Claude Code (via T3 Code).
🤖 Generated with Claude Code