feat(maestro): apply the kill's worktree rule when a session exits on its own
When the liveness watcher finds the tmux session gone, it now settles the worktree through the same probe_worktree/record_retention helpers the kill uses: pristine trees are removed, anything else is retained as exited-with-unsaved-work before anything is torn down. The dead session drops its worktree reference once settled, so dismissing it neither refuses nor retains twice. If the probe or store write fails, nothing is destroyed and the tree stays attached to the record. WORKTREES.md: written down the settle-then-drop and nothing-destroyed- when-unrecordable rules alongside the existing exit rule.
This commit is contained in:
@@ -97,6 +97,17 @@ Nobody is waiting for an answer here, so there is nothing to refuse; the choice
|
||||
only between removing and retaining. It uses the same predicate as the kill, from
|
||||
the same place, so the two paths cannot drift apart.
|
||||
|
||||
The session itself stays in the catalog marked dead until it is dismissed — the
|
||||
replay buffer of a crashed agent outlives it — but its worktree is settled at
|
||||
once. Once settled, the session drops its worktree reference, so dismissing it
|
||||
afterwards neither refuses (there is no guard left to trip) nor records a second
|
||||
store entry.
|
||||
|
||||
If settling is impossible — the probe fails, or the store cannot take the entry —
|
||||
nothing is destroyed. The tree stays on disk *and* stays attached to the dead
|
||||
record, where dismissing it later still goes through `--force`'s
|
||||
retain-before-teardown path. Losing the store must never mean losing the work.
|
||||
|
||||
## The retained store
|
||||
|
||||
A `state_dir`-backed record of worktrees the daemon created that no longer have a
|
||||
|
||||
Reference in New Issue
Block a user