[BUG] Agent teams: task with unresolved 'Blocked by' can be claimed; TaskCompleted fires on every teammate idle

Status Open
Reported on v2.1.296
Maintainer reply None cached
Activity 0 comments · opened Oct 10, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (two closely related agent-teams task-list defects found in one probe)
  • [x] I am using the latest version of Claude Code available to me

What's Wrong?

Two task-list defects in in-process agent teams:

1. Task dependencies are not enforced on claim. A teammate claimed a task whose blocker was still in progress, and the claim succeeded:

  • TaskUpdate (owner + status: in_progress) on task #3 returned Updated task #3 owner, status.
  • TaskGet on #3 then showed Status: in_progress … Blocked by: #1, while #1 was still in_progress.

The agent-teams docs say: "a pending task with unresolved dependencies cannot be claimed until those dependencies are completed."

2. TaskCompleted fires on every teammate idle, not only when a task is completed. Each time a teammate went idle, TaskCompleted fired once for every in-progress task that teammate owned, followed by TeammateIdle. Task #1 produced two TaskCompleted events before the teammate actually marked it completed. When TaskUpdate later set status: completed, no separate event fired. The hook input has no field showing whether the event came from a real completion or from an idle turn end. A hook therefore can't treat the event as "task done" (for example, to release resources the task held).

What Should Happen?

  1. Claiming a task that has unresolved Blocked by dependencies is refused, as documented.
  2. Either TaskCompleted fires only when a task actually transitions to completed, or its input carries a field saying what triggered it (TaskUpdate versus a teammate's finishing or idle turn), so hooks can tell the two apart.

Error Messages/Logs

# Hook input log (PreToolUse/TaskCreated/TaskCompleted/TeammateIdle), abridged, agent_ids shortened
12:43:54 TaskCreated   task_id=1
12:43:55 TaskCreated   task_id=2
12:43:56 TaskCreated   task_id=3            # 3 blocked by 1
12:44:24 TaskCompleted task_id=1 teammate=probe-a   # probe-a idle, task 1 still in progress
12:44:24 TeammateIdle  teammate=probe-a
12:44:27 TaskCompleted task_id=1 teammate=probe-a   # again, still in progress
12:44:27 TeammateIdle  teammate=probe-a
12:44:31 TaskCompleted task_id=2 teammate=probe-b
12:44:31 TaskCompleted task_id=3 teammate=probe-b   # task 3 claimed while blocker 1 in progress
12:44:31 TeammateIdle  teammate=probe-b

Steps to Reproduce

  1. Launch with CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1 CLAUDE_CODE_ENABLE_TODO_TOOLS=1 claude. The second variable is needed on Opus 5.5 to get the Task tools.
  2. Register a trivial logging hook on TaskCreated, TaskCompleted and TeammateIdle that appends the stdin JSON to a file.
  3. As lead, create T1, T2, and T3 with T3 blocked by T1.
  4. Spawn two in-process teammates (worker subagent type, Haiku). Tell teammate A to claim T1, then wait for a message from B before completing it. Tell teammate B to claim T3 immediately.
  5. Observe that B's claim of T3 succeeds while T1 is in progress, and that TaskCompleted for T1 fires every time A goes idle.

Claude Model

Opus

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

2.1.296 (Claude Code)

Platform

Anthropic API

Operating System

Other Linux

Terminal/Shell

Other

Additional Information

  • Lead on Opus 5.5; teammates on Haiku 5.5; teammateMode: auto, which fell back to in-process (Windows Terminal, WSL2, bash).
  • The lead and both teammates had the Task tools.
  • Other observations from the same run, possibly related: claiming a task by setting owner sends that owner a task_assignment message that appears to come from itself; and a SendMessage to a teammate still starting up fails with No agent named '…' is reachable.

View original on GitHub ↗