TaskOutput hangs after background agent completes
Resolved 💬 7 comments Opened Jan 23, 2026 by stream727 Closed Mar 22, 2026
Problem Summary
When using TaskOutput to wait for a background task completion, the main session hangs and does not respond even after the agent has completed.
Steps to Reproduce
- Start a background agent with
Task(..., run_in_background=true) - Wait for results with
TaskOutput(task_id)(withblock=true) - Agent completes its work
- Main session remains stuck in "Waiting for task" / "Booping…" state
- More than 5 minutes pass without detecting completion
- Manually cancel with
Esckey, then the completed task's results are displayed
Expected Behavior
- TaskOutput should immediately return results when the agent completes
- Completion detection should work correctly
Actual Behavior
- TaskOutput continues to block after agent completion
- Session hangs in "Booping…" state for several minutes
- Results are only retrievable via manual cancellation (
Esc)
Environment
- Claude Code version: 2.1.17
- Platform: Linux (WSL2)
- OS: Linux 6.6.87.2-microsoft-standard-WSL2
Additional Context
This issue significantly impacts workflows that rely on background agent orchestration. The workaround of manually canceling and re-requesting results is disruptive to automated pipelines.
Possible Root Cause
The completion polling/notification mechanism may not be correctly detecting when the background task state changes from "running" to "completed".
This issue has 7 comments on GitHub. Read the full discussion on GitHub ↗