cmux NEXT updater: a log file at ~/Library/Logs/cmux-next/<bundle>-updater.log

TE
1d ago
+149-6

Leo-ask: ask-8112d98df7

Leo, 2026-11-04: "i only clicked the "download" button and it allegedly "updated" but i didnt restart the app/get a prompt to?"

Two explanations are on record for that relaunch: #34612 cites an install click 3.3 s after Restart to Update appeared, and the #34477 helper concluded it was an automatic install that reopened cmux behind his frontmost app. Neither can be checked on his Mac: log show returns no com.cmuxterm.app.next updater lines there, not even for the last 5 minutes, and ~/Library/Logs/cmux-next holds no updater file. This adds that file, as classic's cmux-update.log was.

What changed

  • UpdateLogFile (new): every UpdateLogBuffer line also goes to ~/Library/Logs/cmux-next/<bundle>-updater.log (for example com.cmuxterm.app.nightly-updater.log) as <ISO 8601 time> [<pid>] <message>. Lines are written in order on one BackgroundWork files lane at one priority, never on the caller's thread. They are posted blockShutdown, so quit waits for the lines before an install's quit. At 1 MB the file moves to .1, replacing the older one, so the pair stays under 2 MB. A failed write drops only that line; memory and unified logging still have it. No timer and no observer.
  • UpdaterService.init logs a launch line with the version, build, track and pid, and says whether the launch was "reopened behind by an automatic install" (--cmux-update-reopened-behind). downloadClicked() and installClicked() each log the click and the flow phase. The checks, found and no-update results, which path installed (automatic=, Sparkle's silent stage, quit-for-install) and the relaunch reason were already log lines; they now persist.
  • No file in test processes (swiftpm-testing-helper, xctest, the XCTest variables) or with recordsUpdates: false.
  • logPath() (shown in update error details) gives the file's path when there is one.

Tests

UpdateLogFileTests: 50 lines reach the file in order with the pid; a full file moves aside before the next line; a test process gets no file.

Observed / Not run

Observed: prepush gate clean. The fleet compile and UpdateLogFileTests results are added below when they finish.

risk: normal (diagnostics only; no update behaviour changes).

Changelog

none

Agent session: agent session

🤖 Generated with Claude Code


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.


Summary by cubic

Adds a file-backed log for the cmux NEXT updater at ~/Library/Logs/cmux-next/<bundle>-updater.log so update flows can be traced after the fact. Unified logging kept no updater lines on the affected user's Mac, so the relaunch after a Download click could not be explained.

  • Every updater log line is also written to the file with an ISO 8601 timestamp and pid, in order on a background lane at user-visible priority; at 1 MB the file rotates to .1. The block-shutdown lines just before an install's quit land within milliseconds, well before Sparkle's quit ends, since that quit does not drain the lane.
  • A launch line records the version, build, track, pid, and whether the launch was reopened behind by an automatic install; download and Restart-to-Update clicks log their flow phase.
  • No file in test processes or when recordsUpdates is off.