The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(update): the release tag fetch is best-effort and never moves a local tag
Teknium565eee701404
diff --git a/hermes_cli/update_cmd.py b/hermes_cli/update_cmd.pyindex 6ebf3b914fa..ab539d58cfa 100644--- a/hermes_cli/update_cmd.py+++ b/hermes_cli/update_cmd.py@@ -1906,7 +1906,7 @@ def _cmd_update_impl(args, gateway_mode: bool):# Forward-only default: the checkout already contains the release; nothing to fetch.fetch_args = Noneelif release_sha:- fetch_args = _check.release_fetch_args(target_ref, completion_request)+ fetch_args = ["fetch", "--no-tags", "origin", target_ref]else:fetch_args = ["fetch", "origin", _check.tracking_refspec("origin", branch)]from hermes_cli.gitlock import fetch_with_partial_clone_recovery, is_partial_clone_pack_objects_crash@@ -1927,6 +1927,7 @@ def _cmd_update_impl(args, gateway_mode: bool):if "No space left on device" in (fetch_result.stderr or "") else "fetch_failed")sys.exit(1)+ _check.fetch_release_tag(git_cmd, _m().PROJECT_ROOT, completion_request)current_branch = _current_branch_name(git_cmd, check=True)_commit.record_run_start(git_cmd, _m().PROJECT_ROOT)held_message = Nonediff --git a/hermes_cli/update_cmd_check.py b/hermes_cli/update_cmd_check.pyindex 2ca2372f671..8c10145d77b 100644--- a/hermes_cli/update_cmd_check.py+++ b/hermes_cli/update_cmd_check.py@@ -271,16 +271,26 @@ def select_apply_target(args, branch: str, request: dict, *, git_cmd, stop) -> treturn f"origin/{target.branch}", None, False, target.repository-def release_fetch_args(target_ref: str, request: dict) -> list[str]:- """Fetch a pinned release commit together with its own release tag.+def fetch_release_tag(git_cmd: list[str], root: Path, request: dict) -> None:+ """Fetch a pinned release's own tag when this checkout lacks it.The checkout's version is the newest release tag merged into HEAD (version_info), so a- tagless fetch moved HEAD to vX.Y.Z while every reader -- /health, the install stamp, the- receipt, About -- still named the previous release (#143656). Only that one tag: other- tags would drag their histories into a shallow checkout.+ tagless release fetch moved HEAD to vX.Y.Z while every reader -- /health, the install+ stamp, the receipt, About -- still named the previous release (#143656). Best effort and+ create-only: a fork or mirror without the tag still updates, and an existing local tag+ never moves (the stable pin contract). Only that one tag: others drag in their histories."""+ from hermes_cli._subprocess_compat import no_prompt_git_kwargs+ from hermes_cli.update_cmd import NETWORK_GIT_TIMEOUT_SECONDS+tag = request.get("release_tag")- return ["fetch", "--no-tags", "origin", target_ref, *([f"+refs/tags/{tag}:refs/tags/{tag}"] if tag else [])]+ if not tag or _git(git_cmd, root, ["rev-parse", "--verify", "--quiet", f"refs/tags/{tag}"]).returncode == 0:+ return+ try:+ _git(git_cmd, root, ["fetch", "--no-tags", "origin", f"refs/tags/{tag}:refs/tags/{tag}"],+ timeout=NETWORK_GIT_TIMEOUT_SECONDS, **no_prompt_git_kwargs())+ except (OSError, subprocess.SubprocessError):+ passdef hold_channel_release_behind_runtime(git_cmd, target_ref: str, channel: str) -> str | None:diff --git a/tests/hermes_cli/test_update_release_tag_fetch.py b/tests/hermes_cli/test_update_release_tag_fetch.pyindex 59f32a5bae1..4be95a82f12 100644--- a/tests/hermes_cli/test_update_release_tag_fetch.py+++ b/tests/hermes_cli/test_update_release_tag_fetch.py@@ -41,7 +41,8 @@ def test_stable_update_fetch_brings_the_release_tag(tmp_path, monkeypatch):target_ref, _sha, _is_head, _repo = update_cmd_check.select_apply_target(SimpleNamespace(branch=None), "main", request, git_cmd=["git"], stop=lambda: None)- _git(checkout, *update_cmd_check.release_fetch_args(target_ref, request))+ _git(checkout, "fetch", "--no-tags", "origin", target_ref)+ update_cmd_check.fetch_release_tag(["git"], checkout, request)_git(checkout, "merge", "-q", "--ff-only", release)info = _git_version_info(checkout)