Background tasks (run_in_background) are invisible: no statusline payload field, no UI badge — and sessions with live tasks resist deletion with no explanation
Status Open
Reported on v2.1.215
Maintainer reply None cached
Activity 0 comments · opened Jul 19, 2026
Environment
- Claude Code 2.1.215, macOS (Darwin 25.5), terminal + agents view
- Session type: background session (
claude --bg) in a git worktree
What happened
A long autonomous run used several run_in_background Bash tasks (CI deploy watchers, up to ~30 min each). While any of them were running:
- Nothing anywhere in the UI indicated they existed — not the custom statusline, not the built-in footer badges (the
← N agentbadge counts subagents/agent-teams, not background bash tasks), not the agents view. - Deleting the session from the agents view (Ctrl+X) silently failed / the session kept reappearing as each finishing task re-invoked it. From the user's perspective the chat 'refused to die' with no explanation, repeatedly, until the last watcher happened to finish — at which point teardown succeeded instantly.
The protection itself (don't tear down a session with live background work) seems right; the invisibility makes it indistinguishable from a bug.
Why a custom statusline can't fix this
Per the statusline docs' full JSON schema, the stdin payload carries model, workspace, cost, context_window, rate_limits, session_id/session_name, pr, worktree, effort, etc. — no field describing running background tasks, their count, or active subagents. So user-side scripts have nothing to render.
Requested
Any/all of, in rough priority order:
- Agents-view deletion refusal explains itself: 'N background tasks still running — stop the session first' (this alone would have eliminated the confusion).
background_task_count(or a small tasks array: id, description, started_at) in the statusline JSON payload, so custom statuslines can render e.g.⏳ 2 bg.- A built-in footer badge for running background tasks, symmetric with the existing agent badge.
Repro sketch
- In any session:
Bash(run_in_background: true)with a long sleep-loop. - Observe statusline + footer: no indicator.
- From
claude agents, try Ctrl+X on that session while the task runs → deletion doesn't take, no reason shown.