The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(update): keep supervised launches off the pending completion tail
liuhao10248d22a824ff5d
diff --git a/hermes_cli/venv_sync.py b/hermes_cli/venv_sync.pyindex 514e68f676d..987ef8e9a98 100644--- a/hermes_cli/venv_sync.py+++ b/hermes_cli/venv_sync.py@@ -231,6 +231,10 @@ def prepare_launch(project_root: Path, argv: list[str]) -> Path | None:so a tail that failed is retried on the next launch WITHOUT rebuildingdependencies that are already current. Old updaters need not write amarker (and cannot accidentally clear this obligation).+ A supervised child never retries that tail: its manager restarts it on+ every start, so a sticky marker would re-run the tail (and its+ environment builds) on each boot until the disk fills. The tail stays+ the CLI's to finish, via ``hermes update`` / ``hermes pm install``.Return the store interpreter when this process must restart cleanly."""import os@@ -247,6 +251,8 @@ def prepare_launch(project_root: Path, argv: list[str]) -> Path | None:if (command_argv(argv)[:1] == ["pm"]or _METADATA_FLAGS & set(argv)or os.environ.get("HERMES_DISABLE_LAZY_INSTALLS", "").lower() in ("1", "true", "yes")+ or os.environ.get("HERMES_SUPERVISED_CHILD")+ or os.environ.get("HERMES_S6_SUPERVISED_CHILD")or not (root / ".git").exists()or not (root / "pyproject.toml").is_file()):return Nonediff --git a/tests/hermes_cli/test_update_launch_completion.py b/tests/hermes_cli/test_update_launch_completion.pyindex 47dbd519fc4..695f2ed1fca 100644--- a/tests/hermes_cli/test_update_launch_completion.py+++ b/tests/hermes_cli/test_update_launch_completion.py@@ -330,3 +330,30 @@ def test_launch_under_the_owning_update_does_not_run_the_tail_again(tmp_path, moassert completion_tail == []assert pending.is_file(), "the owning update's obligation was discharged by its own tail"+[email protected]("marker", ["HERMES_SUPERVISED_CHILD", "HERMES_S6_SUPERVISED_CHILD"])+def test_supervised_launch_does_not_repay_a_pending_tail(+ tmp_path, monkeypatch, completion_tail, marker+):+ """A supervised start retries the tail on every manager restart (#123340).++ systemd/launchd/Windows-task/s6 launchers all export a supervised-child marker and+ restart the gateway under a policy; with a marker that never clears, each boot would+ rebuild the completion environment until the disk fills. The obligation must stay+ with the CLI (`hermes update` / `hermes pm install`), not the supervised process.+ """+ import pm++ root = _self_checkout(tmp_path, monkeypatch)+ pending = venv_sync.completion_pending_path(root)+ pending.parent.mkdir(parents=True)+ pending.write_text("owed\n")+ monkeypatch.setattr(pm, "venv_is_current", lambda **kw: True)+ monkeypatch.setenv(marker, "1")++ assert venv_sync.prepare_launch(root, ["gateway", "run"]) is None+ assert completion_tail == []+ assert pending.is_file(), (+ "a supervised child discharged an obligation the CLI still owes"+ )+