Repository navigation
Description
What happened
Child threads made by delegate_task (thread:delegated-task:…) and provider subagent threads (thread:subagent:…) stay unsettled after their task finishes and the parent has the result. They settle only when their parent settles.
A long-lived parent, such as a pinned coordinator thread, never settles. So its children never settle either. On one machine about 2,000 finished children stayed unsettled.
This also blocks worktree cleanup. A delegate_task child with isolation: "worktree" keeps its worktree on an unsettled thread, so cleanup that waits until every thread on a worktree is settled never frees it. We ran out of worktree resources and had to settle 279 children by hand.
Request: settle a delegated or subagent child automatically once its run has ended and the parent has its result (for example, when the parent reads the final result or task_status reports it done). A later message to the child unsettles it, as for top-level threads.
Diagnosis
Local children settle only through their parent:
- The settlement candidate query (
getSettlementCandidatesin the projection store) returns arelationshipToParent: "subagent"thread only when its parent is settled, archived, deleted or missing. ThreadSettlementServicethen auto-settles that child ("settles with the parent").isAutoSettlementCandidateexcludes pinned threads, and pinning has no expiry. So a pinned parent never settles, and its children wait forever.- Nested delegation has the same problem one level down: a grandchild waits for its child parent, which waits for the pinned root.
- There is no setting for this.
sidebarAutoSettleAfterDaysandsidebarAutoSettleOnMergedo not apply to subagent children, because the sweep handles them before it reads settings.
Checked on current main: same behaviour. #42210 added settle-when-done only for tasks delegated from a linked environment (no local parent). Local children still wait for the parent.
Steps to reproduce
- Pin a thread (or keep it active).
- In that thread, start several children with
delegate_task, some withisolation: "worktree". Native provider subagents also work. - Let every child finish. Let the parent read each result (
task_statusreports done). - Wait for several settlement sweeps (they run every minute).
- Call
t3_thread_listwithsettled: false. All children are still unsettled, and their worktrees are still attached to unsettled threads.
Version
Server 0.1.13-nightly.20261125.5258. Behaviour confirmed in source at 0.1.11-nightly.20261119.4928 and on current main.
Environment
Linux, background service (serviceManaged: true). Heavy delegate_task use from a few long-lived pinned coordinator threads.
Evidence
Read-only query of orchestration_v2_projection_threads (not deleted, not archived, relationshipToParent = 'subagent'):
| count | |
|---|---|
| Unsettled children | 2,500 (196 parents) |
…thread:delegated-task:* |
1,965 |
…thread:subagent:* |
504 |
…latest run completed |
1,933 |
| …under one of 8 pinned root threads | 2,218 |
| …of those, with their own worktree | 1,861 |
| …whose direct parent is itself an unsettled child | 649 |
| Unsettled children whose parent is settled | 0 |
The last row shows that settle-with-parent works. The gap is only parents that never settle.
Related issues
- [Bug]: Settling a thread leaves its child threads open, so their worktrees are never cleaned up #29999, Settling a thread doesn't settle its finished subagent threads #33578: settling a parent did not settle its children (fixed: children now settle with the parent).
- [Bug]: Cross-machine delegate_task children never settle on the target machine (mcp:launch threads stay unsettled) #42197 / fix(server): a task delegated from a linked machine settles there once its work is done #42210: tasks delegated from a linked machine now settle once their work is done. This request extends that to local children.
Fix applied or workaround
Settled 279 children by hand to free worktrees. No setting covers this.
Filed by
Claude Opus 5.5 (claude-opus-5-5) in Claude Code, running inside T3 Code, following the triage playbook.
Activity