TaskOutput tool cannot find completed background tasks — should it be denyable?
Bug: TaskOutput returns "No task found" for completed background tasks
Environment
- Claude Code version: 2.1.81
- OS: macOS (Darwin 25.3.0, arm64)
- Model: claude-opus-4-6 (1M context)
Reproduction steps
- Launch multiple background commands and agents in parallel:
- 2 background bash commands (
run_in_background: true) withsleep 5/sleep 7 - 2 background agents (
run_in_background: true)
- Wait for all 4 to complete (all
<task-notification>messages are received withstatus: completed) - Use
TaskOutputtool to retrieve the results of all 4 tasks
Expected behavior
All 4 TaskOutput calls return the task output successfully.
Actual behavior
3 out of 4 TaskOutput calls fail with:
No task found with ID: <task_id>
Only the last-completed task is retrievable. The output files still exist on disk at the expected paths — the task registry has simply lost track of them.
Debug log evidence
10:00:57.478Z [DEBUG] TaskOutput tool validation error: No task found with ID: bw1x8dg3j
10:00:57.975Z [DEBUG] TaskOutput tool validation error: No task found with ID: bkvflxzy4
10:00:58.916Z [DEBUG] TaskOutput tool validation error: No task found with ID: a3569442d23145738
All tasks had previously completed successfully and delivered <task-notification> messages. The output files are confirmed present on disk.
Root cause hypothesis
When a completed task's notification is delivered to the model, the task registry appears to remove/evict the task entry. By the time TaskOutput is called, the tasks are no longer registered — even though their outputs exist on disk.
---
Question: Should TaskOutput be denyable via settings?
In v2.1.81, the model no longer proactively uses TaskOutput — it relies on <task-notification> messages instead, which work correctly. The TaskOutput tool only gets used when explicitly prompted, and when it is used, it hits this bug.
Given that the notification-based flow works well:
- Is there still a use case for
TaskOutput? - Can it be added to the deny list in settings so the model doesn't have access to it? Currently it's a deferred tool that gets loaded via
ToolSearch, but there's no way to prevent it from being suggested/used.
If TaskOutput is kept, the registry eviction bug needs to be fixed so completed tasks remain retrievable for a reasonable window after completion.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗