From c95e1f1e7568eef5e7763acb10b5f938153bc44a Mon Sep 17 00:00:00 2001 From: teknium1 <127238744+teknium1@users.noreply.github.com> Date: Wed, 29 Jul 2026 09:09:04 -0700 Subject: [PATCH 1/2] perf(banner): scope startup update-check fetch to origin/main MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The banner update-check ran an unscoped 'git fetch origin', transferring all ~1,400 remote heads (measured 3.0s dry-run vs 0.55s scoped, and up to 70s on a cold ref store) and frequently burning its full 10s timeout on slow links. cmd_update already scopes its fetch for exactly this reason. A scoped 'git fetch origin main' updates both the origin/main tracking ref (full-clone count path) and FETCH_HEAD (shallow compare path), so behind-count semantics are unchanged — verified empirically on a full clone (rewound tracking ref restored to tip, count correct) and a --depth 1 shallow clone (FETCH_HEAD updated, boundary preserved). --- hermes_cli/banner.py | 10 +++++++++- tests/hermes_cli/test_update_check.py | 5 +++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/hermes_cli/banner.py b/hermes_cli/banner.py index 08e2ceeb1fa0e..4d2b077ec964d 100644 --- a/hermes_cli/banner.py +++ b/hermes_cli/banner.py @@ -219,7 +219,15 @@ def _check_via_local_git(repo_dir: Path) -> Optional[int]: is_shallow = shallow == "true" try: - fetch_args = ["git", "fetch", "origin"] + # Scope the fetch to the one branch the behind-count compares against. + # An unscoped ``git fetch origin`` transfers every remote head (~1,400 + # on this repo — measured 3.0 s vs 0.55 s scoped) and can burn the full + # 10 s timeout on slow links. ``cmd_update`` already scopes its fetch + # for the same reason. Modern git updates the ``origin/main`` tracking + # ref on a scoped fetch, so the ``HEAD..origin/main`` count below is + # unaffected; the shallow path compares against FETCH_HEAD, which a + # scoped fetch also updates. + fetch_args = ["git", "fetch", "origin", "main"] if is_shallow: fetch_args += ["--depth", "1"] fetch_args.append("--quiet") diff --git a/tests/hermes_cli/test_update_check.py b/tests/hermes_cli/test_update_check.py index 48a8da3045cf3..3347afa5bbe27 100644 --- a/tests/hermes_cli/test_update_check.py +++ b/tests/hermes_cli/test_update_check.py @@ -165,8 +165,9 @@ def fake_run(cmd, **kwargs): result = banner._check_via_local_git(repo_dir) assert result == banner.UPDATE_AVAILABLE_NO_COUNT - # The shallow fetch must preserve the boundary (--depth 1), not unshallow. - assert ["git", "fetch", "origin", "--depth", "1", "--quiet"] in calls + # The shallow fetch must preserve the boundary (--depth 1), not unshallow, + # and must stay scoped to main (unscoped fetches transfer ~1,400 heads). + assert ["git", "fetch", "origin", "main", "--depth", "1", "--quiet"] in calls def test_check_via_local_git_shallow_clone_up_to_date(tmp_path): From 79f32960a7242085bb5158a62562faac30d0fd45 Mon Sep 17 00:00:00 2001 From: Teknium <127238744+teknium1@users.noreply.github.com> Date: Wed, 29 Jul 2026 09:29:27 -0700 Subject: [PATCH 2/2] ci: retrigger after 0-job dispatch death