Repository navigation
Fixes (issue #7 follow-up)
Fixes the follow-up reported in #7 (comment): v0.4.2's zombie-binding fix did not cover the main path of "background task sub-sessions completing normally" — worktree_merge apply was blocked 100% by inherited: true bindings of finished sub-agents.
Inherited sub-agent bindings now have a full lifecycle
- Event-driven release (root fix): new
eventhook —session.idlereleases a sub-agent's inherited binding the moment its task finishes;session.deletedreleases any binding. Audited asbinding_released. If a released sub-agent resumes later, lazy parent-chain inheritance re-binds it transparently (self-healing). - Guard semantics corrected: merge/cleanup now refuse only when an independent session holds a binding for the worktree. Inherited bindings are, by construction, descendants of the owner session — they are released along with the worktree instead of blocking it.
- Cascade clearing: after a worktree is removed (merge/cleanup) or detected missing, every binding pointing at it is cleared, including the in-process inheritance cache — finished background tasks can never leave residue in the state file, across restarts.
Cleanup preview / merged-detection fixes
git branch --mergedprefixes linked-worktree branches with+; the old parser only stripped*, so every managed worktree was labeledunmergedand non-forceworktree_cleanup applyalways skipped them. Both markers are now stripped (lookahead-guarded so+foo-style branch names stay intact); detached-HEAD pseudo entries are skipped.worktree_cleanup(action="preview")aggregates per worktree (sessions=N, no duplicate lines) and reaps bindings whose directories are gone.- The apply loop processes each worktree exactly once, driven by its direct binding (correct for both
externalandgit-commonstate backends).
Full changelog: v0.4.2...v0.4.3