Repository navigation
Description
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_statusandtask_cancelthroughchild_thread_id, with the same caller check.
Steps to reproduce
- In any thread, call
delegate_taskwithmode: "async". Note the returnedtaskIdandchildThreadId. - Call
task_statuswith thechildThreadId. Result:task_not_found, "does not belong to thread ". - Call
task_statuswith any id that does not exist, for examplenode:delegated-task:does-not-exist. Result: the same message. - Call
t3_thread_listwithincludeSubagents: true. The child row has notaskId.
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