The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
refactor(update): one explanation of the tail exemption, with the lock guard reworded
kshitijk4poorea7c6a13397a
diff --git a/hermes_cli/venv_sync.py b/hermes_cli/venv_sync.pyindex 38de5c405e0..514e68f676d 100644--- a/hermes_cli/venv_sync.py+++ b/hermes_cli/venv_sync.py@@ -211,11 +211,9 @@ def refuse_foreign_owned_venv(project_root: Path) -> None:)-#: The two tails the pending marker owes: the launch-time repair's and `hermes update`'s.-#: Each imports the CLI, and so runs prepare_launch, while that marker is still armed. The-#: lock-ancestry guard below covers this only while the owning claim is live; an unwritable-#: claim, one past its age ceiling, or none at all (an installer run) would start another-#: tail inside this one, and that tail another.+#: The completion tails import the CLI (so prepare_launch) while the pending marker is armed.+#: The lock-ancestry check covers that only under a live claim; an unwritable, expired or+#: absent one (an installer run) would start a tail inside the tail, recursively._TAIL_SCRIPTS = frozenset({"source_completion.py", "update_completion.py"})@@ -239,6 +237,7 @@ def prepare_launch(project_root: Path, argv: list[str]) -> Path | None:import sysroot = Path(project_root).resolve()+ # sys.argv[0] is this process's script identity; *argv* carries only the command.if _is_tail_script(root, sys.argv[0]):return None@@ -271,9 +270,8 @@ def prepare_launch(project_root: Path, argv: list[str]) -> Path | None:if not lock.acquire():raise RuntimeError("an update is still running; wait for it to exit, then relaunch Hermes")try:- # The tail imports the application, whose entry point runs this very function:- # under the launching process's own claim (its pid is our ancestor) we ARE that- # tail and owe nothing — without this, a pending marker recurses forever.+ # Under the launching update's own claim (its pid is our ancestor) a process it+ # spawned owes no tail: that obligation is the updater's.if not lock.acquired and read_live_update() is not None:if current:return None