feat(update): add --release to pin tagged releases (#34514) - #34528
Open
hustshawn wants to merge 1 commit into
Open
feat(update): add --release to pin tagged releases (#34514)#34528hustshawn wants to merge 1 commit into
hustshawn wants to merge 1 commit into
Conversation
hermes update --release [TAG] pins the install to a release tag instead of tracking a branch tip. Bare --release (or --release latest) installs the newest vYYYY.M.D tag; --release <tag> pins an exact version. The tag is checked out as a detached HEAD so the pin survives across runs — fixing NousResearch#34514's complaint that pinned installs get forced back onto main. Reuses the existing post-pull syntax guard + rollback, skips the fork->upstream sync, and reports via --check --release. --release and --branch are mutually exclusive; the Windows ZIP fallback refuses it.
1 task
teknium1
reviewed
Jul 13, 2026
teknium1
left a comment
Contributor
There was a problem hiding this comment.
Thanks for implementing the explicit release-pin path. The underlying problem is still present on current main: a detached checkout is switched to the default update branch at hermes_cli/main.py:9633-9647, and tests/hermes_cli/test_update_autostash.py:625-639 covers that behavior.
Problems
hermes_cli/main.py:9232treats any descendant of the requested tag as already pinned. OnmainaftervX,merge-base --is-ancestor vX HEADsucceeds and returns before the proposed detached checkout, so--release vXcannot downgrade/pin exactly as documented.- The implementation targets an older update layout. Current
mainregisters the parser inhermes_cli/subcommands/update.py:12-76and the live flow has newer scoped-fetch, Windows, venv-health, and interrupted-install handling athermes_cli/main.py:9584-9978. - The public update docs would need the release behavior documented; current pages only document
--branch(website/docs/getting-started/updating.md:34-43,website/docs/reference/cli-commands.md:1542-1558).
Suggested changes
- Use exact HEAD/tag identity, not ancestry, for the already-pinned fast path.
- Rework the feature onto the current parser and update flow, then add descendant-of-tag and current-path coverage.
Automated hermes-sweeper review.
| # Already on (or ahead of) the requested release? A pinned | ||
| # checkout is its own ancestor, so re-running `--release <tag>` | ||
| # is correctly reported as up to date without touching the tree. | ||
| if _head_is_at_or_after(git_cmd, PROJECT_ROOT, target_tag): |
Contributor
There was a problem hiding this comment.
This ancestry check makes --release vX a no-op whenever HEAD is a descendant of vX (for example, main after that release). Exact pinning needs an identity comparison against the peeled tag target; otherwise the later detached checkout is skipped.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
hermes update --release [TAG]to pin an install to a tagged release instead of tracking a branch tip.hermes update --release/--release latest→ install the newestvYYYY.M.Dtaghermes update --release v2026.5.29→ pin to that exact taghermes update --check --release [TAG]→ report without installingFixes the core complaint in #34514 that a tag-pinned (detached-HEAD) install gets forced back onto
mainbyhermes update: when--releaseis used we skip the branch-switch entirely and land on the tag, and we never drag a pin forward toupstream/main.Relationship to #24938
This is complementary to @Sunwo0u's #24938 (opt-in
--channel {main,release}), not a replacement. That PR adds a "track the latest release" channel; this PR adds specific-tag pinning and the respect-the-pin / detached-HEAD behavior the issue asks for. The two can land independently or together — there's no overlap in flags (--channelvs--release).Behavior & safety
--releaseflag the code path is byte-for-byte the historical branch-tracking behavior. Default is unchanged.--releaseand--branchare mutually exclusive (clear error rather than silent precedence).--release(it can't honor a tag pin reliably), mirroring how it already refuses--branch=<non-main>.Implementation
_resolve_release_request,_latest_release_tag(version-sorted),_tag_exists,_head_is_at_or_after._cmd_update_impl: resolve the target tag after a--tagsfetch, skip branch-switch for pins,git checkout --detach <tag>, reuse the guard/rollback._cmd_update_check_releasefor the--check --releasereporting path.Test plan
python -m pytest tests/hermes_cli/test_cmd_update.py -q→ 30 passed (21 pre-existing + 9 new)test_update_autostash.py,test_update_yes_flag.py,test_cmd_update_docker.py,test_update_concurrent_quarantine.pyupdate --check --release→ "Already on release v2026.5.29"update --check --release v9999.1.1→ "Release tag 'v9999.1.1' not found"--release/--branchmutual exclusion.Refs #34514. Complements #24938.