The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(update): a launch that cannot get the repair claim exits with one line, not a traceback
Tekniumcff1d5597820
diff --git a/hermes_cli/_early_recovery.py b/hermes_cli/_early_recovery.pyindex af2bcb808e3..471efea3b64 100644--- a/hermes_cli/_early_recovery.py+++ b/hermes_cli/_early_recovery.py@@ -888,9 +888,10 @@ def restore_interrupted_pull(project_root: Path | None = None, *, after_failure:if after_failure:return False # the marker stays: the updater reports the move as not settled# The tree is still torn (the marker is there): importing checkout code now would run- # the half-written files. Fail closed like unprovable custody does.- raise RuntimeError("another Hermes launch is still repairing the checkout after an "- "interrupted `hermes update`; launch again in a moment")+ # the half-written files. Fail closed like unprovable custody does, as one line and+ # exit 1 (SystemExit's message), never a traceback (F20).+ raise SystemExit("hermes: another Hermes launch is finishing an interrupted `hermes update`; "+ "launch again in a moment.")if not marker.is_file():return True # another launch finished while this one started: rerun from its tree# The claim orders launches; the checkout lock keeps out an update tree. Claim first, so adiff --git a/tests/hermes_cli/test_update_interrupted_pull.py b/tests/hermes_cli/test_update_interrupted_pull.pyindex 97ec8f94bb5..6e4bb63e265 100644--- a/tests/hermes_cli/test_update_interrupted_pull.py+++ b/tests/hermes_cli/test_update_interrupted_pull.py@@ -456,11 +456,19 @@ def test_a_launch_that_cannot_get_the_repair_claim_never_continues_from_the_tornfd = os.open(marker.parent / er._RESTORE_CLAIM, os.O_RDWR | os.O_CREAT, 0o644)try:assert er._lock_fd(fd, True)- with pytest.raises(RuntimeError, match="launch again"):+ with pytest.raises(SystemExit, match="launch again"):er.restore_interrupted_pull(root)+ # A real launch sees one line and exit 1, never a traceback (review C14).+ launch = subprocess.run(+ [sys.executable, "-c", "import sys; from pathlib import Path; from hermes_cli import _early_recovery as er; "+ "er._RESTORE_CLAIM_WAIT_SECONDS = 0.2; er.restore_interrupted_pull(Path(sys.argv[1]))", str(root)],+ cwd=Path(er.__file__).resolve().parent.parent, capture_output=True, text=True, encoding="utf-8",+ timeout=60)finally:er._lock_fd(fd, False)os.close(fd)+ assert launch.returncode == 1 and "Traceback" not in launch.stderr+ assert launch.stderr.strip().count("\n") == 0 and "launch again" in launch.stderrassert marker.exists() and _git(root, "rev-parse", "HEAD") == targetassert er.restore_interrupted_pull(root) is True # once the claim is free the repair runsassert _git(root, "rev-parse", "HEAD") == pre and not marker.exists()