Repository navigation
Conversation
A package manager that installs the next version in the background cannot switch the app's launch path over while the running app still resolves its own files through that path: the open app then loads the next version's files and crashes. It has to defer the switch until the app has exited, and nothing tells it when that is. The EXTERNALLY-MANAGED marker gains an optional quitCommand. On the managed lane it is started on will-quit, detached and never awaited, under the same constructed environment as the other marker commands, with the quitting app's pid in KIROCREW_QUITTING_PID so it can wait for the exit. A cancelled quit, a quit that applies an update (app.exit) and a crash do not run it. build-desktop.sh accepts the field with the same 512-character cap as the other commands.
UX Review (Fable 5) — ✅ PASSUX-level review of UX-Verdict: PASS Nothing to check. [UX-REVIEWED] 704dcfa Description read[DESCRIPTION-READ] 5fe92ffa4af45a7eeeef2adb74163ec58856357f850a44672a0b638510e874e7 That sha256 names everything this verdict read: the PR description, plus the 7 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
First Principles Review (Fable 5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS No packaged macOS or Windows build has run the quit hook — the author verified unpackaged Linux only; confirm one packaged platform before relying on it. Not justified as shipped
What this change shipsInventory (6 items) — 5 justifiedIntent: let a packager run its own upkeep command once the desktop app has quit, so a background update's launch-path switch never lands under the running app — an ADDITION. (The diff artifact also carries ~130 files of base-side commits already on main — #16190, #16207, #15731 among them — from a stale fork point; the inventory covers only the PR's own change.)
[FIRST-PRINCIPLES-REVIEWED] 704dcfa Description read[DESCRIPTION-READ] d0f25d6056e9cc7d5c424baf4693418aaa045a5050dac51951051c36b9980d45 That sha256 names the PR description this verdict read. Recompute it with |
Design Review (Fable 5) — ✅ PASSDesign-level review of Design-Verdict: PASS Verify a packaged Windows/macOS build once: the detached child outliving the app was only exercised unpackaged on Linux, as the author discloses. [DESIGN-REVIEWED] 704dcfa Description read[DESCRIPTION-READ] c2a03fa229d918090c2b96dd4fe57ee76b407654d798474ebd403dd615347bb5 That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
GPT 5.6 Review — ✅ no blocking findingsGPT 5.6 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
Opus 5 Review — ✅ no blocking findingsReviewed Review detailsA timed-out apply is recorded as finished, releasing the in-flight interlock while the package manager may still be running. FINDING — website/electron/runtime/update/managed-lane.js:420 — [OPUS-REVIEWED] 704dcfa Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
will-quit can still be cancelled by another handler, fires for a relaunching quit, and runs before the app's own children have exited, so the earlier claim that a vetoed quit never runs the command was wrong. The docs now make waiting on KIROCREW_QUITTING_PID a requirement, and the lane skips the quit command while an update apply is still in flight. The env test asserts the narrowed PATH by property so it also holds on Windows.
|
Dispositions for the reviews on Design Review (BLOCK)
Opus findings
CI on
|
…ails A non-zero updateCommand exit left managedInstalling set, which silently suppressed both the background poll and the quit command for the rest of the process. Reset it on the failure branch and pin it with a test.
|
GPT 5.6 (BLOCKING) — failed installs permanently suppress the quit command: fixed in Confirmed in source: New test |
|
Closing: the premise does not hold. A process launched through a symlinked bundle path resolves execPath/resourcesPath/getAppPath to the concrete version directory at startup, so repointing the link while the app runs does not hand it new files. The observed crash reproduces when the running version's directory is deleted, not when the link is repointed, so deferring work to will-quit does not address it. The fix belongs in the packager's retention of the running version. |
Problem / Motivation
Goal: Let a packager that owns the desktop app's install run its own upkeep command once the app has quit, instead of while it is still running.
A packager that installs updates in the background and launches the app through a stable symlink has to move that symlink to the new version. If it does that while the app is open, the running app keeps resolving files through the moved symlink, loads the next version's files mid-session and crashes. The packager can defer the move, but the app gives it no signal for when it has exited, so the deferred move only happens on some later, unrelated trigger.
Why it matters
Every background update that lands while the app is open risks a crash on that packager's installs. Without an exit signal the packager has two bad choices: move the link under the running app (crash), or leave it on the old version until something else happens to run (stale version, and a dead launcher once the old version is cleaned up).
Not a goal
What changed (motivation → approach → change)
will-quitis the point where every window has closed and the quit can no longer be cancelled, so a vetoed quit never runs the command. The command is started detached and not awaited, so quit never waits on a package manager, and it gets the app's pid so it can wait for the exit itself.website/electron/auto-update.js: the marker reader parses an optionalquitCommand(trimmed, capped at 512 like the other commands, refused with the rest of the metadata when the marker is rewritable).website/electron/runtime/update/managed-lane.js: on the managed lane,app.once("will-quit")(skipped while an update apply is in flight) spawns it with the pinned shell,cwd=/, the constructed environment plusKIROCREW_QUITTING_PID,detached,stdio: "ignore", thenunref(). A quit that applies an update ends withapp.exit(), which skipswill-quit, so the two never both run.packaging/build-desktop.sh: the baked-marker validator acceptsquitCommandwith the same cap.docs/build/desktop-app.md: documents the field and when it does and does not run.Backwards compatibility
Compatible: the field is optional; a marker without it behaves exactly as before, and a bare marker (no
updateCommand) still runs nothing.Removes nothing: the change only adds an optional field and an optional quit hook.
Tests
website/electron/test/auto-update.test.jsmanaged quitCommand: started detached on will-quit with the quitting pid: exactly onewill-quithook, nothing runs before quit, then the command runs detached withstdio: "ignore",cwd=/, the narrowedPATH, noHOME,KIROCREW_QUITTING_PID= the app pid, and isunref'd. Fails if the hook is not registered ordetachedis false.managed quitCommand: not started while an apply is still running: an in-flightupdateCommandsuppresses the quit command. Fails without themanagedInstallingguard.managed quitCommand: absent -> no will-quit hook.managed quitCommand: a marker with no updateCommand runs nothing at quit.quitCommandin the parsed shape, the cap test covers it, and the rewritable-marker test shows an attacker'squitCommandis dropped with the rest.test/test_build_desktop_managed_marker.py: the valid fixture carriesquitCommand, an over-capquitCommandfails the build, and the validator's cap literal is pinned toQUIT_COMMAND_MAX_CHARS.npm test --prefix website/electron: 2401 passed.test_build_desktop_managed_marker.py: 19 passed.Manual verification
Real Electron 43.2.0 on Linux (unpackaged,
--ozone-platform=headless), drivinginitAutoUpdatewith the realappand a managed marker whosequitCommandwaits forKIROCREW_QUITTING_PIDto exit and then writes a sentinel:app.quit(): the sentinel appeared after Electron exited, naming the app's pid, withHOMEunset. Sowill-quitfired, the detached child outlived the app, and it waited for the exit.app.exit(0): no sentinel. The update-applying quit path does not run the command.Not run: a packaged macOS or Windows build. The lane runs the same code unpackaged (the marker gate precedes the
isPackagedcheck), so packaging should not change these results, but no packaged build has been checked.Related Issues
N/A
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)Contribution License Agreement