Skip to content

fix(desktop): never show bogus commit-behind count on shallow clones - #79588

Closed
Bors6656 wants to merge 1 commit into
NousResearch:mainfrom
Bors6656:fix/shallow-update-count-bogus-4650
Closed

fix(desktop): never show bogus commit-behind count on shallow clones#79588
Bors6656 wants to merge 1 commit into
NousResearch:mainfrom
Bors6656:fix/shallow-update-count-bogus-4650

Conversation

@Bors6656

@Bors6656 Bors6656 commented Aug 5, 2026

Copy link
Copy Markdown

Summary

A shallow hermes-agent checkout that shares a merge-base with origin/main still runs git rev-list HEAD..origin/<branch> --count in checkUpdates(), and surfaces the raw (real but alarming) commit distance in the desktop update pill — e.g. 4650 commits behind on a shallow pin that simply hadn't been updated.

apps/desktop/electron/update-count.ts only skipped the count when isShallow && !hasMergeBase. The shallow-with-merge-base case fell through to the count and produced the bogus large number.

This aligns the desktop with the already-correct CLI guard in hermes_cli/banner.py: any shallow checkout skips the count and falls back to a tip-SHA compare, showing a generic "update available" instead of a scary, unactionable number. Full clones keep the exact-count path unchanged.

  • shouldCountCommitsreturn !isShallow
  • resolveBehindCount → binary SHA compare when isShallow, else the parsed count

Test plan

  • Updated update-count.test.ts: it previously asserted the buggy shallow+merge-base behavior (count kept); now asserts shallow always resolves via SHA compare. Added the missing shallow+merge-base case that produced the 4650.
  • vitest run electron/update-count.test.ts → 11/11 pass.
  • tsc -p apps/desktop/tsconfig.electron.json --noEmit → clean.

Root cause reference

First reported as the desktop update pill showing "4650 updates" on a shallow install. Mirrors desktop note in banner.py (shallow clones compare tip SHAs, never count).

🤖 Generated with Claude Code

shallow checkout + merge-base still ran rev-list --count and surfaced the
real (but alarming) commit distance (e.g. 4650) in the update pill. Align
with hermes_cli/banner.py: ANY shallow clone skips the count and falls back
to a tip-SHA compare, so it shows a generic 'update available' instead of a
scary, unactionable number. Full clones keep the exact count path unchanged.

Updates the test that previously asserted the buggy shallow+merge-base
behaves identically to a full clone.
@alt-glitch alt-glitch added type/bug Something isn't working P3 Low — cosmetic, nice to have comp/desktop Electron desktop app (apps/desktop/*) area/install-update Installer, updater, packaging, wheels, doctor sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades labels Aug 5, 2026
@teknium1

Copy link
Copy Markdown
Contributor

Closing — superseded by PR #86257 (merged, bf10349), which lands the same behavioral change your PR argued for: shallow checkouts never trust rev-list --count, with or without a merge-base (your "shallow + merge-base = live bug 4650" case included, backed by a real-git fixture test from #64469). #86257 goes one step further than presence-only: it recovers the exact count via the GitHub compare API when reachable. Your PR arrived after #64469 (Jul 14) made the same always-skip argument, so credit for the base went to the earliest submitters (#61050/#83381/#64469) — but thanks for the clear analysis and the real-world 4650 datapoint, which is cited in the merged test comments.

@teknium1 teknium1 closed this Aug 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/install-update Installer, updater, packaging, wheels, doctor comp/desktop Electron desktop app (apps/desktop/*) P3 Low — cosmetic, nice to have sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants