Repository navigation
Conversation
…unnable The installer's update path stashes local changes, pulls, then `git stash apply`s them back. When that apply conflicts, git writes `<<<<<<< Updated upstream` markers into tracked source files. Both shell installers left those markers behind (install.sh `exit 1`, install.ps1 `throw`), bricking the checkout: a poisoned toolsets.py raises SyntaxError on import and the gateway never starts. Mirror the `hermes update` Python path (`_restore_stashed_changes`): detect a conflicting apply via a non-zero exit OR unmerged paths, then `git reset --hard HEAD` to restore the freshly-pulled tree while KEEPING the stash for manual recovery. The code update itself succeeded, so the install now completes with a runnable Hermes instead of aborting on a broken tree. Refs NousResearch#46791
…pdate path Reproduces the exact NousResearch#46791 poisoning (a conflicting `git stash apply` that writes `<<<<<<< Updated upstream` into toolsets.py) and asserts the tree self-heals: no conflict markers, content matches the pulled HEAD, the stash is preserved, and the install does not abort. Also covers the unchanged happy path (clean apply restores work and drops the stash) and an install.ps1 source-contract check. Refs NousResearch#46791
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
The repository stage of
scripts/install.shandscripts/install.ps1stasheslocal changes, pulls, then
git stash applys the user's work back on top. Whenthat apply conflicts, git writes
<<<<<<< Updated upstream/>>>>>>> Stashed changesmarkers into the tracked source files.Both shell installers left those markers behind on a conflicting apply
(
install.shexit 1,install.ps1throw), bricking the checkout. Apoisoned
toolsets.pythen raisesSyntaxErroron import and the gatewaynever starts — the exact symptom users hit after switching install methods:
The
hermes updatePython path (_restore_stashed_changes) already guardsthis: on a conflicting apply it
git reset --hard HEADto the freshly-pulledtree and keeps the stash for manual recovery. This brings the two shell
installers to parity — fixing the whole bug class across the sibling install
paths.
Changes
scripts/install.sh/scripts/install.ps1: aftergit stash apply,detect a conflict via a non-zero exit or unmerged paths
(
git diff --name-only --diff-filter=U). On conflict,git reset --hard HEADto restore a clean, runnable tree and keep the stash (neversilently drop the user's work, per the fix(update): stop stash/restore from clobbering desktop source on managed clones #38542 data-loss class). The code
update itself succeeded, so the install now completes with a runnable Hermes
instead of aborting on a poisoned tree.
install.shcaptures the apply exit code with|| apply_rc=$?so a failingapply doesn't trip
set -ebefore the cleanup runs.tests/test_install_stash_apply_conflict.py: reproduces the conflictingapply end-to-end and asserts the tree self-heals (no markers, content matches
HEAD, stash preserved, install doesn't abort), plus the unchanged clean-apply
happy path and an
install.ps1source-contract check.Verification
Scope
Narrowly targets the conflicting-
git stash apply-leaves-markers gap in theshell installers. Complementary to #47373 (recovery-marker / ref-verify
hardening), which does not clean the poisoned working tree on a conflicting
apply. Does not attempt the broader shared-resolver refactor, so it
intentionally does not auto-close #46791.
Refs #46791