Skip to main content

Module upgrade_notice

Module upgrade_notice 

Source
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 from to to, made at at_ms; notified are 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. upgrade is the upgrade this start made, if any; quit_ms when AgentMux quit.
deliver_with_retry
deliver until it succeeds, at most attempts times, gap apart; 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 version started at now_ms, and return the upgrade being announced, if any: this start’s, or one made less than PENDING_FOR ago 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 init has run: what an app.started event says.