TaskOutput with block=true fails with 'No task found' for valid background tasks
Bug Description
TaskOutput with block=true returns "No task found with ID" when called immediately after launching background tasks via run_in_background=true, even though the tasks are valid and complete successfully.
Steps to Reproduce
- Launch multiple background tasks using
Bashwithrun_in_background=true - Immediately call
TaskOutputwithblock=truefor the returned task IDs TaskOutputfails with:No task found with ID: <id>- Shortly after, task completion notifications arrive confirming the tasks ran successfully
Expected Behavior
TaskOutput with block=true should wait for the task to appear and complete, not fail immediately if the task hasn't registered yet. Since block=true implies willingness to wait, it should handle the case where the task ID is valid but not yet registered in the task tracking system.
Actual Behavior
TaskOutput fails instantly with "No task found with ID" — a race condition between task registration and task output retrieval. Additionally, when called in parallel and the first one errors, all remaining parallel TaskOutput calls are cancelled with "Cancelled: parallel tool call TaskOutput errored".
Environment
- Platform: Linux (WSL2)
- Shell: nushell
- Model: claude-opus-4-6
Additional Context
This occurred when launching 14 git clone commands in parallel as background tasks, then immediately trying to read their output. All 14 tasks completed successfully (confirmed by late-arriving notifications), but none of the TaskOutput calls succeeded.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗