fix: tolerate missing origin/main in Hermes setup#35
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Improves the robustness of the Hermes setup hook by preventing set -euo pipefail from aborting setup when origin/main is missing/unavailable during the auto-sync check, so Hermes can still generate a runtime config in repos without that remote-tracking ref.
Changes:
- Wraps the
git log HEAD..origin/mainsync-gap computation in anifso failures don’t terminate the script underset -e. - Emits a warning and continues with local code when
origin/maincan’t be queried, while preserving the existing pull behavior when a sync gap is detected.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+13
to
+16
| if sync_gap=$(git log --oneline HEAD..origin/main 2>/dev/null | wc -l | tr -d ' '); then | ||
| if [[ "$sync_gap" =~ ^[0-9]+$ && "$sync_gap" -gt 0 ]]; then | ||
| echo "[code-archaeology-sync] $sync_gap commit(s) behind origin/main — pulling..." | ||
| git pull origin main >/dev/null 2>&1 || echo "[code-archaeology-sync] WARN: git pull failed, continuing with local code" |
Maleick
added a commit
that referenced
this pull request
May 11, 2026
9805a6c to
c515271
Compare
c515271 to
6d76a20
Compare
|
🎉 This PR is included in version 2.7.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
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.
Motivation
hooks/hermes/setup.shruns underset -euo pipefail, and the new auto-sync block usedgit log HEAD..origin/mainin an assignment which can exit non-zero and abort setup whenorigin/mainis missing or unavailable.origin/mainremote-tracking ref still produce a valid runtime config.Description
hooks/hermes/setup.shauto-sync block to guard thegit logassignment with anifso a failinggit logdoes not cause the script to exit underset -euo pipefail.origin/mainis unavailable, while preserving the existinggit pull origin mainbehavior when a sync gap is detected.hooks/hermes/setup.shand the change is minimal and backward-compatible with previous behavior when remotes are present.Testing
./hooks/hermes/setup.shin a repo configuration withoutorigin/mainand verified it exits0and creates.archaeology/hermes-runtime.json(warning printed but setup completes).bash -n hooks/hermes/setup.shandbash -n hooks/hermes/*.shwhich succeeded.bash hooks/opencode/verify-phase.sh final_verifywhich runsnpm testandnpx tsc --noEmit, and all automated tests passed (38tests,0failures) and typecheck passed.git diff --checkand other repository script validations which reported no issues.Codex Task