The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(worktree): drop .worktreeinclude symlinks before plain startup remove
kshitijk4poor62114d180b8a
diff --git a/hermes_cli/worktree_ops.py b/hermes_cli/worktree_ops.pyindex 9c8a45424fa..336164cf966 100644--- a/hermes_cli/worktree_ops.py+++ b/hermes_cli/worktree_ops.py@@ -956,6 +956,10 @@ def _reap_prune_verdicts(repo_root: str, verdicts: list, stale_work_cutoff: floatry:branch = _git(["branch", "--show-current"], str(entry), timeout=5).stdout.strip()+ # Our own .worktreeinclude symlinks are the only untracked state a reap verdict+ # allows; drop them so the plain (non --force) remove still succeeds.+ for rel in _include_symlink_paths(str(entry), repo_root):+ (entry / rel).unlink()remove_result = _git(["worktree", "remove", str(entry)], repo_root, timeout=15)if remove_result.returncode != 0:logger.debug("Failed to remove worktree %s: %s", entry.name, remove_result.stderr.strip())diff --git a/tests/hermes_cli/test_worktree_reclaim_revalidation.py b/tests/hermes_cli/test_worktree_reclaim_revalidation.pyindex 6785071a29c..8cb8ed2bb4a 100644--- a/tests/hermes_cli/test_worktree_reclaim_revalidation.py+++ b/tests/hermes_cli/test_worktree_reclaim_revalidation.py@@ -66,3 +66,20 @@ def test_startup_reclaim_preserves_work_added_after_classification(repository, kassert tree.is_dir()assert (tree / "README.md").read_text(encoding="utf-8") == "new work after audit\n"assert _git(root, "rev-parse", "--verify", "scratch")+++def test_startup_reclaim_still_removes_include_symlink_only_tree(repository):+ from hermes_cli.worktree_ops import _classify_prune_candidates, _reap_prune_verdicts++ root, tree = repository+ (root / "node_modules").mkdir()+ (root / ".worktreeinclude").write_text("node_modules\n", encoding="utf-8")+ (root / ".gitignore").write_text("node_modules/\n.worktrees/\n", encoding="utf-8")+ os.symlink(root / "node_modules", tree / "node_modules")+ verdicts = _classify_prune_candidates(str(root), [(tree, time.time() - 86400, False)])+ assert verdicts[0][3] == "reap"++ _reap_prune_verdicts(str(root), verdicts, stale_work_cutoff=0)++ assert not tree.exists()+ assert (root / "node_modules").is_dir()