#23597: fix(mac): stop Sparkle updater from offering downgrades as updates
scripts
size: XS
Cluster:
Update Handling Fixes
## Problem
macOS users on the latest version (2026.2.21) are prompted to "update" to an older version (2026.2.15):
> **A new version of OpenClaw is available!**
> OpenClaw 2026.2.15 is now available—you have 2026.2.21. Would you like to download it now?
<img width="570" height="405" alt="Screenshot 2026-02-22 at 8 42 39 PM" src="https://github.com/user-attachments/assets/453a918f-8408-49a6-af56-1a577e38f8ef" />
This is a downgrade, not an upgrade. Clicking "Install Update" would roll the user back to a week-old release.
## Root cause
`package-mac-app.sh` defaults `APP_BUILD` (which becomes `CFBundleVersion` / `sparkle:version`) to `git rev-list --count HEAD` — a plain commit count. For 2026.2.21 this produced `13056`. Sparkle compares versions numerically, so:
```
13056 (2026.2.21) < 202602150 (2026.2.15)
```
Sparkle concludes 2026.2.15 is newer and offers the "update." The same class of bug previously affected 2026.2.13 (#22702).
## Fix
| File | Change |
|---|---|
| `scripts/package-mac-app.sh` | Auto-derive `APP_BUILD` as `YYYYMMDD0` from `APP_VERSION` (e.g. `2026.2.21` → `202602210`). Git commit count is now only a fallback for non-standard version formats. No more manual `APP_BUILD` override needed at release time. |
| `appcast.xml` | Correct 2026.2.21 `sparkle:version` from `13056` → `202602210` |
| `test/appcast.test.ts` | Validate `sparkle:version` format for **every** appcast item (not just 2026.2.15), so CI catches mismatches immediately |
This is a superset of #23292 (data-only fix) — it also addresses the build script issue that caused both #22702 and #23292.
## Test plan
- [x] `vitest run test/appcast.test.ts` passes (3 items validated)
- [x] Smoke-tested bash derivation: `2026.2.21 → 202602210`, `2026.12.5 → 202612050`
- [ ] Verify macOS update check no longer offers downgrade
Closes #22657
🤖 Generated with [Claude Code](https://claude.com/claude-code)
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
Fixes a critical macOS auto-updater bug where users on 2026.2.21 were prompted to "update" to 2026.2.15 (a downgrade). The root cause was that `sparkle:version` used git commit count (`13056`) instead of a date-based build number, causing Sparkle to compare `13056 < 202602150` and incorrectly offer the older release as an "update."
The fix auto-derives `APP_BUILD` as `YYYYMMDD0` from `APP_VERSION` in `package-mac-app.sh`, corrects the 2026.2.21 appcast entry, and extends test coverage to validate all appcast items (not just 2026.2.15). This prevents future version comparison bugs.
<h3>Confidence Score: 5/5</h3>
- This PR is safe to merge - it fixes a critical bug with a clean, well-tested solution
- The fix correctly addresses the root cause (git commit count vs date-based versioning), includes both the build script fix and data correction, and adds comprehensive test coverage to prevent regression. The bash logic is sound, preserves backward compatibility with explicit APP_BUILD overrides, and the numeric validation ensures Sparkle compatibility.
- No files require special attention
<sub>Last reviewed commit: 6ae41d7</sub>
<!-- greptile_other_comments_section -->
<sub>(2/5) Greptile learns from your feedback when you react with thumbs up/down!</sub>
<!-- /greptile_comment -->
Most Similar PRs
#23292: fix(mac): correct sparkle:version for 2026.2.21 in appcast.xml
by SidQin-cyber · 2026-02-22
92.5%
#22702: fix(appcast): correct sparkle:version for 2026.2.13
by lbo728 · 2026-02-21
88.4%
#23730: fix(update): correctly compare versions with -N build suffix
by mrx-arafat · 2026-02-22
73.5%
#3337: fix(macos-app): patch SwiftPM Bundle.module accessor for app bundle
by skymoore · 2026-01-28
72.3%
#17237: fix(update): guard post-install imports after npm global update
by tdjackey · 2026-02-15
71.3%
#14666: fix(macos): align minimum Node.js version with runtime guard (22.12.0)
by sumleo · 2026-02-12
70.3%
#18792: docs: add macOS source-run troubleshooting for setup/auth issues
by yash27-lab · 2026-02-17
70.1%
#17386: fix: Site shows MacOS 14+ but only works on 15+
by MisterGuy420 · 2026-02-15
69.6%
#15909: Guard notifications on macOS; fix focus issue and build fixes
by jasonkneen · 2026-02-14
69.2%
#21075: fix(media): use sips on Node.js + darwin to prevent Photos TCC prompt
by irchelper · 2026-02-19
69.1%