fix: abort conflicted upstream-sync merge so update never leaves a broken tree#136
Merged
Merged
Conversation
…oken tree When the fork upstream sync in _sync_with_upstream_if_needed hit a merge conflict it printed 'Skipping upstream sync' but returned with the merge still in progress. The working tree kept conflict markers in critical files (hermes_cli/main.py, apps/desktop/package.json), making the CLI unbootable and failing every later update stage: npm install, web UI build, and the desktop rebuild — surfacing as the desktop 'Update didn't finish' screen (2026-06-10 incident). Now a failed merge is aborted (when MERGE_HEAD confirms one started) before the sync is skipped, and the user-facing message reports whether the tree was restored. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Why
The 2026-06-10 in-app update on this fork failed at the rebuild stage with "Update didn't finish". Root cause: the fork upstream sync in
_sync_with_upstream_if_neededmergedupstream/maininto localmain, hit conflicts (fork is 57 ahead / 85 behind), printed "Skipping upstream sync" — and returned without aborting the merge. The tree was left mid-merge with conflict markers in 25 files, includinghermes_cli/main.py(SyntaxError at line 471 on<<<<<<< HEAD, makinghermesitself unbootable) andapps/desktop/package.json(npmEJSONPARSE), so npm install, the web UI build, and the desktop rebuild all failed.The existing post-pull syntax guard only protects the
git pullstep; the upstream-sync merge runs after it, unguarded.What changed
hermes_cli/main.py: on merge failure, verify a merge actually started (git rev-parse -q --verify MERGE_HEAD) and rungit merge --abortto restore a clean tree before skipping the sync. The message now reports whether the tree was restored, or warns with agit statushint if the abort itself failed.tests/hermes_cli/test_update_fork_sync_conflict_abort.py(new): scripted-git tests covering conflicted-merge-aborts-and-restores, failed-abort-warns, and merge-error-without-MERGE_HEAD-skips-abort.Evidence
PYTHONPATH=$PWD venv/python -m pytest tests/hermes_cli/test_update_fork_sync_conflict_abort.py tests/hermes_cli/test_update_post_pull_syntax_guard.py tests/hermes_cli/test_cmd_update.py -q→ 36 passed (3 new + 33 existing).~/.hermes/logs/bootstrap-installer.log):✗ Merge failed (conflict). Skipping upstream sync.followed bySyntaxError: invalid syntaxatmain.py:471 <<<<<<< HEADandnpm error code EJSONPARSEinapps/desktop/package.json.git merge --abortreturned the tree to fork main andpy_compile+JSON.parseboth pass again.Risks
git merge --abortis skipped when noMERGE_HEADexists (e.g. merge refused before starting), so the warning can't fire spuriously.