Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(desktop): macOS updates relaunch the app even when its label changes #23028

Openishaanko(GitHub profile, opens in a new tab)wants to merge 16 commits intomain fromrefs/pull/23028/headopened View on GitHub

ishaanko(GitHub profile, opens in a new tab)commented

Problem

Updating from T3 Code (Alpha).app to 0.1.0 quit the app and never brought it back. Switching update channels does the same thing. electron-builder names the .app after productName, so every label or channel change renames the bundle on update. Squirrel.Mac moves the installed app to the new name and then relaunches from the old path, which no longer exists. For hosts reached only over T3 Connect, this leaves the server offline until someone opens the app by hand.

Change

The macOS bundle filename is now pinned through mac.executableName, so it no longer follows productName. Labels and channels (Beta, Nightly, or dropping the label later) still show everywhere the name is displayed, and updates now install in place. Windows and Linux artifacts are unchanged.

The pin is T3 Code (Beta) because 0.1.0 already moved most installs to that path, and users who re-pinned their Dock icon after this bug pointed it there. Installs still at T3 Code (Alpha).app or T3 Code (Nightly).app hit the failed relaunch one last time when they update to this build, unless T3 Code (Beta).app already sits beside them. Their current Squirrel does that rename, so nothing in a new build can prevent it. After that, they stay put. Recovery for that one-time case is already in the user guide (docs/user/updating.md, #25424).

Squirrel.Mac's rename rule: SQRLUpdater.m sets useUpdateBundleName whenever the running app's executable name matches its bundle folder name, which is always true for electron-builder output. ShipIt then renames the installed app to the update's executable name. An executable name that never changes keeps it in place.

Side-by-side installs: pinning the executable alone would make the nightly DMG ship T3 Code (Beta).app too, so a fresh nightly install would land on stable. The nightly DMG now presents the app as T3 Code (Nightly).app, while the executable inside stays T3 Code (Beta). Squirrel.Mac only renames a bundle whose folder matches its executable, so that install also updates in place. Stable and nightly still install beside each other, and the t3-code@nightly cask's app "T3 Code (Nightly).app" keeps working unchanged. Existing nightly installs next to stable also stay put, because ShipIt never renames onto a path that already exists (SQRLInstaller.m).

Scope and approval

Fixes #20103, which Julius accepted as a bug. Only the macOS build config and the release docs change. The Alpha → 0.1.0 transition in the report has already shipped, and the rename is done by the Squirrel.Mac copy inside the installed app, so no later build can change it. This PR stops it from happening again on the next label or channel change.

Verification

Packaged an empty Electron 44.9.3 app as mac dir (arm64) with electron-builder 26.16.1 (the repo's versions) under each product name, and read the bundle name and Info.plist names from the output:

# before (main): mac bundle follows productName
main-stable      bundle="T3 Code (Beta).app"     CFBundleDisplayName="T3 Code (Beta)"     CFBundleExecutable="T3 Code (Beta)"
main-nightly     bundle="T3 Code (Nightly).app"  CFBundleDisplayName="T3 Code (Nightly)"  CFBundleExecutable="T3 Code (Nightly)"
# after (this PR): mac.executableName pinned to "T3 Code (Beta)"
pr-stable        bundle="T3 Code (Beta).app"     CFBundleDisplayName="T3 Code (Beta)"     CFBundleExecutable="T3 Code (Beta)"
pr-nightly       bundle="T3 Code (Beta).app"     CFBundleDisplayName="T3 Code (Nightly)"  CFBundleExecutable="T3 Code (Beta)"

A label or channel change no longer renames the bundle on disk. The displayed name still follows the channel, so there's nothing for Squirrel.Mac to move and it relaunches from the same path. scripts/build-desktop-artifact.test.ts checks that createBuildConfig gives stable and nightly the same mac bundle name (vp test run build-desktop-artifact.test.ts, passing).

Real T3 app through Squirrel.Mac (macOS 27.0.1, arm64). I built this branch with build-desktop-artifact.ts --mock-updates four times: stable 9.0.0, nightly 9.0.1, stable 9.0.2, and a nightly 8.9.0 built without the pin to stand in for today's installs. The test copy only changed the app ID, names, data folders and URL scheme, so it couldn't touch a real install. Every build was re-signed with one self-signed identity, so ShipIt checked each update against the installed app's designated requirement. The update came from a local feed, through the app's own setUpdateChannel → downloadUpdate → installUpdate bridge calls.

ScenarioInstalled path afterRelaunched by itselfStable beside it
Pinned stable → nightly → stable(Beta).app both timesyes, ~4s each, backend up, Codex turn okn/a
Today's nightly beside stable → pinned nightly(Nightly).appyesuntouched (same hash, inode)
New nightly DMG install beside stable → stable(Nightly).appyesuntouched
Today's nightly alone → pinned nightlyrenamed to (Beta).appno (the one-time case above)n/a

Run transcript · ShipIt log

Not checked: Developer ID signing and notarization (Gatekeeper), and T3 Connect reconnection.

Made with Claude Code (Sonnet 5.5 implementation, Opus 5.5 review) in T3 Code.

    1. Pushed9bff5d4

Sign in to join this conversation.