Conversation
…not a rewrite hermes update assumed any `merge --ff-only origin/<branch>` failure while already on <branch> meant an upstream force-push, and reset --hard to match — discarding local history unconditionally. That's also exactly what happens when local simply has commits origin doesn't have yet (e.g. a host-ops fix committed directly to a live checkout instead of through a PR). Live incident 2026-08-23: a reviewed, tested host-hygiene fix was silently wiped this way when origin/main next advanced normally. Distinguish the two cases with a merge-base ancestry check against the origin tip captured before the fetch: if that old tip is still an ancestor of the new one, origin only moved forward — merge, never reset. Only fall through to reset --hard on a genuine rewrite (old tip no longer reachable) or when there's no prior tip to compare against (unchanged, safe-by-default behavior). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Author
|
Flagging urgency: without this fix, any local-only deploy commit on a live checkout is one |
Author
|
Closing — same as #93498, pushed upstream by mistake. Meant for local use only. |
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
hermes updatetreated anygit merge --ff-only origin/<branch>failure — while already checked out on<branch>— as proof of an upstream force-push, and unconditionally rangit reset --hard origin/<branch>to recover. That's also exactly what happens when the local checkout simply has commits origin doesn't have yet (e.g. a fix committed directly to a live deployment checkout instead of through a PR):merge --ff-onlyfails identically in both cases.Live incident, 2026-08-23: a reviewed and tested host-hygiene fix (see companion PR) was committed directly onto a live checkout's
main. Origin'smainlater advanced normally (unrelated commits, no rewrite). The nexthermes updatehit the ff-only failure, assumed a force-push, andreset --hardsilently discarded the commit — no warning, no stash, no trace.merge --no-edit, abort-and-report cleanly on conflict — never destroy local commits).reset --hardbehavior is unchanged.Test plan
New
tests/hermes_cli/test_update_local_commit_preservation.py, using real throwaway git repos (no mocking of the ancestry logic itself):git commit --amendhistory rewrite is still correctly detected and still resetsAll 3 pass. Note: exercising the surrounding
hermes updateflow for validation surfaced that this codebase's existingtest_cmd_update.py/test_update_autostash.pysuites aren't fully isolated from a live install's real gateway processes when run in-place — pre-existing test-hygiene gap, unrelated to this change, not addressed here.🤖 Generated with Claude Code