Feature request: user interjections should not kill in-flight subagents / background tasks

Open 💬 2 comments Opened Jul 6, 2026 by kumouri

Summary

When a user interrupts the main agent mid-turn with additional context or corrections (not a cancel), all running subagents and background tasks are aborted without warning, losing partial progress and wasting tokens. This creates friction: users must choose between withholding helpful mid-task context and re-running expensive async operations.

Current behavior

  1. Main agent launches 3+ research subagents via the Agent tool (reports "Async agent launched successfully").
  2. Subagents begin long-running tasks (web research, file processing, etc.).
  3. While the main agent is still reasoning or awaiting results, user sends an interjection—e.g., granting permission to read a directory, correcting a misunderstanding, or adding context.
  4. The interjection aborts the main agent's turn, terminating all child tasks immediately.
  5. Subagents' output files are left empty (0 bytes), no partial results preserved, no completion notice. User must re-dispatch.

Nuance: Interjections sent during agent idle time (between turns) do not kill background tasks; failure occurs only when children are in-flight and parent turn is incomplete. Explicit run_in_background: true appears to detach earlier and may mitigate, but the default async path does not survive.

Expected behavior

  • An interjection should suspend the main agent's reasoning loop (necessary—user's new input must be seen before the next action), but already-dispatched subagents should continue running and deliver results normally.
  • Alternatively: offer a choice—e.g., interjection semantics of "queue for next turn without aborting children" vs. hard cancel (Esc-Esc retains current kill-all behavior).
  • If children must be killed: persist partial output and surface a clear notice ("N subagents were terminated") so the orchestrator knows to relaunch rather than silently waiting.

Why it matters

  • Token waste: Subagents halfway through long-running research spend tokens on setup, context-loading, and partial work, then discarded.
  • Time penalty: Re-launching from scratch re-incurs API latency and spinning-up cost; useful multi-minute tasks become blocked on user's impulse to clarify mid-flight.
  • Poor incentives: Users learn to withhold corrections and context until the turn explicitly ends, reducing real-time collaboration and forcing artificial synchronization.
  • Silent failure: No indication that children were killed; orchestrators can't distinguish "task crashed" from "was aborted," leading to confusion and duplicate dispatches.

Proposed solution

Option A (preferred): Interjections interrupt the main agent's reasoning but not child lifecycle. Queue the user's message for the next turn after in-flight children complete, or merge it into the agent's context immediately without killing children. Preserve the hard-cancel (Esc-Esc) as an explicit override.

Option B: Expose interjection semantics to the user—e.g., "queue for next turn" vs. "cancel all and interrupt now." Esc-Esc / UI affordance for immediate cancel, default to queuing.

Option C: On any child termination, persist partial output and emit a visible notice ("N subagents killed by interruption; partial output at [path]") so recovery is explicit and auditable.

Recommend A + C: queue by default, kill-all on demand, always notify if children die.

Environment: Claude Code desktop app on Windows 10, model claude-fable-5.

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗