The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
refactor(update): move the channel-release hold next to select_apply_target
unsupportedpastels40bf5044a311
diff --git a/hermes_cli/update_cmd.py b/hermes_cli/update_cmd.pyindex 1def7127dad..95ecd69211b 100644--- a/hermes_cli/update_cmd.py+++ b/hermes_cli/update_cmd.py@@ -1261,27 +1261,6 @@ def _switch_branch_at_commit_point(git_cmd, branch, target_ref, *, pre, stash):return result-def _hold_channel_release_behind_runtime(git_cmd, target_ref: str, channel: str) -> str | None:- """HEAD's sha when the channel's release predates the gateway runtime these stores use, else None.-- The channel picked the release, the user did not ask for that commit: moving there is the- refused downgrade, so the update stays where it is and says why (#140729). An explicit- ``--branch`` never reaches here and keeps the refusal in ``_refuse_before_commit_point``.- """- from hermes_cli.update_downgrade_guard import downgrade_refusal- if downgrade_refusal(git_cmd, _m().PROJECT_ROOT, target_ref) is None:- return None- head = _capture_head_sha(git_cmd, _m().PROJECT_ROOT)- if not head:- return None # HEAD unreadable: the refusal below still stops the move- # "newer", not "ahead": the release may sit beside HEAD's line rather than behind it (#140729).- print(f"→ This build is newer than the {channel} release {target_ref[:12]}: that release predates the "- "gateway runtime your sessions use, so there is nothing to update to yet.")- print(f" Hermes stays on {head[:12]} until a newer {channel} release ships. "- "To follow every commit instead: `hermes update --set-channel main`.")- return head--def _refuse_before_commit_point(git_cmd, target_ref, _windows_gateway_resume) -> None:"""Preconditions that used to fail AFTER the swap: refuse with the install untouched."""reason = _commit.preflight_refusal(git_cmd, _m().PROJECT_ROOT, target_ref, _UPDATE_CRITICAL_FILES)@@ -1949,7 +1928,7 @@ def _cmd_update_impl(args, gateway_mode: bool):held_message = Noneif release_sha and not target_is_head:channel = _update_run_channel(args)- held = _hold_channel_release_behind_runtime(git_cmd, target_ref, channel)+ held = _check.hold_channel_release_behind_runtime(git_cmd, target_ref, channel)if held:target_ref = heldheld_message = f"✓ Holding at this build until a newer {channel} release ships."diff --git a/hermes_cli/update_cmd_check.py b/hermes_cli/update_cmd_check.pyindex f15ed5be733..6f73bb67908 100644--- a/hermes_cli/update_cmd_check.py+++ b/hermes_cli/update_cmd_check.py@@ -261,3 +261,24 @@ def select_apply_target(args, branch: str, request: dict, *, git_cmd, stop) -> tassert target.branch is not None # a SourceTarget without a commit names its branchrequest["branch"] = target.branchreturn f"origin/{target.branch}", None, False, target.repository+++def hold_channel_release_behind_runtime(git_cmd, target_ref: str, channel: str) -> str | None:+ """HEAD's sha when the channel's release predates the gateway runtime these stores use, else None.++ The channel picked the release, the user did not ask for that commit: moving there is the+ refused downgrade, so the update stays where it is and says why (#140729). An explicit+ ``--branch`` never reaches here and keeps the refusal in ``update_cmd._refuse_before_commit_point``.+ """+ from hermes_cli.update_downgrade_guard import downgrade_refusal+ if downgrade_refusal(git_cmd, _uc()._m().PROJECT_ROOT, target_ref) is None:+ return None+ head = _uc()._capture_head_sha(git_cmd, _uc()._m().PROJECT_ROOT)+ if not head:+ return None # HEAD unreadable: the caller's refusal still stops the move+ # "newer", not "ahead": the release may sit beside HEAD's line rather than behind it (#140729).+ print(f"→ This build is newer than the {channel} release {target_ref[:12]}: that release predates the "+ "gateway runtime your sessions use, so there is nothing to update to yet.")+ print(f" Hermes stays on {head[:12]} until a newer {channel} release ships. "+ "To follow every commit instead: `hermes update --set-channel main`.")+ return head