The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(cli): preserve dirty session worktrees
Yuan Liacc56a8ea456
diff --git a/cli.py b/cli.pyindex 19f8e4d2321..d720266f390 100644--- a/cli.py+++ b/cli.py@@ -567,6 +567,7 @@ from hermes_cli.worktree_ops import (_repo_is_shallow,_setup_worktree,_worktree_has_unpushed_commits,+ _worktree_is_dirty,release_lsp_clients,)@@ -576,7 +577,7 @@ _active_worktree: Optional[Dict[str, str]] = Nonedef _cleanup_worktree(info: Dict[str, str] = None) -> None:- """Remove a worktree and its branch on exit; kept only when it has unpushed commits."""+ """Remove a clean worktree and its branch on exit; preserve recoverable work."""global _active_worktreeinfo = info or _active_worktreeif not info:@@ -586,7 +587,7 @@ def _cleanup_worktree(info: Dict[str, str] = None) -> None:if not Path(wt_path).exists():return- if _worktree_has_unpushed_commits(wt_path, timeout=10):+ if _worktree_has_unpushed_commits(wt_path, timeout=10) or _worktree_is_dirty(wt_path, timeout=10):if _repo_is_shallow(repo_root):# Shallow boundary makes the unpushed verdict unreliable; the startup pruner reaps later._cprint(f"\n\033[33m{_t('cli.worktree.shallow_clone_keeping', path=wt_path)}\033[0m")