Background task spinner persists after Monitor task is orphaned by /model switch (no completion record, TaskStop says 'No task found')
What happened
A persistent Monitor background task was started during a long session. Later in the same session the model was switched (/model claude-opus-4-8), which appears to have restarted/replaced the underlying process. The monitor died without emitting a completion record.
After that:
- The UI kept showing an active background-task spinner indefinitely.
- The background task panel showed no tasks.
- Calling
TaskStopwith the task id returnedNo task found with ID: <id>. - The only system message about it was: "No completion record was found for this background shell command from the previous session. It may have been stopped (via the UI, Monitor timeout, or agent teardown — these leave no transcript marker), or it may have been running when the previous Claude Code process exited."
So the task was gone from the registry, but the activity indicator never cleared.
Expected
When a background task is orphaned or torn down without a completion record, the activity indicator should clear (or the task should be reaped and surfaced as stopped/failed). An indicator that spins forever with nothing behind it is worse than no indicator: the user can no longer tell whether real work is running.
Steps to reproduce (approximate)
- Start a long-lived
Monitortask (persistent: true, or a longtimeout_ms). - While it is running, switch models with
/model <other-model>(or otherwise cause the Claude Code process to restart). - Observe: system message says no completion record was found; the task is not in the registry (
TaskStop→ "No task found"); the spinner keeps running.
Environment
- Claude Code 2.1.211 (desktop app)
- macOS 26.5.2 (Apple Silicon)
Impact
In a long-running session with genuinely detached work (nohup-style processes) alongside harness-tracked tasks, a phantom spinner makes it impossible to distinguish "something is still working" from "stale UI state" without manually inspecting processes on disk.