Skip to content

Commit 95dc421

Browse files
fix(server): worktree cleanup no longer runs sweeps back to back
Every thread.deleted and provider-session.updated event queued another full sweep, and the worker never merged them. Each eligible worktree also re-read the full active and archived thread snapshot under its lease, so one sweep cost 2 + 2N snapshot reads for N eligible worktrees. - Merge sweep requests so at most one sweep runs and one waits. The hourly schedule, settings changes and domain events all go through it. - Request a sweep only for session updates that reach "stopped" or "error". Moves between live statuses cannot free a worktree. - Under the worktree lease, recheck the project list, the threads that reference this path, this thread's shell and the live sessions. The snapshot is read once per sweep. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent ec80933 commit 95dc421

2 files changed

Lines changed: 450 additions & 25 deletions

File tree

0 commit comments

Comments
 (0)