Expand description
“Upgrade & restart” (docs/specs/SPEC_UPGRADE_FOR_USERS_AND_AGENTS_2026_10_15.md
§4.1, phases 3b, 3c and 3d): restart a Windows portable into the newer
release srv downloaded, verified and unpacked next to it, run the newer
release’s installer on a setup.exe install, or replace a macOS
AgentMux.app from the release’s .dmg (upgrade_macos;
backend/update/download.rs).
srv asks with an AGENTMUXSRV-UPGRADE line on its stderr
(agentmux_common::srv_stderr); the reader in srv_spawner hands it here.
The supervisor then:
- checks what srv names again (
staged): an AgentMux portable of exactly that version, newer than this one, beside a portable; or that version’s installer, with the release’s digest, in this version’s ownupdates/<v>/, on asetup.exeinstall; - goes ahead when srv marks the request confirmed (the restart was decided
in the app: the user’s own click or turn, or an approved request’s in-app
countdown with no veto); a request without the mark, from an older srv, is
asked with a native dialog (
confirm), which no page or agent tool in AgentMux can click; - quits the host the way the tray’s Quit does, which closes the windows and saves the session;
- after srv has stopped (so the new version copies complete data,
srv/src/migrations/carry_forward.rs), starts the new launcher, or a hidden PowerShell that waits for this launcher to be gone, runs the installer silently and starts AgentMux again (relaunch), and exits.
Enums§
- Dialog
Outcome 🔒 - How the restart question ended.
- Staged
- What a confirmed upgrade restarts into.
Constants§
- ANSWER_
WITHIN - A Yes counts only this long after its dialog opened (the dialog itself
can’t time out). Shorter than srv’s wait (
RESTART_GRACE, 3 minutes insrv/src/backend/update/restart.rs), so by the time the panel says the restart didn’t happen, no open dialog can still start one. - CONFIRMED_
FOR - A confirmed restart that hasn’t happened within this long (the host never quit) no longer restarts into the new version on a later quit.
- DIALOG_
TITLE 🔒 - KEPT_
ENV 🔒 - The variables that say WHICH data the launcher uses: the root, the config folder and the channel. The restart keeps them: an instance a person pointed at a root of its own (a test, a second profile) must come back on that root, not on the machine’s real channel, which the next version would then migrate.
Statics§
- DIALOG_
THREAD 🔒 - The thread showing the open dialog, 0 when none (Windows).
- LATEST_
ASK 🔒 - The latest request asked about: only its dialog’s Yes counts.
- REQUESTS 🔒
Functions§
- answer_
counts 🔒 - Whether a Yes to request
ask, givenwaitedafter its dialog opened, still counts whenlatestis the newest request. - ask_
then - Restart as srv asked, on a thread of its own. When the restart is
confirmed(srv’s line says so: the user’s own click or turn, or an approved request whose in-app countdown ran out with no veto) nothing more is asked: no native dialog, so a computer nobody sits at restarts. The staged file was checked again before this (staged), and on a.debor.rpminstall the OS’s own permission prompt still stands: that one is the system’s, not a question of ours. A request that does not say it is confirmed is asked about, andon_yesis called only for an explicit Yes that still counts (answer_counts): one given withinANSWER_WITHIN, to the latest request. One dialog at a time: a newer request closes the open one, and a dialog closes itself (as No) once its time is up. A Yes that slips past either is told it expired.stoppinglists what agents left running that the restart stops (stopping_note); the dialog names it.host_pidis the host’s process id: on Windows the dialog sits over the host’s window, so it comes up in front of the person instead of waiting on the taskbar. - check_
package 🔒 - confirm 🔒
- Linux: zenity or kdialog (
upgrade_linux::confirm). Shows the AppImage, or the portable’s folder. For a.debor.rpm, a Yes is followed by the desktop’s password prompt (upgrade_package::authorize), and counts only once the install helper has accepted the file and is waiting for this launcher to quit. - confirmed_
go 🔒 - Whether to go on with a restart srv says is decided: always, except on a
.debor.rpminstall, where the OS’s own permission prompt for the install is asked here and may be refused or go unanswered. - confirmed_
outcome 🔒 - How a decided restart went: on, or (the permission prompt of a package install said no, or was not answered within
ANSWER_WITHIN) not. - current_
thread 🔒 - Off Windows, an id of its own for each dialog, so a superseded dialog’s timer never closes a newer one.
- dialog_
outcome 🔒 - What became of the question:
yesis the dialog’s answer,timed_outthat the timer closed it,askthis request’s number andlatestthe newest one’s,waitedhow long it was open. - dismiss 🔒
- Close the open dialog; the callers check
threadis its. - encoded_
command 🔒 -EncodedCommand’s form ofscript(base64 of UTF-16LE): the paths in it reach PowerShell as they are, through no shell’s parsing.- env_
to_ 🔒strip - The variables of
varsthe restart strips:AGENTMUXwould make the next launcher think it was started from a pane, and the otherAGENTMUX_*this launcher (or a parent) set (background service, tray) would override the next one’s settings.KEPT_ENVstays. - file_
sha256 🔒 - The file’s SHA-256 in lowercase hex, or
Noneif it can’t be read. - forward
- From the srv stderr reader.
- has_
uninstaller 🔒 - Whether
dirholds Inno Setup’s uninstaller (unins000.exe, …): asetup.exeinstall. - installer_
script 🔒 - The hidden PowerShell that upgrades a
setup.exeinstall: wait a few seconds for this launcher to be gone (its files are replaced), run the installer silently, then start AgentMux again whatever the installer did, so a failed or declined install leaves the old version running, not none. - is_
portable 🔒 - A portable folder.
setup.exeinstalls the sameruntime/, marker and all, so a folder with Inno Setup’s uninstaller isn’t one. - is_
sha256_ 🔒hex - 64 lowercase hex digits: all that is ever put in the script.
- powershell_
exe 🔒 - Windows PowerShell by its full path, never whatever is first on
PATH. - ps_
quote 🔒 pathas a PowerShell single-quoted string: nothing in it is expanded (no$, no%VAR%). Every character PowerShell takes as a single quote is written twice:'and the typographic ones (U+2018 to U+201B), which a user name can hold.- relaunch
- Restart into
staged, detached, without this AgentMux’s own environment except where it keeps its data (KEPT_ENV). - relaunch_
with_ 🔒env relaunchwith the environment it was started in given, so a test can say what the old launcher had without changing this process’s.- requests
- The supervisor’s end of srv’s upgrade requests. One per process: it lasts across srv respawns, since the reader of each new srv sends here too.
- restart_
env 🔒 - What a process started to bring AgentMux back up gets for an environment:
vars(this process’s), less what the next version must not inherit (env_to_strip,crate::upgrade_linux::NOT_INHERITED), and on Unix AppImageLauncher off. - restart_
question 🔒 - The question for a restart into the new version at
from. - staged
- What to restart into, if
reqnames a newer release thanown_versionthat fits this install (inown_dir, with its data indata_dirand its channel inchannel_dir): a portable of exactly that version beside a portable (or, on Linux, where srv unpacked it,upgrade_linux), or that version’s installer in this version’s ownupdates/<v>/on asetup.exeinstall. - still_
confirmed - Whether a restart confirmed at
atstill stands. - stopping_
note - The list srv leaves beside the staged update (
updates/stopping.txtin this version’s data folder; srv’sbackground_work) of what agents left running that the restart stops: a dev server, another AgentMux. One written more than 15 minutes ago is from an earlier attempt and ignored. - stopping_
paragraph 🔒 - The dialog’s paragraph naming what the restart stops, or nothing.
- version_
core 🔒 major.minor.patch, orNone.- write_
declined 🔒 - Tell srv the restart it asked for won’t happen, and why
([
agentmux_common::srv_stderr::UPGRADE_DECLINED_FILE]): it is waiting on this launcher and would otherwise say “Restarting” for minutes after a No.