fix(update): return to the user's feature branch after a successful update - #67884
Open
nickkpoon wants to merge 1 commit into
Open
fix(update): return to the user's feature branch after a successful update#67884nickkpoon wants to merge 1 commit into
nickkpoon wants to merge 1 commit into
Conversation
Collaborator
Related to closed #40673, which also addressed post-update feature-branch restoration. This is an active resubmission, not a duplicate of a closed PR. |
Contributor
|
Closing as duplicate |
Contributor
|
Thanks for addressing a real update-path asymmetry: current main still restores Problems
Suggested changes
Automated hermes-sweeper review. |
nickkpoon
force-pushed
the
fix/update-restore-feature-branch
branch
from
August 16, 2026 06:23
d33b578 to
1dc2399
Compare
Author
|
I have updated the PR to address the recent architectural changes and the sweeper feedback:
Everything is passing locally and the update flow is thoroughly tested. Ready for re-review! |
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.
Problem
hermes update's no-updates path politely switches back to whatever branch the user was on — but the successful-pull path leaves HEAD on the update target, silently dropping any local feature branch from the working tree.For editable/git installs this swaps the running code out from under the user. Real incident (2026-07-19): an update triggered mid-session moved a live install from a feature branch to stock
main; the gateway restarted seconds later on code the user never chose to run, and the features that branch carried broke with confusing provider errors. The asymmetry makes it worse: users learn from the no-op path that their branch is preserved, so the successful path's behavior is a surprise.Fix
After the pull succeeds (and before the dependency sync, so the venv is built against the tree that will actually run),
_restore_feature_branch_after_update:--autostash, since the flow may have just re-applied stashed local edits),Every failure mode falls back to today's behavior — staying on the target — with the branch left untouched and the manual recovery command printed: checkout failure, rebase conflict (aborted cleanly), or a rebased tree that can't bootstrap the CLI. The helper never raises; a branch-restore failure can't fail the update.
Tests
tests/hermes_cli/test_update_branch_restore.py— 6 tests on real throwaway git repos (no network): clean rebase + return, no-op on target/detached HEAD, conflict fallback (branch SHA untouched, no rebase-in-progress leftovers), syntax-guard fallback, dirty-tree autostash.🤖 Generated with Claude Code