Background task counter not decremented after TaskOutput acknowledgment or session compaction
Resolved 💬 6 comments Opened Feb 3, 2026 by seaberger Closed Mar 10, 2026
Bug Description
The status bar shows "3 background tasks" even after:
- All background tasks have completed (confirmed via task-notifications)
- TaskOutput was called on completed tasks (returned
status: completed) - Task output files were cleaned up
The counter persists and cannot be cleared.
Steps to Reproduce
- Start background tasks using
run_in_background: trueon Bash tool - Wait for tasks to complete (receive task-notification with status: completed)
- Call TaskOutput on the completed task IDs - returns success with status: completed
- Observe status bar still shows the same number of background tasks
Additionally:
- If session runs out of context and gets compacted/summarized
- Background task counter persists but task IDs are lost
- Orphaned tasks can never be acknowledged
Expected Behavior
- Calling TaskOutput on a completed task should decrement the background task counter
- Session compaction should either preserve task IDs or reset the counter
Actual Behavior
- TaskOutput returns success but counter stays the same
- After session compaction, tasks become orphaned (counter persists, task IDs lost)
Environment
- Claude Code CLI
- Model: Opus 4.5
- Custom statusline enabled (but issue is with Claude Code's internal task tracking, not custom script)
Screenshot
Status bar showing "3 background tasks" after all tasks completed and acknowledged:
- Tasks
bb5c918andbf41fabboth returnedstatus: completedfrom TaskOutput - Third task likely orphaned from pre-compaction session
Workaround
Currently none known except restarting the Claude Code session.
This issue has 6 comments on GitHub. Read the full discussion on GitHub ↗