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)

  1. 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 stamps LastActivityAt when 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.
  2. list_sub_threads read an in-process set. It listed AgentChatClient.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 literal Executing for every row.
  3. 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 DrainRefusal path 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

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.