anthropics / anthropics/claude-code

Stop/interrupt kills in-flight background agents — should interrupt the turn, not the workers

Open
#88,942 0 comments 0 reactions 0 assignees View on GitHub
area:agents duplicate
Dominant language
Python
Stars
145k
Forks
23.1k
PR merge metrics
PR metrics pending

Description

## Problem

Pressing stop/interrupt during a turn cascades the kill to background subagents spawned via the Agent tool (run_in_background: true). In a long-running orchestration session (multi-agent engine-porting project), the user pressed stop intending only to interject — to stop the assistant's current output — and the harness killed a background fixer agent that was mid-iteration on a build-and-verify loop, discarding its in-context state.

The user's mental model: **stop = interrupt the conversation turn; background workers keep working.** The actual behavior: stop = kill the turn *and* its spawned background tasks. The user compared this unfavorably to other tools' handling of long-running work.

## Why it matters

Sessions that orchestrate background agents treat them as durable workers, not disposable turn-scoped calls. When stop kills them:
- work in the agent's context (not yet committed/written) is lost;
- the operator becomes afraid to interject, which defeats the point of interactive steering;
- there is no way to say "pause output, let the workers finish."

We now defensively require every agent to checkpoint to disk every ~25 tool uses purely because a user interjection can kill it — that's workaround, not design.

## Suggested behavior (any of)
1. Stop interrupts the assistant's turn only; background tasks keep running (with a visible way to stop them individually — they already appear as tasks).
2. If a stop would kill running background tasks, prompt: "3 background agents are running — stop them too? [interrupt only / stop everything]".
3. A distinct 'pause' affordance that quiesces background agents (signal them to checkpoint and stand down) instead of SIGKILL semantics.

## Environment
Claude Code desktop app, macOS (Darwin 25.5.0), long-running session with Workflow + Agent background tasks.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by tracing the desktop app's stop/interrupt handling and the Agent tool's run_in_background task lifecycle. Done means interrupting the current turn no longer kills background agents, or presents an explicit choice to stop them, with a visible way to stop individual tasks.

Written by the indexing model from the issue text.

Assessment

Tech stack
macos
Domain
desktop, devtools
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.