Skip to content

fix(desktop): don't report a bogus update count for a shallow checkout - #52201

Merged
OutThisLife merged 2 commits into
mainfrom
bb/desktop-shallow-update-count
Jun 25, 2026
Merged

fix(desktop): don't report a bogus update count for a shallow checkout#52201
OutThisLife merged 2 commits into
mainfrom
bb/desktop-shallow-update-count

Conversation

@OutThisLife

Copy link
Copy Markdown
Collaborator

Salvages #51979 by @briandevans onto a bb/ branch (cherry-picked, authorship preserved) and rebased onto current main (resolved a package.json test:desktop:platforms conflict — kept both the new update-count.test.cjs and main's window-state.test.cjs).

What

A public desktop install is cloned --depth 1, so git rev-list HEAD..origin/<branch> --count enumerates the entire remote ancestry and returns a meaningless huge number — the indicator renders v0.17.0 (+12104) (#51922). The non-SSH desktop count path in checkUpdates() was the one place missing the shallow guard that the SSH branch (behind: currentSha === targetSha ? 0 : 1) and banner.py (count_commits_behind) already have.

Adds a unit-testable resolveBehindCount() helper that falls back to the binary SHA check on a shallow / no-merge-base checkout, and keeps the exact count for full clones.

Verified on current main

  • node --test apps/desktop/electron/update-count.test.cjs → 10/10 pass.
  • Conflict resolution preserves both test registrations.

Supersedes #51979. Fixes #51922.

The desktop installer clones with `--depth 1`, so a public install's local
history often shares no merge-base with the freshly fetched origin tip. In
that state `git rev-list HEAD..origin/<branch> --count` enumerates the
entire remote ancestry and returns a meaningless huge number, surfacing as
e.g. "v0.17.0 (+12104)" in the update indicator (#51922).

The official-SSH branch of checkUpdates() already sidesteps this by reporting
a binary up-to-date check (`behind: currentSha === targetSha ? 0 : 1`), and
hermes_cli/banner.py guards the identical class for the CLI banner. The
passive desktop count path was the one place the shallow guard was missing.

Detect shallow + no-merge-base up front and fall back to the same SHA-based
binary check; full clones (developers / Docker dev images) keep the exact
count path unchanged. The resolution logic lives in a pure update-count.cjs
helper so it is unit-testable without booting Electron.
checkUpdates() ran `git rev-list HEAD..origin/<branch> --count`
unconditionally in the parallel probe batch, even on the shallow +
no-merge-base path where resolveBehindCount() ignores the result and
falls back to a SHA compare. In the #51922 failure mode that count walks
the entire remote ancestry (thousands of commits), so the work was pure
latency on every update check for the exact case the fix targets.

Split the probes into two phases: resolve --is-shallow-repository and
merge-base first, then run rev-list --count only when shouldCountCommits
says the number is meaningful (full clone, or shallow-with-merge-base).
The shallow/no-merge-base SHA fallback is preserved unchanged.
@OutThisLife
OutThisLife requested a review from a team June 25, 2026 00:12
@alt-glitch alt-glitch added type/bug Something isn't working P3 Low — cosmetic, nice to have comp/desktop Electron desktop app (apps/desktop/*) labels Jun 25, 2026
@OutThisLife
OutThisLife merged commit 153ad79 into main Jun 25, 2026
21 checks passed
@OutThisLife
OutThisLife deleted the bb/desktop-shallow-update-count branch June 25, 2026 00:34
waefrebeorn pushed a commit to waefrebeorn/slermes that referenced this pull request Jul 2, 2026
…allow-update-count

fix(desktop): don't report a bogus update count for a shallow checkout
habarmc1223-sudo pushed a commit to habarmc1223-sudo/hermes-agent-fluxmem that referenced this pull request Jul 8, 2026
…allow-update-count

fix(desktop): don't report a bogus update count for a shallow checkout
santhreal pushed a commit to santhreal/hermes-agent that referenced this pull request Jul 13, 2026
…allow-update-count

fix(desktop): don't report a bogus update count for a shallow checkout
Gravezzz pushed a commit to Gravezzz/hermes-agent that referenced this pull request Jul 21, 2026
…allow-update-count

fix(desktop): don't report a bogus update count for a shallow checkout
leewenjie pushed a commit to leewenjie/hermes-agent that referenced this pull request Aug 7, 2026
…allow-update-count

fix(desktop): don't report a bogus update count for a shallow checkout
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/desktop Electron desktop app (apps/desktop/*) P3 Low — cosmetic, nice to have type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Desktop shows bogus client update count in dirty shallow checkout

4 participants