Skip to content

Settling a thread doesn't settle its finished subagent threads #33578

Closed

Description

@howells

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Related: #29999 reported the same thing. #30026 closed it by changing worktree cleanup only, and says settlement state is unchanged. #19657 is about the auto-settle sweep picking up hidden subagent threads.

Area

apps/server

Steps to reproduce

  1. In a thread, let the agent start subagents (Claude Agent, a Workflow, or delegate_task).
  2. Let them finish, then settle the parent from the sidebar or with t3_thread_organize (action: "settle").
  3. Call t3_thread_list with settled: false, allProjects: true.

Expected behavior

The parent's finished subagent threads are settled with it. They aren't shown in the sidebar, so the user can't settle them by hand.

Actual behavior

Only the parent is settled. settleThread in ThreadManagementService.ts dispatches one thread.settle for input.threadId and doesn't look at children, so each child keeps settledAt: null.

On my Mac (0.1.8-nightly.20261109.4429), orchestration_v2_projection_threads without deleted rows:

count
Top-level threads, unsettled 24 of 544
Subagent threads, unsettled 6,348 of 6,455
Unsettled subagent threads whose parent is settled 5,059
…with their own worktree 609
Unsettled subagent threads whose parent row is gone 86

t3_thread_list therefore reports about 6,400 unsettled threads. I have 24 open sessions. When I asked an agent to tidy up, it could only settle them one call at a time.

Suggested fix

When a thread settles, also settle its subagent descendants that have no active run or pending request, and reverse that on unsettle. Add a one-time pass that settles children of already-settled parents.

with t as (
  select thread_id,
    json_extract(payload_json, '$.lineage.parentThreadId') p,
    json_extract(payload_json, '$.settledAt') s
  from orchestration_v2_projection_threads where deleted_at is null)
select count(*) from t c join t par on par.thread_id = c.p
where c.s is null and par.s is not null;

Activity

  1. Techie5879 commented on Nov 11, 2026

    @Techie5879

    Yeah, seeing this too on Linux with 0.1.10-nightly.20261111.4529.

    A read-only snapshot found 27,381 completed subagent chats still marked unsettled. Following the full parent chain, 24,002 belonged to settled top-level parents and another 3,110 to archived/deleted parents. Of the 24,002, 24,001 finished before their parent was settled. Most descendants were nested, so checking only the immediate parent substantially undercounted it.

    This matches the parent-based settlement work in #19665, including the case where automatic settlement is disabled.

    After manually settling the idle descendants through normal T3 commands, the unsettled PR-snapshot query dropped from 30,240 rows / 50.2 MB to 501 rows / 0.82 MB. This measures the metadata returned by that query.

    (commented on behalf of Aritra Bandyopadhyay by GPT 6.1 Sol)

  2. juliusmarminge commented on Nov 11, 2026

    @juliusmarminge
    Member

    Fixed by #19665, now on main: Settling a parent now automatically settles its eligible idle local subagent descendants, including existing children of settled or missing parents and with automatic settlement disabled, so those children disappear from the unsettled thread list.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions