Task notifications arrive after TaskOutput already returned results

Resolved 💬 2 comments Opened Jan 27, 2026 by c2keesey Closed Feb 28, 2026

Description

When using background agents via the Task tool with run_in_background=true, followed by TaskOutput with block=true to wait for completion, the <task-notification> messages still arrive after the workflow has moved on.

Steps to Reproduce

  1. Launch multiple background agents using Task with run_in_background=true
  2. Call TaskOutput with block=true on each agent to wait for completion
  3. Receive the full agent outputs and proceed with next steps (e.g., PR creation)
  4. Observe that <task-notification> messages arrive afterward, even though the outputs were already retrieved

Expected Behavior

Either:

  • <task-notification> messages should arrive before or at the same time as TaskOutput returns, OR
  • <task-notification> messages should be suppressed if the output was already retrieved via TaskOutput

Actual Behavior

<task-notification> messages arrive asynchronously after TaskOutput has already returned the full results, creating a confusing presentation where it looks like agents completed after the workflow moved on.

Impact

This is a minor UX/presentation issue. The workflow functions correctly - TaskOutput with block=true properly waits for completion. The late-arriving notifications just create confusion when reviewing the conversation flow, making it appear that agents weren't properly awaited before proceeding.

Environment

  • Claude Code version: 2.1.20
  • Using Task tool with subagent_type for parallel validation agents

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗