Hand off an orchestrator thread's running delegated tasks to a new thread
Problem
A long orchestrator thread eventually gets too large and costly to continue, so I start a fresh thread and hand the work over. Delegated tasks (delegate_task children) stay bound to the old thread as their parent. Each time one of them ends a turn (including a failure, or a wake from its own background job), T3 Code starts a new turn in the old thread, which re-reads its whole history. In my case the old thread had about 3,600 items, so every wake was expensive. That's exactly the cost the handoff was meant to stop.
The new thread can steer the children with t3_thread_send, but it can't receive their completion notices. Work it starts in an old child (a send to a finished child) still reports to the old parent. The only workaround is to retire each child and start a replacement from the new thread, which throws away the child's working context.
Scheduled tasks already handle this well: schedule_task with scheduledTaskId and bindToCurrentThread: true moves a task to the current thread.
Proposed
A way to move delegated tasks to another orchestrator thread, for example:
t3_thread_transferwithaction: "adopt_children", run from the new thread withsourceThreadId(optionally a list of child thread ids), ordelegate_task-level:task_adopt({ taskId | childThreadId }).
On adoption:
- the child's
parentThreadIdbecomes the new thread, so completion, failure, question and approval notices go there, andtask_status/task_cancelwork from the new thread; - runtime-mode rules apply as they do today (the new thread must allow the child's mode);
- the old thread gets one notice listing what moved, and no further wakes from those children;
- the sidebar shows the children under the new thread.
A handoff convenience would cover the common case: "adopt every non-settled child of thread X and rebind its scheduled tasks to this thread".
Environment
T3 Code (Beta) 0.1.7 on macOS, Claude provider through a custom instance, children created with delegate_task.