[Bug]: macOS nightly: an already-applied update is re-installed on relaunch and the updater cache (2× nightly zip, ~365 MB) is never cleaned#32554

opened22d agobySskovtunenko

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Related but distinct: #31487 (there, a menu Quit discards a downloaded update; here, the install succeeds, but the staged copy is never cleaned and is later re-installed).

Area

apps/desktop — macOS updater (electron-updater + Squirrel.Mac ShipIt), nightly channel

Environment

  • T3 Code (Nightly) 0.1.8-nightly.20261107.4327, macOS, Apple Silicon
  • Updater per app-update.yml: provider: github (pingdotgg/t3code), channel: nightly, updaterCacheDirName: t3code-updater
  • Cache: ~/Library/Caches/t3code-updater/, ShipIt log: ~/Library/Caches/com.t3tools.t3code.ShipIt/ShipIt_stderr.log

Steps to reproduce

  1. On the nightly channel, let the app download and install an update (ShipIt log: "Installation completed successfully", app relaunches on the new build).
  2. Quit and relaunch the app later without any new build being published.
  3. Compare the ShipIt log timestamps with the mtimes in ~/Library/Caches/t3code-updater/.

Actual behavior

Observed on 2026-11-07 (all times from the ShipIt log and file mtimes):

  • 09:11 — nightly 20261107.4301 downloaded into the cache (update.zip + pending/ copy), installed successfully at 09:11:10, app relaunched on 4301.
  • 15:24:00 — a new install request for the same staged 4301. No download happened in between (update.zip and current.blockmap mtimes are still 09:11). ShipIt swapped the already-running 4301 over itself again ("Installation completed successfully").
  • 17:43 — 20261107.4327 downloaded and installed; app relaunched.
  • Cache state after all of the above: update.zip (182 MB) + pending/T3-Code-20261107.4327-arm64.zip (182 MB copy of the build that is already installed) + blockmaps ≈ 365 MB held permanently. update.zip has a birth date of Oct 24 and has been overwritten in place by every new download — it has survived 13 install requests over 15 days and was never deleted.
  • The ShipIt log shows 13 install requests between Oct 24 and Nov 7 on this single machine, all successful, including at least one same-version reinstall (15:24 today). It looks like any relaunch with a staged copy present re-triggers the install.

ShipIt itself cleans up correctly: its extracted staging dir (ShipIt/update.XXXX/) and the old-bundle temp dir in /var/folders are removed after every install, and the old app bundle is not moved to the Trash. Only the electron-updater cache survives forever.

Expected behavior

  • After a successful install, the staged copy (pending/) is removed, and the app does not treat the already-applied update as pending on the next launch.
  • An install request whose version equals the running bundle's version is skipped (no bundle swap).

Impact

  • Nightly-channel users permanently occupy ~365 MB (two full copies of the currently installed build).
  • A redundant full bundle swap (and, if surfaced in the UI, a stale "update ready" state) runs on relaunch after every applied update.

Suggested fix

In the desktop update flow (DesktopUpdates.ts / electron-updater config):

  1. After a successful quitAndInstall, clear ~/Library/Caches/t3code-updater/pending/ (keeping update.zip + blockmap as the differential-download base is fine if intended).
  2. Before installing, compare the staged update version with the running bundle version and skip the swap when they are equal.