[Bug] Subagents killed by stall watchdog during active token generation

Status Open
Reported on v2.1.226
Maintainer reply None cached
Activity 0 comments · opened Aug 10, 2026

Bug Description

Текст для команды /bug в Claude Code

Отправлять командой /bug прямо в Claude Code — она сама приложит сведения о
сессии. Текст по-английски: его будут читать разработчики.

---

Subagents are killed by the stall watchdog while they are still productive —
the model stream appears to die mid-generation and never recovers.

## Symptom

Long-running subagents (Agent tool, general-purpose) are terminated with:

    Agent stalled: no progress for 600s (stream watchdog did not recover)

## Why this looks like a stream fault, not a stuck agent

The strongest evidence: the killed agent's partial result ended MID-SENTENCE.
One agent's entire returned result was the fragment:

    Now the tests in `menu.rs`:

That is a truncated assistant message, not an agent idling between steps. The
agent was generating text at the moment the stream stopped.

Confirmed by the filesystem: that agent's work was already complete and correct
on disk — the crate built and 101 tests passed. It was writing up its report
when it was cut. So the watchdog fired on a healthy, productive agent.

## Frequency

Two sessions on the same machine:

* Earlier session: 5 consecutive agents killed this way on one project. Two of
  them died immediately, before doing any work, with a warm build cache.
* Today: 2 of 5 agents killed. The 3 that finished ran 3, 14 and 34 minutes.
  The 2 that died were the longest-running code tasks.

So it is not universal, but it is frequent and it hits long tasks hardest.

## Possibly related: a transient classifier error just before the failures

Twice today, launching an Agent failed outright with:

    claude-sonnet-5[1m] is temporarily unavailable, so auto mode cannot
    determine the safety of Agent right now.

Both of the agents that were later killed by the watchdog were launched in the
same window of time as those errors. This may be coincidence, but if the safety
classifier and the agent stream share infrastructure, it is worth checking.

## Impact

The damage depends entirely on whether the agent had written to disk yet:

* Agent A had written its files -> nothing lost, the parent session committed
  the work manually.
* Agent B had written nothing -> the entire run was lost, the working tree was
  clean, ~10 minutes of work gone with no partial output to salvage.

## What would help

1. Distinguish "the stream died" from "the agent is idle". A dead stream should
   be retried or resumed, not treated as a stalled agent.
2. On a watchdog kill, surface whatever the agent produced and allow resuming
   it, instead of returning only a truncated fragment.
3. If neither is feasible, document the 600s limit so callers know to instruct
   agents to checkpoint (commit) frequently.

## Environment

Linux (CachyOS, kernel 7.1.6), Claude Code native install, model Opus 5.
Subagents were doing ordinary Rust work: cargo build/test/clippy in a warm
workspace, 15-40 minute tasks, no network waits, no interactive prompts.

Environment Info

  • Platform: linux
  • Terminal: konsole
  • Version: 2.1.226
  • Feedback ID: 176354c2-586c-46fb-8669-8e678e6fcbc7

Errors

[]

View original on GitHub ↗