# Upgrade Guide — v0.12.12

<!-- bump: patch -->

## What Changed

Fixed the auto-updater notification spam loop. Three root causes addressed:

1. **`lastAppliedVersion` set from `applyUpdate()` return value**: When `npm install -g` updated files in-place, `getInstalledVersion()` immediately returned the new version, causing `applyUpdate()` to return `newVersion: previousVersion` (the old version). The loop breaker (`lastAppliedVersion === latestVersion`) never matched because `lastAppliedVersion` was the old version. Fix: AutoUpdater now uses `targetVersion` (the version it intended to install) for the loop breaker, not the potentially-stale `result.newVersion`.

2. **`getInstalledVersion()` read from disk on every call**: After `npm install -g` replaces files at the running binary's location, `getInstalledVersion()` would return the new version even though the running process has old code in memory. This caused `check()` inside `applyUpdate()` to return `updateAvailable: false`, leading to `restartNeeded: false` (no restart despite stale in-memory code). Fix: `getInstalledVersion()` now caches the version on first call, representing the actual running process version.

3. **`restartNeeded: false` skipped restart for stale processes**: When `applyUpdate()` returned `restartNeeded: false` (due to the above issues), the AutoUpdater skipped `gatedRestart()`. But the running process had old code that needed replacing. Fix: AutoUpdater always calls `gatedRestart()` after a successful apply, since the in-memory code is always stale after an update. The existing loop breaker prevents infinite restart cycles.

## What to Tell Your User

- **Update notification spam fixed**: The repeated "Just updated to vX.Y.Z. Restarting to pick up the changes." messages every 5 minutes should stop after this update lands. The root cause was a version comparison bug that prevented the auto-updater from recognizing it had already applied the update.

## Summary of New Capabilities

| Capability | How to Use |
|-----------|-----------|
| Spam-free auto-updates | Automatic — no action needed |
