Expand description
Two AgentMux installs of different versions must not write the shared stores together.
~/.agentmux/shared/ is account-wide on purpose: the agents’ definitions, history
(agents/transcripts/filestore.db), accounts and identities follow the person across installs
and channels. Each install is otherwise isolated, so a Store install and a portable one could
run side by side and both write those files, each with its own SQLite and schema.
Two guards:
- One writer version. Each srv that uses the shared folder takes the next place in
locks/srv-writers/<n>.json(its pid, start time, version and channel). A srv that finds a live srv of another version in an earlier place waitsWAITfor it to exit (an upgrade restarts srv, and the old one may still be leaving), and then runs without the shared folder, as it does when there is none: its agents, accounts and history are this channel’s own until it is restarted alone. It records an incident that says so. Same-version srvs share as before: one SQLite, one schema, WAL across processes. - A newer store than this build. A store whose
user_versionis above this build’s was refused already (check_schema_compat) and the srv fell back, with a line in the log only. It now records an incident too, so the person is told to update.
A srv that registered later never makes an earlier one defer, so the earliest live srv of a version keeps the folder for as long as it runs. The order is the order of registration, not process age: a srv that started later but registered first is the owner.
Functions§
- claim_
at_ boot - Claim the shared folder for this srv, or give it up to an earlier srv of another version. Before any shared store is opened. A srv with no shared folder (a bare run) has nothing to claim.
- note_
open_ failure - A shared store that did not open: when it is because the files are newer than this build, say so.
- shared_
dir - The account-wide shared folder for the files srv keeps there itself (bookmarks, browser profiles,
layouts, task media), or
Nonewhile this srv has given the folder up, as with the shared stores.