Repository navigation
Let the cleanup sheet choose worktrees left with only finished agent panes - #406
Merged
Merged
Conversation
…panes In use now means an agent working or waiting, a delegated agent working or waiting anywhere, a non-shell program or a listening port. A worktree with only finished agents and shells is chosen, and the confirmation closes its panes through the delete path before removing without force.
yansfil
force-pushed
the
fix/cleanup-finished-agent-panes
branch
from
October 4, 2026 17:06
ba27676 to
f1d3266
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #394
Related: #390
Summary
A merged worktree whose only panes are an agent that finished or a shell prompt could not be picked in the disk cleanup sheet, because any live pane excluded it.
Now only real use blocks it, and the confirmation closes the leftover panes before removing the folder (never forced).
pane N개 닫고 워크트리 M개와 캐시 정리.close_refused).Screenshot of the confirmation (finished agent, 1 pane) is in the local run record; no image is attached.
Review
in_useis shared; judged safer than guessing idle.herdr-core/src/worktree_cleanup.rs-close_checkoutre-reads use and panes right beforepane.close(stale-idle race);confirmorder is close then remove.herdr-core/src/runtime/projects.rs-checkout_factsruns under the runtime lock, in-memory only, and walks lineage children (not the close list, which drops unreachable devices).herdr-core/src/worktree_control.rs- only visibility changed onclose_checkout_panes, the delete path's close; the primary workspace last-tab rule applies to it as before and a refusal shows asclose_refused.herdr-core/src/wire.rs-cleanup_usage_pathsnow pairs each folder with its pane id.worktree_cleanup.rsand the sameUI_BEHAVIOR.mdsection are also edited by the cleanup-main change (verified_merge); I did not touch that function.Evidence
live::cleanupunit tests (35) cover finished agent and shell pass, waiting/blocked/unknown block, delegated descendant blocks, non-shell program blocks, stranger pane excluded, panes close before removal, close failure keeps the folder, and a pane opened or gone since the review.a_checkout_stays_in_use...(2) cover descendants across checkouts and devices, including a stale device.diskCleanup.test.ts43 passed (pane counts in the plan, waiting agent blocks). Full web unit suite 944 passed, typecheck, lint, build, design contract, removal-boundary and off-lock checks pass.web/e2e/disk-cleanup.spec.ts3 passed against an isolated Herdr and hided; the new spec (blocked agent keeps the worktree, finished agent is chosen, its pane closes, folder gone, branch stays) ran 20 times in a row with no failure, as did the 20 repeats of the new core and web unit tests.pane.closewas not reproduced.hide-kitprocess tests andhidedopener_lifecyclefailed once in a loaded fullcargo testrun and passed alone; they are outside this diff.