Skip to main content

Module fleet

Module fleet 

Source
Expand description

One Global Memory for the fleet (task #12439, “agents operate other machines”, section 4.6).

A Global Memory entry with scope fleet (see storage::bundle_scope) is pushed to every proven machine with the remote ops memory.global.put and memory.global.remove, and a machine lists what it holds with memory.global.list so the other side can catch it up. This module is the machine-independent part: what an entry carries over the wire, which write wins, and applying a received write to the local store. The transport that carries the ops is server::remote_ops.

Last write wins. An entry’s updated_at is stamped by the machine that wrote it and kept as is on every machine that applies it, so all machines agree on it. The newer updated_at wins; on a tie the larger content hash wins, so every machine picks the same side. A removal is a write too: it carries the time it happened and wins or loses the same way, so an entry removed on one machine and edited later on another comes back.

What is not carried. skills, provider and model name things that exist per machine, sort_order is a position on one machine’s list, and mcp_servers is always empty. AgentMux’s own entries (system tier, seed- ids) and the blank bundle never leave or enter. A write for an entry that is machine scope here is skipped, so a machine keeps what its owner kept. The exception is an entry whose machine row is only the default the scope table gave what existed when it was made (storage::bundle_scope): a newer write replaces that one, the entry follows the fleet from then on, and the old text stays in its history. The write is answered adopted so the sender, and this machine’s sync state, can say which entries changed.

No echo. A write applied from another machine is recorded with source FLEET_SOURCE; the push on change (a later PR) does not push those back.

Structs§

Actor
Who a write is attributed to on this machine: the remote agent as slug@machine, and its uid when the transport knows it. Never the operator.
FleetEntry
A Global Memory entry as it travels between machines: memory.global.put’s params.
FleetMeta
What a machine holds for one entry, without its text: memory.global.list’s rows.
FleetRemoval
memory.global.remove’s params.

Enums§

Applied
FleetError
Outcome
Push
One thing to send a machine that is behind.
Skipped

Constants§

FLEET_SOURCE
The db_bundle_versions.source of a write that came from another machine.

Functions§

apply_put
Apply a write received from another machine.
apply_remove
Apply a removal received from another machine.
entry_for_push
One entry to send, if it follows the fleet and is still Global Memory.
fingerprint
A short fingerprint of what a machine lists: it changes when an entry is added, edited or removed, so the sync only talks to a peer when there is something new for it.
list_meta
The entries that follow the fleet, including those removed here since: memory.global.list’s answer.
removal_for_push
The removal of id to send, with who removed it here.
to_push
What to send a machine, given what each side lists, so it catches up: the entries it lacks or holds an older copy of, and the removals it has not seen. Newest first. What the other machine holds newer is that machine’s to push when it sees this one.