Expand description
The note each agent gets when it resumes after AgentMux was upgraded
(docs/specs/SPEC_UPGRADE_FOR_USERS_AND_AGENTS_2026_10_15.md §5.2,
phase 4b): [AgentMux] AgentMux was upgraded from 0.59.26 to 0.59.27 …,
once per agent, with the first message it gets after it resumes: the note
asks nothing of it, so it starts no turn (reactive::held_notes). The
agent that asked for the upgrade (App upgrade) gets it too, which is
how it learns it is done.
srv records the version it runs in the channel folder (RECORD_FILE,
like cli_notice’s CLI versions): an installed build’s data folder is
per version, so the new version’s own would read as a first start. A
start on a newer version than the one recorded is an upgrade; a first
start, the same version or an older one (a downgrade, or the older build
started again) is not. The record keeps the upgrade, and the agents already
told, for PENDING_FOR: a crash or another restart soon after still
tells the agents not yet told, and never one twice. An agent is named by its
definition id, not its pane: a quit deletes the panes, and a restart restores
each agent into a pane with a new id.
Every agent that registers with the reactive handler, whatever runs it, is
a candidate (on_registered): the note goes to one whose pane has a
session (agent:sessionid) as it registers, i.e. a resumed one, not a new
pane. That is read from its block then ([has_session]), not from a list
made at start: the quit that precedes an upgrade deletes the panes, and the
next start restores them into new blocks once srv is up.
Structs§
- Started
- This start of srv: its version, when it began and, only when this very start made an upgrade, the version it came from. A restart soon after an upgrade is no new upgrade, though the note to the agents still counts it as one.
- Upgraded
- This start is (still announcing) an upgrade from
fromtoto, made atat_ms;notifiedare the panes told already.
Enums§
- Undelivered
- Why a note wasn’t delivered: the pane is gone, or it may be ready later.
Constants§
- INTERRUPTED_
FILE - The agents whose turn was running when AgentMux last quit, in the channel
folder (
record_interrupted). - PENDING_
FOR - How long after an upgrade resumed agents are still told.
- RECORD_
FILE - The last AgentMux version this channel ran, in its folder.
Functions§
- continue_
text - What an agent whose turn was cut off by the quit is told: unlike
note_text, it asks something of it, so it starts a turn.upgradeis the upgrade this start made, if any;quit_mswhen AgentMux quit. - deliver_
with_ retry deliveruntil it succeeds, at mostattemptstimes,gapapart; the last error when none does. A pane that is gone isn’t waited for.- init
- At srv start (
bootstrap::background): record this version and remember whether an upgrade is being announced and which agents’ turns the last quit cut off. - note_
text - The note, with the upgrade’s local time.
- observe_
start - Record that
versionstarted atnow_ms, and return the upgrade being announced, if any: this start’s, or one made less thanPENDING_FORago on this same version. A record that can’t be read or written is logged and treated as none: at worst a note is missed. - on_
registered - An agent registered in
block_id(any controller). If an upgrade is being announced and the pane is a resumed one not yet told, tell it, once; if its turn was cut off by the quit, tell it to carry on instead, which starts a turn. Called under the handler lock: no I/O here (the pane’s block is read, and the note sent, from a task of its own). - record_
interrupted - At quit, as each agent is closed (or all that are left when srv exits): add
the ones with a turn in flight (
agents, their ids) to the list the next start tells to carry on. A quit closes its agents one by one, so this adds to what the quit has recorded so far (a list over an hour old is dropped first). Unlike a note held for a turn, an interrupted turn is never continued by the CLI by itself on--resume. - this_
start - How this srv started, once
inithas run: what anapp.startedevent says.