Skip to content

The agent that grows with you

fix(update): a stable release older than the checkout reads as a rollback (#137714)

Tekniumbb122da09fc4
diff --git a/hermes_cli/source_check.py b/hermes_cli/source_check.py
index 67d265f76ad..c80a4970c0a 100644
--- a/hermes_cli/source_check.py
+++ b/hermes_cli/source_check.py
@@ -293,6 +293,10 @@ def _resolve_channel(result: dict, channel: str, co: _Checkout, *, forward_only:
# Forward-only pins the target to this checkout's own HEAD, newer than the release.
# Always present: Desktop names the release only on an explicit False.
result["aheadOfRelease"] = bool(getattr(source_target, "ahead", False))
+ # A release HEAD already contains moves the checkout back: Desktop names it a rollback,
+ # not a new update. Local ancestry only; an unknown relation stays an update.
+ result["rollback"] = bool(co.head and co.head != target and not co.embedded and _git_ok(
+ ["merge-base", "--is-ancestor", target, co.head], cwd=co.root, git=co.git))
if source_target.retired:
result["retirement"] = {"destination": source_target.channel, "sourceOnly": True}
return source_target
diff --git a/hermes_cli/update_cmd_check.py b/hermes_cli/update_cmd_check.py
index 9f256c5b694..5143ffe0c28 100644
--- a/hermes_cli/update_cmd_check.py
+++ b/hermes_cli/update_cmd_check.py
@@ -88,6 +88,10 @@ def channel_compare_branch(selected_channel: str, git_cmd: list[str], root: Path
print(f"✓ No newer release: {target.label}.")
elif _uc()._capture_head_sha(git_cmd, root) == target.commit:
print(f"✓ Up to date with the latest release ({target.label}).")
+ elif _git(git_cmd, root, ["merge-base", "--is-ancestor", target.commit, "HEAD"]).returncode == 0:
+ print(f"→ This checkout is newer than the selected release: {target.label}.")
+ print(" `hermes update` moves it back to that release"
+ " (`hermes update --set-channel main` follows every commit).")
else:
print(f"→ Selected release available: {target.label}")
print(" Run `hermes update` to install it.")