Skip to content

Finished child agents are not archived #747

Done

Description

@tannerpolley

Many finished delegated children stay unarchived, especially ones with no issue or PR, and implementors too.

Step 1 (this issue): assess the repositories and threads and find why. Which children stay, what the auto-archive or settle rule expects, and where it misses.

Activity

  1. tannerpolley commented on Nov 28, 2026

    @tannerpolley
    OwnerAuthor

    Findings (read-only, origin/main cc2707b, live DB 2026-11-28 00:42 UTC)

    • Scale: 85 finished, unarchived delegated children across 7 projects (25 implementors; 67 with only an issue link, 9 with both, 8 with neither), plus 11 finished native subagents. Every one has an unarchived, unsettled parent, and 79 of those parents are idle.
    • Cause 1, the sweep waits for the parent. getSettlementCandidates (apps/server/src/orchestration-v2/ProjectionStore.ts:9091-9146) skips any subagent whose parent is still open. An orchestrator stays open for days, so its finished children never settle. A completed parent turn or a delivered child result doesn't count.
    • Cause 2, merge cleanup is off. workflows/merge-cleanup.ts archives a PR's creator child after merge, but workflowsEnabled defaults to false and the live install has no workflow runs.

    Fix (decided)

    Add one eligibility case to the existing settlement sweep. A local delegated child, or a native subagent, settles when:

    • its parent is idle;
    • its task is terminal;
    • its result was acknowledged, delivered or disposed.

    Recheck these under the existing dispatch lock. Defer for:

    • queued runs, pending result delivery, open requests, descendant work;
    • active terminals, checkpoint capture, restart continuations;
    • open or unresolved PRs;
    • autoArchiveDisabled (explicit unarchive).

    Then reuse the existing settle-and-archive path and its periodic sweep, so old rows clear too.

    Tests: an acknowledged child with no PR under an idle, open parent archives. These stay open: a child with pending delivery, one with a queued follow-up, one with an open PR, and one the owner unarchived.

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