The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(update): recognize the Windows pack-objects crash stderr in the partial-clone recovery
Yuan Liffa8817345bf
diff --git a/hermes_cli/gitlock.py b/hermes_cli/gitlock.pyindex 3c42c5402e6..a7ea5f771aa 100644--- a/hermes_cli/gitlock.py+++ b/hermes_cli/gitlock.py@@ -452,15 +452,27 @@ def fetch_full_commit_graph(repo_root: Path, **run_kwargs) -> bool:_PACK_OBJECTS_CRASH_MARKERS = ("BUG: builtin/pack-objects.c",- "pack-objects died of signal 6","index-pack failed",)+# The BUG() assertion is the crash's fingerprint; how git then reports the abort+# differs per platform and git build. POSIX builds emit "pack-objects died of+# signal 6"; Windows builds (Git for Windows 2.54, #124293 field evidence)+# instead print a second fatal line from the repack ("could not finish+# pack-objects to repack local links") and no signal wording at all. Either+# terminator of the same BUG() counts — match the fingerprint plus one of them.+_PACK_OBJECTS_CRASH_TERMINATORS = (+ "pack-objects died of signal 6",+ "could not finish pack-objects to repack local links",+)+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)."""text = stderr or ""- return all(marker in text for marker in _PACK_OBJECTS_CRASH_MARKERS)+ if not all(marker in text for marker in _PACK_OBJECTS_CRASH_MARKERS):+ return False+ return any(terminator in text for terminator in _PACK_OBJECTS_CRASH_TERMINATORS)def fetch_with_partial_clone_recovery(runner: Callable[..., subprocess.CompletedProcess],diff --git a/tests/hermes_cli/test_gitlock.py b/tests/hermes_cli/test_gitlock.pyindex 06fc73edbf4..6fe8e2ba1a7 100644--- a/tests/hermes_cli/test_gitlock.py+++ b/tests/hermes_cli/test_gitlock.py@@ -139,16 +139,32 @@ _CRASH_STDERR = ("fatal: index-pack failed\n")+# Git for Windows 2.54 field evidence (#124293): no signal line — the BUG()+# assertion is followed directly by the repack fatal and index-pack failure.+_CRASH_STDERR_WINDOWS = (+ "remote: Enumerating objects: 12, done.\n"+ "BUG: builtin/pack-objects.c:4967: should_include_obj should only be called on existing objects\n"+ "fatal: could not finish pack-objects to repack local links\n"+ "fatal: index-pack failed\n"+)+def test_crash_recognizer_matches_reported_stderr():assert is_partial_clone_pack_objects_crash(_CRASH_STDERR)+def test_crash_recognizer_matches_windows_stderr_without_signal_wording():+ assert is_partial_clone_pack_objects_crash(_CRASH_STDERR_WINDOWS)++def test_crash_recognizer_rejects_unrelated_failures():assert not is_partial_clone_pack_objects_crash("fatal: Authentication failed for 'https://github.com/example.git'")assert not is_partial_clone_pack_objects_crash("error: pack-objects died of signal 6") # one marker alone is not the crash+ 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 crashassert not is_partial_clone_pack_objects_crash("")assert not is_partial_clone_pack_objects_crash(None)