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) (with block=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
Esc key, 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".
Problem Summary
When using
TaskOutputto wait for a background task completion, the main session hangs and does not respond even after the agent has completed.Steps to Reproduce
Task(..., run_in_background=true)TaskOutput(task_id)(withblock=true)Esckey, then the completed task's results are displayedExpected Behavior
Actual Behavior
Esc)Environment
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".