Repository navigation
Description
What happens
brew upgrade --cask yap replaces /Applications/yap.app, but the launchd job keeps executing the old image — replacing a file does not touch a process that already mapped it. So after an upgrade you are silently still running the previous version until something restarts the daemon:
brew upgrade --cask yap
yap stop && yap start # currently required, and nothing says soObserved on the 0.1.1 → 0.1.2 upgrade. Nothing in the upgrade output hints at it, and yap --version answers from the new binary on disk, so it agrees with the version you just installed while the daemon in memory is the old one. That is the worst shape for this bug: it looks fixed.
Why the obvious fix is wrong
A cask uninstall stanza. Homebrew runs uninstall directives on upgrade as well as uninstall, and the reasoning is already recorded in .github/workflows/release.yml (the cask heredoc, ~L159-169):
uninstall launchctl:deletes~/Library/LaunchAgents/com.terrifiedbug.yap.plist, so every upgrade would quietly switch launch-at-login off.uninstall quit:is recorded and then reopened withopen -b, which starts the daemon outside launchd, where neitheryap stopnor the login item can reach it.
So the current no-uninstall-stanza cask is deliberate, and this issue must not undo it.
Proposed fix
postflight in the generated cask — the package manager restarts the service it just replaced, through launchd rather than around it:
postflight do
system_command "/bin/launchctl",
args: ["kickstart", "-k", "gui/#{Process.uid}/com.terrifiedbug.yap"],
must_succeed: false
endkickstart -kreplaces the job launchd already owns, so the daemon stays inside launchd and the plist is untouched.must_succeed: falsebecause most installs have no login item, andbrew upgradeshould not fail over its absence.- The cask is regenerated by the release workflow on every tag, so this lands in the release after the one that merges it, and applies from that upgrade onward.
One thing to decide: kickstart -k will interrupt a dictation press or an in-progress meeting recording. brew upgrade is user-initiated, and a session's CAF/AAC tracks are written incrementally, so the exposure is small — but it should be a conscious call, not an accident.
Alternative considered
Have the daemon notice its own executable changed and exit non-zero, letting the existing KeepAlive { SuccessfulExit: false } relaunch it into the new image. A vnode watch is kernel-notified, so it costs nothing while idle and does not break the no-polling rule, and it would cover every install path rather than only Homebrew.
Against it: it auto-adopts a binary nobody has verified starts (turning a working old daemon into a dead new one without being asked), it needs gating so it never fires mid-press or mid-recording, and it is materially more machinery than a package-manager problem the package manager already has the information to solve. Recorded here so it is not re-proposed without a reason to prefer it.
Not covered by either
Someone who installed by dragging the .dmg still restarts by hand. A yap doctor line comparing the running image against the executable on disk would at least name the situation instead of leaving it invisible.
Acceptance
- With launch-at-login installed,
brew upgrade --cask yapleaves the running daemon on the new version, with no manual step. ~/Library/LaunchAgents/com.terrifiedbug.yap.pliststill exists afterwards, andlaunchctl print gui/$UID/com.terrifiedbug.yapstill resolves — the daemon is still a launchd job, not a stray process.- Upgrading on a machine with no login item installed does not fail the upgrade.
Activity
TerrifiedBug commentedon Aug 19, 2026
Verified end to end on the real
0.1.3 → 0.1.4upgrade, not simulated — this landed in the 0.1.4 cask, so the upgrade that shipped the fix is the one that exercised it.The inode comparison is the part that actually answers this issue: before the upgrade the running daemon mapped inode
264600889, and afterwards it maps the new file's inode. So it is genuinely executing the new image rather than agreeing with a version string it read off disk.All three acceptance criteria hold — new version running, plist and launchd job intact, and
launchctlexits 113 withmust_succeed: falsewhere there is no login item.The open question, resolved by measurement
It interrupts, but non-destructively, and that was measured rather than argued. A throwaway LaunchAgent mimicking yap's signal posture showed
kickstart -kdelivers SIGTERM, not SIGKILL, and that launchd starts the job again after a caught SIGTERM and a cleanexit 0(~5 s later).yap already installs
DispatchSourcehandlers for SIGINT/SIGTERM routing toNSApp.terminate(nil), so SIGTERM runsapplicationWillTerminate: a live session is stopped cleanly, keeps itsmeta.json, and transcribes on the next start. The upgrade log confirms the graceful path ran rather than the process being killed:A dictation press in flight loses that press's audio; a meeting recording does not lose the meeting. That seems the right trade for a user-initiated
brew upgrade.One correction to the issue
It applies one release earlier than that. Homebrew runs the new cask's
postflightduring an upgrade, and the tag's cask is generated from the workflow at that tag — so merging before taggingv0.1.4made the0.1.3 → 0.1.4upgrade itself restart the daemon. Which mattered more than usual here: 0.1.4 also ships the transcript-ready banner (#9), and without the restart it would have looked like that feature did not work.Still open, deliberately
The
yap doctorline comparing the running image against the executable on disk, for the.dmginstall path. Outside this issue's acceptance criteria, and it needs a heuristic with its own false-positive modes, so it wants its own change rather than a rider on a release. The inode comparison above is a decent basis for it if it gets picked up.