Skip to content

task_status says a delegated task "does not belong to thread" when the task id is wrong, and a child thread id cannot be mapped back to its task #40875

Description

@Project516

What happened

A Claude thread started two delegates with delegate_task. After a /compact and a server restart, task_status on both returned task_not_found with "Delegated task ... does not belong to thread ". The agent concluded that its thread id had changed after the restart and that it had lost ownership of its delegates. Both delegates were still running, and one later reported back to the parent normally.

Diagnosis

The parent still owned both tasks. The thread id did not change. The subagent rows in orchestration_v2_projection_subagents still have the parent's thread_id and origin = app_owned.

The compact summary kept the child thread links but not the taskId values. The agent then rebuilt a task id from the link: it removed the thread:delegated-task: prefix and URL-decoded the rest, which gave command:mcp:<uuid>:delegate-task:<uuid>. The real id is node:delegated-task:command%3Amcp%3A<uuid>%3Adelegate-task%3A<uuid>.

readTask in apps/server/src/mcp/OrchestratorMcpService.ts loads the caller's subagents by exact id. When nothing matches, it returns the same "does not belong to thread" message it uses for a task owned by another thread. That message sent the agent looking for an ownership problem.

The agent also had no way to recover the id. t3_thread_list with includeSubagents shows a child's parentThreadId but not its taskId, and task_status does not accept a child thread id. The child thread link is the part of the delegation that is most likely to survive compaction.

A second confusion came from the link format. The agent read the environment id in t3-thread://v2/<environmentId>/<threadId> as its old thread id.

Possible fixes, smallest first:

  • When the lookup misses, return "No delegated task with id X on thread Y" and list the caller's open or undelivered task ids with titles.
  • Resolve a child thread id passed to task_status and task_cancel through child_thread_id, with the same caller check.

Steps to reproduce

  1. In any thread, call delegate_task with mode: "async". Note the returned taskId and childThreadId.
  2. Call task_status with the childThreadId. Result: task_not_found, "does not belong to thread ".
  3. Call task_status with any id that does not exist, for example node:delegated-task:does-not-exist. Result: the same message.
  4. Call t3_thread_list with includeSubagents: true. The child row has no taskId.

Version

0.1.11

Environment

Linux x64, desktop app, Node 24.22.1, Claude provider (claude-opus-5-5 parent, claude-sonnet-5-5 delegates)

Evidence

# parent transcript, UTC
03:20  delegate_task -> taskId "node:delegated-task:command%3Amcp%3A1fbc...%3Adelegate-task%3A746c..."
13:24  new provider session on the same thread after the restart
13:25  compact_boundary (summary keeps only the t3-thread:// links)
13:25  task_status("command:mcp:1fbc...:delegate-task:746c...")
       -> task_not_found: "Delegated task command:mcp:... does not belong to thread 8953...."
13:36  wake-up: "Delegated task node:delegated-task:...746c... (Merge ...) [completed]"

Related issues

#34401 also reports task_not_found after a compaction, but there the children were really interrupted. #32235 had a different cause (an MCP session change).

Fix applied or workaround

None on the machine. Passing the real node:delegated-task:... id resolves the task.

Filed by

claude-opus-5-5 via Claude Code in T3 Code

Activity

  1. added
    via-triage
    on Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    via-triage

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions