Skip to content

The agent that grows with you

fix(update): recognize the git 2.55 partial-clone pack-objects crash

Q70b9cdafd4b0
diff --git a/hermes_cli/gitlock.py b/hermes_cli/gitlock.py
index 844a082c861..313d2feb80e 100644
--- a/hermes_cli/gitlock.py
+++ b/hermes_cli/gitlock.py
@@ -438,19 +438,24 @@ def fetch_full_commit_graph(repo_root: Path, *extra_refspecs: str, **run_kwargs)
# git 2.53+ promisor fetches run index-pack --promisor, whose repack_local_links() BUG()s in
# pack-objects (should_include_obj) when a local non-promisor object leads to a promisor-missing
# one (#124272). The state is left behind by the repo, so every fetch dies the same way; one fetch
-# with the promisor machinery disabled gets past it. POSIX builds end with "died of signal 6",
-# Windows builds with "could not finish pack-objects to repack local links".
-_PACK_OBJECTS_CRASH_MARKERS = ("BUG: builtin/pack-objects.c", "index-pack failed")
+# with the promisor machinery disabled gets past it. Only the assertion itself is version-stable,
+# so that is the fingerprint; the wrapper around it is not. git <= 2.54 reports the aborted helper
+# with "index-pack failed" — POSIX builds ending with "died of signal 6", Windows builds with
+# "could not finish pack-objects to repack local links" — but the 2.55 builds that dropped that
+# string end with "fetch-pack: invalid index-pack output" (#125138), so keying the fingerprint on
+# "index-pack failed" left those builds with no retry at all: the update simply exited 1.
+_PACK_OBJECTS_CRASH_FINGERPRINT = "should_include_obj should only be called on existing objects"
_PACK_OBJECTS_CRASH_TERMINATORS = (
"pack-objects died of signal 6",
"could not finish pack-objects to repack local links",
+ "fetch-pack: invalid index-pack output",
)
def is_partial_clone_pack_objects_crash(stderr: str) -> bool:
- """True when a fetch failure is the git 2.53/2.54 partial-clone pack-objects BUG (#124272)."""
+ """True when a fetch failure is the git 2.53+ partial-clone pack-objects BUG (#124272)."""
text = stderr or ""
- if not all(marker in text for marker in _PACK_OBJECTS_CRASH_MARKERS):
+ if _PACK_OBJECTS_CRASH_FINGERPRINT not in text:
return False
return any(terminator in text for terminator in _PACK_OBJECTS_CRASH_TERMINATORS)
diff --git a/tests/hermes_cli/test_gitlock.py b/tests/hermes_cli/test_gitlock.py
index 7dcd1cdb2d5..61c4685d7d2 100644
--- a/tests/hermes_cli/test_gitlock.py
+++ b/tests/hermes_cli/test_gitlock.py
@@ -148,6 +148,16 @@ _CRASH_STDERR_WINDOWS = (
"fatal: index-pack failed\n"
)
+# git 2.55 evidence (#125138): the builds that dropped "index-pack failed" report the
+# aborted helper as "fetch-pack: invalid index-pack output" instead — that string exists in
+# Homebrew git 2.55.0 while "index-pack failed" does not. Field report: macOS 27 + git 2.55.0
+# failed the update fetch on the bare assertion line and exited 1 without retrying, and a
+# plain re-run of `hermes update` right after succeeded.
+_CRASH_STDERR_GIT_255 = (
+ "BUG: builtin/pack-objects.c:5004: should_include_obj should only be called on existing objects\n"
+ "fatal: fetch-pack: invalid index-pack output\n"
+)
+
def test_crash_recognizer_rejects_unrelated_failures():
assert not is_partial_clone_pack_objects_crash(
@@ -157,11 +167,17 @@ def test_crash_recognizer_rejects_unrelated_failures():
assert not is_partial_clone_pack_objects_crash(
"BUG: builtin/pack-objects.c:4842: should_include_obj should only be called on existing objects\n"
"fatal: index-pack failed\n") # fingerprint without either terminator: not this crash
+ assert not is_partial_clone_pack_objects_crash(
+ "fatal: fetch-pack: invalid index-pack output\n") # 2.55 wrapper alone is not the crash
assert not is_partial_clone_pack_objects_crash("")
assert not is_partial_clone_pack_objects_crash(None)
[email protected]("crash_stderr", [_CRASH_STDERR, _CRASH_STDERR_WINDOWS], ids=["posix", "windows"])
+ "crash_stderr",
+ [_CRASH_STDERR, _CRASH_STDERR_WINDOWS, _CRASH_STDERR_GIT_255],
+ ids=["posix", "windows", "git-255"],
+)
def test_recovery_retries_once_with_promisor_disabled(crash_stderr):
calls = []