The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(update): say when the syntax preflight is skipped on a slow object fetch; sort gateway_pause_failed
Teknium5e46b9591f82
diff --git a/hermes_cli/observability/shared_metrics_contract.py b/hermes_cli/observability/shared_metrics_contract.pyindex c370b4c6d44..28577365fb1 100644--- a/hermes_cli/observability/shared_metrics_contract.py+++ b/hermes_cli/observability/shared_metrics_contract.py@@ -497,10 +497,10 @@ UPDATE_STOP_CLASSES = frozenset({"disk_full", # (see above)"download_failed", # the ZIP fallback download failed"fetch_failed", # git fetch failed+ "gateway_pause_failed", # Windows: the gateways could not be paused safely before the venv moves"git_in_progress", # a merge/rebase/cherry-pick/... was already in progress"git_index_locked", # git refused: another git process's .git/index.lock exists"git_timeout", # a network git call hit the updater's time limit- "gateway_pause_failed", # Windows: the gateways could not be paused safely before the venv moves"head_moved", # a ref moved during the update; HEAD is not the selected commit"local_changes_blocked", # local changes git could not stash, or a dirty tree the ZIP will not overwrite"lock_held", # (see above)diff --git a/hermes_cli/update_cmd_commit.py b/hermes_cli/update_cmd_commit.pyindex f2af0edee18..e7592a2c5ed 100644--- a/hermes_cli/update_cmd_commit.py+++ b/hermes_cli/update_cmd_commit.py@@ -497,12 +497,7 @@ def read_target_files(git_cmd, root: Path, target_ref: str, relpaths) -> dict[stnames = list(dict.fromkeys(relpaths))found: dict[str, bytes | None] = dict.fromkeys(names)request = "".join(f"{target_ref}:{rel}\n" for rel in names).encode("utf-8")- try:- cp = run_git(git_cmd, ["cat-file", "--batch"], cwd=str(root), input=request, capture_output=True, timeout=120)- except subprocess.TimeoutExpired:- # A blobless install (install.sh clones --filter=blob:none) lazily fetches each changed blob- # in its own round trip; on a slow link that outlasts the limit. Unread, like an absent file.- return found+ cp = run_git(git_cmd, ["cat-file", "--batch"], cwd=str(root), input=request, capture_output=True, timeout=120)out, pos = (cp.stdout or b"") if cp.returncode == 0 else b"", 0for rel in names:end = out.find(b"\n", pos)@@ -525,7 +520,13 @@ def target_syntax_error(git_cmd, root: Path, target_ref: str, relpaths) -> tuple``startup_syntax_error`` judges it under the interpreter the target admits. A file absent at thetarget (or unreadable) is skipped: the post-pull guard has the last word."""- files = read_target_files(git_cmd, root, target_ref, ["pyproject.toml", *relpaths])+ try:+ files = read_target_files(git_cmd, root, target_ref, ["pyproject.toml", *relpaths])+ except subprocess.TimeoutExpired:+ # A blobless install (install.sh clones --filter=blob:none) lazily fetches each changed blob+ # in its own round trip; on a slow link that outlasts the limit. Unread, like an absent file.+ print(" ⚠ Syntax preflight skipped (slow object fetch); the post-update check still runs.")+ return Nonepyproject = files.pop("pyproject.toml", None)return startup_syntax_error(files, pyproject)diff --git a/tests/hermes_cli/test_shared_metrics_update_stop_reasons.py b/tests/hermes_cli/test_shared_metrics_update_stop_reasons.pyindex 478f4c9a589..faec44ce8e7 100644--- a/tests/hermes_cli/test_shared_metrics_update_stop_reasons.py+++ b/tests/hermes_cli/test_shared_metrics_update_stop_reasons.py@@ -281,7 +281,7 @@ def test_an_exception_before_the_apply_names_its_exit_through_the_command_boundaassert contract.counter_dimensions_are_valid(contract.UPDATE_RUN_METRIC, run)-def test_a_timed_out_target_read_skips_the_preflight_instead_of_failing_the_update(monkeypatch):+def test_a_timed_out_target_read_skips_the_preflight_instead_of_failing_the_update(monkeypatch, capsys):"""Invariant: the startup-syntax preflight reads the target from git's object store; a read thattimes out (a blobless install lazily fetches each blob) is an unread file, never an exceptionthat ends the update as ``subprocess_failed``. The post-move syntax check stays the backstop."""@@ -296,6 +296,7 @@ def test_a_timed_out_target_read_skips_the_preflight_instead_of_failing_the_updamonkeypatch.setattr(update_cmd_commit, "run_git", slow)assert update_cmd_commit.target_syntax_error(["git"], Path("."), "a" * 40, ["cli.py", "run_agent.py"]) is None+ assert "Syntax preflight skipped (slow object fetch)" in capsys.readouterr().out@pytest.mark.parametrize("consent", ["on", "off"])