The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(install): clone blobless, convert treeless checkouts once
Teknium1d9bb51f6bd5
diff --git a/hermes_cli/gitlock.py b/hermes_cli/gitlock.pyindex 4d4b28cf98b..2161ee79022 100644--- a/hermes_cli/gitlock.py+++ b/hermes_cli/gitlock.py@@ -533,10 +533,11 @@ def fetch_full_commit_graph(repo_root: Path, *extra_refspecs: str, **run_kwargs)replacing existing tags. The fetch never changes the clone's mode: ``--filter`` makes gitwrite ``remote.origin.promisor``/``partialclonefilter``, so a full clone fetches unfiltered(#122353) and a partial clone repeats its own filter. The one conversion is deliberate: a- depth-limited full clone whose history is really missing unshallows as ``tree:0``, because an- unfiltered ``--unshallow`` downloads the whole project history; a full clone grafted by a+ depth-limited full clone whose history is really missing unshallows as a partial clone, because+ an unfiltered ``--unshallow`` downloads every file version ever committed; a full clone grafted by a``--depth`` fetch already has its history and stays full. The converted clone's existing packsare marked as partial-clone packs, or every later fetch crashes on git 2.53+ (#124272).+ It converts to ``blob:none``, the layout installers make (see ``convert_treeless_checkout``).Returns whether the checkout was unshallowed; fetch failures raise subprocess errors."""shallow_path = _shallow_file_path(repo_root)@@ -549,7 +550,7 @@ def fetch_full_commit_graph(repo_root: Path, *extra_refspecs: str, **run_kwargs)converts = fetch_filter is None and shallow and bool(_batch_missing_parents(repo_root, shallow_path.read_text(encoding="utf-8-sig").split()))if converts:- fetch_filter = "tree:0"+ fetch_filter = "blob:none"try:subprocess.run(["git", "fetch", "--quiet", *(["--unshallow"] if shallow else []),@@ -608,6 +609,34 @@ def fetch_with_partial_clone_recovery(runner: Callable[..., subprocess.Completedreturn runner(git_cmd, fetch_args)+def convert_treeless_checkout(repo_root: Path, **run_kwargs) -> bool:+ """Turn a treeless (``tree:0``) checkout into the blobless layout installers now make (#129712).++ A treeless checkout holds no trees, and git asks for a missing tree without telling the server+ which ones it already has, so every checkout and path-filtered history walk downloads complete+ directory snapshots again: hundreds of GB on some installs. One ``--refetch`` of the clone's+ own refspec brings every commit and tree (about 120 MB for this repo); file contents stay on+ demand. A+ failed refetch leaves the checkout treeless, so the next update retries. Returns whether it+ converted; fetch failures raise subprocess errors.+ """+ run_kwargs["creationflags"] = run_kwargs.get("creationflags", 0) | windows_hide_flags()+ if _partial_clone_filter(repo_root, **run_kwargs) != "tree:0":+ return False+ subprocess.run(+ ["git", "fetch", "--quiet", "--refetch", "--filter=blob:none", "--no-tags", "origin"],+ cwd=str(repo_root), check=True, capture_output=True, text=True,+ encoding="utf-8", errors="replace", timeout=900, **run_kwargs,+ )+ # A refetch into an existing partial clone leaves its configured filter alone; record the+ # new one only now, so a failed or interrupted refetch is retried by the next update.+ subprocess.run(+ ["git", "config", "remote.origin.partialclonefilter", "blob:none"],+ cwd=str(repo_root), check=True, capture_output=True, timeout=30, **run_kwargs,+ )+ return True++def settle_partial_clone_maintenance(repo_root: Path) -> None:"""Persist the commit-graph-off keys on a partial clone; a full clone keeps stock maintenance.diff --git a/hermes_cli/update_cmd_fleet_checkout.py b/hermes_cli/update_cmd_fleet_checkout.pyindex b67b40d4e14..e613b5a4b4c 100644--- a/hermes_cli/update_cmd_fleet_checkout.py+++ b/hermes_cli/update_cmd_fleet_checkout.py@@ -10,6 +10,8 @@ from __future__ import annotationsimport loggingimport subprocess+from hermes_cli._subprocess_compat import NO_LAZY_FETCH_ENV, noninteractive_git_env+logger = logging.getLogger(__name__)@@ -35,6 +37,9 @@ def checkout_contains(sha: str) -> bool:result = subprocess.run(["git", "merge-base", "--is-ancestor", sha, "HEAD"],cwd=_m().PROJECT_ROOT, capture_output=True, text=True, encoding="utf-8", errors="replace", timeout=10,+ # A SHA this checkout lacks is not contained; asking the promisor remote for it would+ # download that commit's entire history (on-demand fetches send no "have" lines).+ env={**noninteractive_git_env(), **NO_LAZY_FETCH_ENV},)return result.returncode == 0except Exception as exc:diff --git a/hermes_cli/update_cmd_maint.py b/hermes_cli/update_cmd_maint.pyindex 193ac25e27a..3ec8d6fa931 100644--- a/hermes_cli/update_cmd_maint.py+++ b/hermes_cli/update_cmd_maint.py@@ -1004,6 +1004,15 @@ def _run_post_update_maintenance(# Both shallow history and missing tags can hide the release identity.# Refresh them before the completion line and install stamp read it.+ try:+ from hermes_cli.gitlock import convert_treeless_checkout+ from hermes_cli.update_cmd import _no_prompt_git_kwargs+ if convert_treeless_checkout(Path(_m().PROJECT_ROOT), **_no_prompt_git_kwargs()):+ print(" ✓ Fetched this checkout's directory history once; updates stop re-downloading it")+ except (OSError, subprocess.SubprocessError) as exc:+ detail = (getattr(exc, "stderr", None) or str(exc)).strip().splitlines()[-1:] or [type(exc).__name__]+ print(f" ⚠ Could not fetch this checkout's directory history ({detail[0]}); retrying next update")+try:from hermes_cli.gitlock import fetch_full_commit_graphfrom hermes_cli.update_cmd import _no_prompt_git_kwargsdiff --git a/scripts/install.ps1 b/scripts/install.ps1index 1f7d3d95718..4bf466b8855 100644--- a/scripts/install.ps1+++ b/scripts/install.ps1@@ -902,13 +902,14 @@ function Stage-Repository {try {$cloned = $falseforeach ($attempt in 1..3) {- # Treeless: every commit and release tag (runtime identity is the- # nearest reachable release; -Commit pins and branch switches- # still resolve), trees and blobs fetched on demand, so the- # download stays close to a --depth 1 clone.+ # Blobless: every commit, tree and release tag (runtime identity is+ # the nearest reachable release; -Commit pins and branch switches+ # still resolve), file contents fetched on demand. Not treeless:+ # a long-lived treeless checkout re-downloads whole trees on every+ # checkout and history walk (#129712).$cloneLabel = "Cloning $RepoUrl ($Branch) into $InstallDir"if ($attempt -gt 1) { $cloneLabel += " (attempt $attempt of 3)" }- Invoke-Logged $cloneLabel { git clone @progress --filter=tree:0 --branch $Branch $RepoUrl $tree }+ Invoke-Logged $cloneLabel { git clone @progress --filter=blob:none --branch $Branch $RepoUrl $tree }if (-not $LASTEXITCODE) { $cloned = $true; break }Remove-Item -LiteralPath $tree -Recurse -Force -ErrorAction SilentlyContinueif ($attempt -lt 3) { Start-Sleep -Seconds ($attempt * 5) }@@ -917,7 +918,7 @@ function Stage-Repository {# The checkout step is where throttled downloads die: clone the# graph alone, then retry materializing the tree separately.Write-Warn "direct clone failed; trying deferred checkout"- Invoke-Logged "Cloning history" { git clone @progress --filter=tree:0 --no-checkout --branch $Branch $RepoUrl $tree }+ Invoke-Logged "Cloning history" { git clone @progress --filter=blob:none --no-checkout --branch $Branch $RepoUrl $tree }if (-not $LASTEXITCODE) {foreach ($attempt in 1..2) {Invoke-Logged "Checking out files (attempt $attempt of 2)" { git -C $tree reset --hard HEAD }diff --git a/scripts/install.sh b/scripts/install.shindex 13497c91fb0..f94810df467 100755--- a/scripts/install.sh+++ b/scripts/install.sh@@ -568,14 +568,15 @@ stage_repository() {if quiet_output; then progress=(--progress); fistaged="$(mktemp -d "$(dirname "$INSTALL_DIR")/.hermes-clone-XXXXXX")" || fail "cannot stage clone"for attempt in 1 2 3; do- # Treeless: every commit and release tag (runtime identity is the- # nearest reachable release; --commit pins and branch switches- # still resolve), trees and blobs fetched on demand, so the- # download stays close to a --depth 1 clone.+ # Blobless: every commit, tree and release tag (runtime identity is+ # the nearest reachable release; --commit pins and branch switches+ # still resolve), file contents fetched on demand. Not treeless:+ # a long-lived treeless checkout re-downloads whole trees on every+ # checkout and history walk (#129712).label="Cloning $REPO_URL ($BRANCH) into $INSTALL_DIR"[ "$attempt" = 1 ] || label="$label (attempt $attempt of 3)"if run_logged "$label" git clone ${progress[@]+"${progress[@]}"} \- --filter=tree:0 --branch "$BRANCH" "$REPO_URL" "$staged/tree"; then+ --filter=blob:none --branch "$BRANCH" "$REPO_URL" "$staged/tree"; thencloned=truebreakfi@@ -587,7 +588,7 @@ stage_repository() {# graph alone, then retry materializing the tree separately.log_warn "direct clone failed; trying deferred checkout"if run_logged "Cloning history" git clone ${progress[@]+"${progress[@]}"} \- --filter=tree:0 --no-checkout --branch "$BRANCH" "$REPO_URL" "$staged/tree"; then+ --filter=blob:none --no-checkout --branch "$BRANCH" "$REPO_URL" "$staged/tree"; thenfor attempt in 1 2; doif run_logged "Checking out files (attempt $attempt of 2)" \git -C "$staged/tree" reset --hard HEAD; thendiff --git a/tests/e2e/core/upgrade/git/_git_world.py b/tests/e2e/core/upgrade/git/_git_world.pyindex d72b2de05f8..2759e8928fa 100644--- a/tests/e2e/core/upgrade/git/_git_world.py+++ b/tests/e2e/core/upgrade/git/_git_world.py@@ -4,7 +4,7 @@git wrapper that reports the official remote URL) whose ``~/.gitconfig`` rewrites the officialGitHub URL to a loopback ``git http-backend`` origin (``_smart_http``). The install itself comesfrom a real ``scripts/install.sh``: N-1's own copy for an N-1 install (it makes the depth-1-single-branch clone N-1 users have), HEAD's for a HEAD install (a ``--filter=tree:0`` clone).+single-branch clone N-1 users have), HEAD's for a HEAD install (a ``--filter=blob:none`` clone).``preclone`` seeds a checkout the installer then adopts, for the clone shapes users got anotherway (a manual full clone, a ``blob:none`` fallback clone).diff --git a/tests/e2e/core/upgrade/git/test_partial_clone.py b/tests/e2e/core/upgrade/git/test_partial_clone.pyindex 445e138a6d1..7d6fd7c40f1 100644--- a/tests/e2e/core/upgrade/git/test_partial_clone.py+++ b/tests/e2e/core/upgrade/git/test_partial_clone.py@@ -1,13 +1,14 @@"""Partial and full clones updated N-1 -> HEAD -> next release through the real ``hermes update``.-Users' checkouts come in several shapes: HEAD's installer makes a ``--filter=tree:0`` clone, its-throttled fallback a ``--filter=blob:none`` clone, and plenty of users cloned the repository+Users' checkouts come in several shapes: HEAD's installer makes a ``--filter=blob:none`` clone,+installers from late Sep 2026 made ``--filter=tree:0`` ones, and plenty of users cloned the repositorythemselves (a full clone). Each shape is seeded as that clone of N-1 over smart HTTP, adopted byN-1's own ``scripts/install.sh``, then updated twice: to HEAD (N-1's updater hands off to HEAD's),and to one more upstream release (HEAD's updater end to end). The three installs run concurrently.Property: both updates land and the install runs, and the clone keeps its shape: a partial clone-keeps its filter, and a full clone stays full. Converting a full clone to ``tree:0`` re-arms the+keeps its filter, and a full clone stays full. The one conversion is treeless -> blobless (#129712):+a treeless checkout re-downloads whole directory snapshots on every checkout. Converting a full clone to ``tree:0`` re-arms the``pack-objects ... should_include_obj`` fetch crash for every later update (#124272, #124323)."""@@ -55,14 +56,15 @@ def test_updates_land_and_the_clone_keeps_its_shape(runs, shape):raise runw: G.World = run["w"]cp1, cp2 = run["cp1"], run["cp2"]+ expected = {**run["shape0"], "filter": "blob:none"} if shape == "tree0" else run["shape0"]assert run["shape0"]["shallow"] == "false" and (shape == "full") == (run["shape0"]["filter"] == "-"), \f"seeded the wrong clone shape for {shape}: {run['shape0']}"assert cp1.returncode == 0 and run["head1"] == I.head_sha(), f"N-1 -> HEAD update failed:\n{w.diag(cp1)}"assert G.TRACEBACK not in G.output(cp1), f"N-1 -> HEAD update printed a traceback:\n{w.diag(cp1)}"- assert run["shape1"] == run["shape0"], (+ assert run["shape1"] == expected, (f"{'the full clone was converted to a partial clone' if shape == 'full' else 'the clone changed shape'} "- f"by the N-1 -> HEAD update: {run['shape0']} -> {run['shape1']}\n{w.diag(cp1)}")+ f"by the N-1 -> HEAD update: {run['shape0']} -> {run['shape1']} (expected {expected})\n{w.diag(cp1)}")assert cp2.returncode == 0 and run["head2"] == run["target2"], f"HEAD -> next update failed:\n{w.diag(cp2)}"- assert run["shape2"] == run["shape0"], f"the clone changed shape: {run['shape0']} -> {run['shape2']}\n{w.diag(cp2)}"+ assert run["shape2"] == expected, f"the clone changed shape: {expected} -> {run['shape2']}\n{w.diag(cp2)}"version = run["version"]assert version.returncode == 0 and G.TRACEBACK not in G.output(version), w.diag(version)diff --git a/tests/e2e/core/upgrade/git/test_truthful_outcome.py b/tests/e2e/core/upgrade/git/test_truthful_outcome.pyindex f2fbab353d2..bedfef39d6b 100644--- a/tests/e2e/core/upgrade/git/test_truthful_outcome.py+++ b/tests/e2e/core/upgrade/git/test_truthful_outcome.py@@ -2,8 +2,8 @@The origin is a real smart-HTTP ``git http-backend``; faults are injected at the HTTP layer, whereGitHub's own failures happen: 429 rate limiting, 5xx on the ref advertisement or the fetch, a-connection dropped mid-pack, and a drop during the promisor lazy fetch that a ``--filter=tree:0``-install makes while checking out the new release. One HEAD install is shared by the cells.+connection dropped mid-pack, and a drop during the promisor lazy fetch that a partial-clone install+makes for the new release's file contents while checking it out. One HEAD install is shared by the cells.Property: a failed transfer is a non-zero exit with no success banner and no success receipt; theinstall is left runnable on the commit it had, with a clean tree, and no false diagnosis. Once the@@ -13,6 +13,7 @@ a pathological amount (a byte bound against a clean update of the same shape, nefrom __future__ import annotations+import base64import osimport time@@ -29,11 +30,16 @@ FAULTS = {"502-on-ref-advertisement": lambda: Fault(status=502, path_has="info/refs", times=99),"503-on-ls-refs": lambda: Fault(status=503, command="ls-refs", times=99),"cut-mid-pack": lambda: Fault(cut_after=150, command="fetch", times=99),- # The commits arrive; the trees/blobs the tree:0 checkout then lazy-fetches are cut off.+ # The commits and trees arrive; the blobs the checkout then lazy-fetches are cut off."cut-mid-checkout-lazy-fetch": lambda: Fault(cut_after=20000, command="fetch", skip=1, times=99),}+def _release_file() -> str:+ """Incompressible contents, so the checkout's lazy blob fetch outlasts the 20 KB cut."""+ return base64.b64encode(os.urandom(96 * 1024)).decode() + "\n"++@pytest.fixture(scope="module")def w(tmp_path_factory):with G.world(tmp_path_factory.mktemp("git-truthful"), base=I.head_sha()) as world:@@ -58,7 +64,7 @@ def test_transport_failure_is_reported_as_failure(w, fault):w.reset_clean()w.srv.clear_faults()before = w.head()- w.publish(f"release: e2e truthful {fault}", {f"e2e-truthful-{fault}.txt": "release\n"})+ w.publish(f"release: e2e truthful {fault}", {f"e2e-truthful-{fault}.txt": _release_file()})armed = w.srv.arm(FAULTS[fault]())mark = w.srv.mark()@@ -75,14 +81,14 @@ def test_retry_after_interrupted_fetches_heals_without_refetching_history(w):w.reset_clean()w.srv.clear_faults()# Baseline: a clean update of a one-file release, bytes as the server sent them.- clean_target = w.publish("release: e2e truthful baseline", {"e2e-truthful-baseline.txt": "release\n"})+ clean_target = w.publish("release: e2e truthful baseline", {"e2e-truthful-baseline.txt": _release_file()})mark = w.srv.mark()cp = w.update()assert cp.returncode == 0 and w.head() == clean_target, f"baseline update failed:\n{w.diag(cp, mark)}"baseline = w.bytes_since(mark)before = w.head()- target = w.publish("release: e2e truthful after cuts", {"e2e-truthful-after-cuts.txt": "release\n"})+ target = w.publish("release: e2e truthful after cuts", {"e2e-truthful-after-cuts.txt": _release_file()})# Every checkout lazy fetch is cut mid-pack, after ~20 KB of pack data in whole pkt-lines (so# index-pack has started and each cut leaves a dead temp pack); the commits arrive on the first attempt.w.srv.arm(Fault(cut_after=20000, command="fetch", skip=1, times=99))diff --git a/tests/e2e/core/upgrade/hosts/_hosts.py b/tests/e2e/core/upgrade/hosts/_hosts.pyindex 6389106449f..aa6b9001c72 100644--- a/tests/e2e/core/upgrade/hosts/_hosts.py+++ b/tests/e2e/core/upgrade/hosts/_hosts.py@@ -33,7 +33,7 @@ def reran_completion(cp: subprocess.CompletedProcess) -> bool:def make_origin(root: Path) -> Path:"""``I.make_origin`` at the commit under test, serving partial clones like GitHub does.- install.sh clones ``--filter=tree:0``. Without ``uploadpack.allowFilter`` the local origin+ install.sh clones ``--filter=blob:none``. Without ``uploadpack.allowFilter`` the local originignores the filter and must pack every blob in history, which a blobless developercheckout (the ``--shared`` object store) cannot serve."""diff --git a/tests/e2e/core/upgrade/network/_seed.py b/tests/e2e/core/upgrade/network/_seed.pyindex 1a309e78a70..066550dd59b 100644--- a/tests/e2e/core/upgrade/network/_seed.py+++ b/tests/e2e/core/upgrade/network/_seed.py@@ -10,7 +10,7 @@ a real fetch, checkout and rebuild, never the "already current" branch.After the seed the sandbox loses the ``insteadOf`` rewrite: the checkout's origin is the official``https://github.com/NousResearch/hermes-agent.git`` again, and inside the namespace the only wayto reach it is the test's proxy, which routes ``github.com`` to a git smart-HTTP server over the-same bare origin. The partial clone (``--filter=tree:0``) makes every lazy tree/blob fetch of the+same bare origin. The partial clone (``--filter=blob:none``) makes every lazy blob fetch of thecheckout cross that proxy too.``Installed.run(..., edge=...)`` runs one command under ``bwrap --unshare-net``: no route, nodiff --git a/tests/e2e/core/windows_update/_machine.py b/tests/e2e/core/windows_update/_machine.pyindex c85c463ddbd..9b832501107 100644--- a/tests/e2e/core/windows_update/_machine.py+++ b/tests/e2e/core/windows_update/_machine.py@@ -12,7 +12,7 @@ Only external edges are replaced (tests/install/README.md, "The isolation trick"* git: a bare clone of this checkout (``serve.git``) answers every canonical Hermes URL via``url.<file>.insteadOf`` in a machine-owned ``GIT_CONFIG_GLOBAL``. ``serve.git`` allows- filtered fetches, so the installer's ``--filter=tree:0`` clone is a real partial clone,+ filtered fetches, so the installer's ``--filter=blob:none`` clone is a real partial clone,as it is against GitHub. Every ``git.exe`` directory is removed from PATH, so theinstaller stages its own pinned Git, as it does on a clean Windows box.* the model provider: the recording loopback server (tests/fakes/fake_llm_provider.py).diff --git a/tests/hermes_cli/test_update_fleet_checkout_build_stamp.py b/tests/hermes_cli/test_update_fleet_checkout_build_stamp.pyindex 26a163235ab..4eb60f8b7ae 100644--- a/tests/hermes_cli/test_update_fleet_checkout_build_stamp.py+++ b/tests/hermes_cli/test_update_fleet_checkout_build_stamp.py@@ -34,3 +34,34 @@ def test_git_checkout_still_walks_ancestry(monkeypatch):monkeypatch.setattr(chk.subprocess, "run", lambda cmd, **k: calls.append(cmd) or _R())assert chk.checkout_contains("cafebabe" * 5) is Trueassert calls and calls[0][:3] == ["git", "merge-base", "--is-ancestor"]+++def test_partial_clone_never_downloads_history_for_a_sha_it_lacks(monkeypatch, tmp_path):+ """A recorded SHA missing from a partial clone is "not contained", answered offline: an+ on-demand fetch of a commit pulls its whole history and kept growing ``.git`` (#129712)."""+ import subprocess+ from types import SimpleNamespace++ import hermes_cli.update_cmd as update_cmd++ def git(cwd, *args):+ return subprocess.run(["git", "-c", "user.email=t@t", "-c", "user.name=t", *args], cwd=cwd,+ capture_output=True, text=True, check=True).stdout.strip()++ origin = tmp_path / "origin"+ origin.mkdir()+ git(origin, "init", "-q", "-b", "main")+ git(origin, "config", "uploadpack.allowFilter", "true")+ git(origin, "config", "uploadpack.allowAnySHA1InWant", "true")+ git(origin, "commit", "-q", "--allow-empty", "-m", "base")+ clone = tmp_path / "clone"+ git(tmp_path, "clone", "-q", "--filter=blob:none", f"file://{origin}", str(clone))+ git(origin, "commit", "-q", "--allow-empty", "-m", "newer")+ unseen = git(origin, "rev-parse", "HEAD")+ packs = sorted((clone / ".git" / "objects" / "pack").glob("*.pack"))+ _identity(monkeypatch, git(clone, "rev-parse", "HEAD"), "git")+ monkeypatch.setattr(update_cmd, "_m", lambda: SimpleNamespace(PROJECT_ROOT=str(clone)))++ assert chk.checkout_contains(unseen) is False++ assert sorted((clone / ".git" / "objects" / "pack").glob("*.pack")) == packsdiff --git a/tests/hermes_cli/test_update_shallow_heal.py b/tests/hermes_cli/test_update_shallow_heal.pyindex 93f0b753216..493a4f44b18 100644--- a/tests/hermes_cli/test_update_shallow_heal.py+++ b/tests/hermes_cli/test_update_shallow_heal.py@@ -10,7 +10,11 @@ from __future__ import annotationsimport subprocessfrom pathlib import Path-from hermes_cli.gitlock import heal_shallow_history+import os++import pytest++from hermes_cli.gitlock import convert_treeless_checkout, heal_shallow_historydef _git(cwd: Path, *args: str) -> subprocess.CompletedProcess:@@ -39,8 +43,8 @@ def test_depth1_clone_of_a_tagless_origin_gets_its_commit_graph(tmp_path):assert _git(clone, "rev-parse", "--is-shallow-repository").stdout.strip() == "false"assert _git(clone, "rev-list", "--count", "HEAD").stdout.strip() == "3"- # History really was missing: fetched commits-only, as a tree:0 partial clone.- assert _git(clone, "config", "remote.origin.partialclonefilter").stdout.strip() == "tree:0"+ # History really was missing: fetched as the blobless partial clone installers make (#129712).+ assert _git(clone, "config", "remote.origin.partialclonefilter").stdout.strip() == "blob:none"# The clone's own depth-1 pack is a partial-clone pack now too, or git 2.53+ crashes every# later fetch in pack-objects (#124272).packs = list((clone / ".git" / "objects" / "pack").glob("pack-*.pack"))@@ -60,3 +64,31 @@ def test_depth_prefetch_on_a_full_clone_restores_ancestry_and_keeps_it_full(tmp_assert _git(clone, "merge-base", "--is-ancestor", "HEAD", "origin/main").returncode == 0assert _git(clone, "config", "--get", "remote.origin.promisor").returncode != 0+++def test_treeless_checkout_gets_every_tree_once_so_history_walks_stay_offline(tmp_path):+ origin = _origin(tmp_path, 5)+ clone = tmp_path / "clone"+ _git(tmp_path, "clone", "-q", "--filter=tree:0", f"file://{origin}", str(clone))+ offline = dict(os.environ, GIT_NO_LAZY_FETCH="1")+ walk = ["git", "log", "--format=%H", "--", "f.txt"]+ assert subprocess.run(walk, cwd=clone, env=offline, capture_output=True).returncode != 0++ assert convert_treeless_checkout(clone) is True++ assert _git(clone, "config", "remote.origin.partialclonefilter").stdout.strip() == "blob:none"+ walked = subprocess.run(walk, cwd=clone, env=offline, capture_output=True, text=True)+ assert walked.returncode == 0 and len(walked.stdout.split()) == 5+ assert convert_treeless_checkout(clone) is False+++def test_failed_conversion_keeps_the_checkout_treeless_for_a_retry(tmp_path):+ origin = _origin(tmp_path, 2)+ clone = tmp_path / "clone"+ _git(tmp_path, "clone", "-q", "--filter=tree:0", f"file://{origin}", str(clone))+ _git(clone, "remote", "set-url", "origin", f"file://{tmp_path / 'gone'}")++ with pytest.raises(subprocess.CalledProcessError):+ convert_treeless_checkout(clone)++ assert _git(clone, "config", "remote.origin.partialclonefilter").stdout.strip() == "tree:0"diff --git a/tests/scripts/install/test_install_clone_throttle_fallback.py b/tests/scripts/install/test_install_clone_throttle_fallback.pyindex a8d69c401ee..5811d857db3 100644--- a/tests/scripts/install/test_install_clone_throttle_fallback.py+++ b/tests/scripts/install/test_install_clone_throttle_fallback.py@@ -31,7 +31,7 @@ sleep() {{ :; }}git() {{if [ "$1" = clone ]; thenprintf '%s\\n' "$*" >> {shlex.quote(attempts.as_posix())}- case " $* " in *" --filter=tree:0 --no-checkout "*) ;; *) return 1 ;; esac+ case " $* " in *" --filter=blob:none --no-checkout "*) ;; *) return 1 ;; esacfiif [ "{int(materialize_fails)}" = 1 ] && [ "${{3:-}}" = reset ]; then return 1; ficommand git "$@"diff --git a/website/docs/getting-started/updating.md b/website/docs/getting-started/updating.mdindex ad46ff5771d..292eabea4df 100644--- a/website/docs/getting-started/updating.md+++ b/website/docs/getting-started/updating.md@@ -168,8 +168,14 @@ git -C $repo rev-list --objects --missing=error --all | Out-Null; $LASTEXITCODE### `.git` keeps growing in a partial clone-The installer's checkout is a partial clone: git downloads trees and blobs on demand, and each-on-demand download is written as its own small pack. `hermes update` and `hermes update --check`+The installer's checkout is a blobless partial clone: every commit and directory listing is local,+and git downloads file contents on demand, each on-demand download written as its own small pack.+Installers from late September 2026 made treeless (`--filter=tree:0`) clones instead. git asks for+a missing tree without saying which ones it already has, so a treeless checkout downloaded complete+directory snapshots again on every checkout and path-filtered history walk. `hermes update`+converts such a checkout once, at the end of the update: one `git fetch --refetch --filter=blob:none`+brings every commit and tree (about 120 MB), and later updates stop re-downloading them. If that+fetch fails, the update prints a warning, carries on, and retries the conversion next time. `hermes update` and `hermes update --check`set `maintenance.commit-graph.enabled`, `gc.writeCommitGraph` and `fetch.writeCommitGraph` to`false` in that checkout, because a commit-graph write over commits the graph has not seen yetdownloads every one of their trees. Leave those settings alone, and leave `gc.auto` at its