[BUG] Background sub-agents stay "In esecuzione" in the Activity panel after they've completed

Open 💬 5 comments Opened Jul 2, 2026 by brunelloalessio

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

Title: Background sub-agents stay "In esecuzione" in the Activity panel after they've completed

Environment: Claude Code (desktop/web app), model Opus 4.8, Ultracode on

Description:
Sub-agents launched via the Agent tool complete and return their final result to the main loop, but the "Attività in background" panel keeps showing them under "In esecuzione" with a live-incrementing timer (observed 15–23+ min after completion). This makes it look like agents are still running and consuming tokens when they have finished.

Evidence of the mismatch:

The agents returned their complete final output (review verdicts) to the main conversation.
From the main loop, TaskStop <id> and TaskOutput <id> both return "No task found" for those agent IDs, and TaskList is empty → the harness no longer tracks them as active/stoppable.
Yet the UI panel still lists them as "In esecuzione".
Impact: The assistant cannot terminate them (harness reports them as non-existent), and the user has no reliable way to tell whether they're actually running or just stale UI state. Erodes trust ("agents look stuck/running forever").

What Should Happen?

Once an agent's turn ends, it should move to "Terminato" (or a distinct "idle/resumable" state), not remain in "In esecuzione" with a running timer. Ideally the token/tool counters should visibly stop.

Error Messages/Logs

Steps to Reproduce

In a Claude Code session (desktop/web app), give a task that leads the assistant to launch several sub-agents via the Agent tool — e.g. a review pipeline (supervisor → reviewer → critic → a second critic re-review).
Let the assistant run them as background agents and wait for each to finish (it awaits their results, e.g. via TaskOutput).
Each agent returns its final result to the main conversation (the assistant reports their verdicts) — i.e. their turn is complete.
Open the "Attività in background" panel.

Claude Model

Opus

Is this a regression?

Yes, this worked in a previous version

Last Working Version

_No response_

Claude Code Version

1.17377.1

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

_No response_

View original on GitHub ↗

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