A delegation that dies stays visible
What was reported
On the public instance a user saw five delegations in one day (two Coder, two Worker, one feedback agent)
accept a task, stream promising output, then disappear: no error, no terminal status, no entry in
list_sub_threads. The partial node writes of the dead runs persisted, so one user's NodeType was left half built
with a source file missing. The parent agent, seeing nothing, dispatched the same work again over the leftovers.
Causes (measured, Loki on the instance, 2026-11-25)
- The parent's heartbeat cancelled the sub-threads while a tool call was running. Each death is one line,
[DelegationHandlers] heartbeat stale sub=<path> - cancelling (no activity for 30s), at 09:50, 09:53, 09:54, 09:56 and 10:26 UTC - none of them in a roll window. A sub-thread stampsLastActivityAtwhen the provider streams or text arrives, and not while a tool executes; a NodeType create that compiles in the mesh outlasts the 30 s timeout. The round was alive and silent, and was judged stalled. list_sub_threadsread an in-process set. It listedAgentChatClient.ActiveDelegationPaths, which the terminal event removes from, so a cancelled or failed delegation left the list at the moment it ended; a relaunched round started with an empty set. The status was the literalExecutingfor every row.- Drain (the second half of the report, and the other deaths that day). At 11:30-11:40 UTC the supervisor
relaunched, then gave up on, a main thread and a sub-thread whose round the draining pod's dispatch pool had
refused. That is the
DrainRefusalpath MeshWeaver#8563 / Plugins#5933 fixed: such a thread is woken by a live pod, with no retry counted. The wake reads only the persisted node, so it covers sub-threads; the test now says so.
What changed
- A round stamps
LastActivityAton its heartbeat tick while one of its tool calls is executing (ThreadExecution,toolCallsInFlight). A hub that is gone stops ticking, so a dead round still goes quiet and the supervisor still judges it Stale. list_sub_threadsreads the persisted sub-threads under the thread (SubThreadListing), running and finished. Statuses:Executing,Pending,Done(with the summary),FailedandCancelled(withlastError). A sub-thread whose process died is settled by the supervisor (Idle,Error: ...) and is listedFailed; a run that ended without writing a result isFailedas well, never silent.- A cancelled delegation now answers the parent's
delegate_to_agentcall with an error that names the sub-thread and says it may have written part of its work, so the parent checks before it delegates again - also when the sub-thread left partial text.
Not changed, and why
The 30 s inter-activity timeout stays: a tool call that hangs for ever is no longer cut by it and is bounded by the round cap (30 minutes) and the tool's own timeout. Partial writes of a cancelled run are not rolled back - the node operations are individually committed; the listing and the error text exist so the parent can see them.