Expand description
Read-only detection of OTHER AgentMux (channel, version) instances
currently running on this machine, for diagnostic logging ONLY.
Scope note (task #35 / docs/specs/SPEC_WIN10_PAGEFILE_OOM_CRASH_2026_06_29.md
P1, “shut down old version on upgrade”): the original ask was a full
opt-in “close the old version?” prompt with a cross-instance graceful
quit. Investigation found that a cross-instance quit action is
currently blocked by invariant I4 in
docs/specs/SPEC_MULTI_INSTANCE_ISOLATION_HARDENING_2026_06_03.md
(“the only permitted interaction with another instance is the
authenticated open_new_window forward; it is side-effect-free w.r.t.
that instance’s lifecycle”) — extending that invariant is a design
decision that needs its own review, not something to fold into a
minimal patch. This module implements ONLY the read-only half:
- Enumerate sibling
(channel, version)directories on disk underchannels/. - Connect-probe each one’s single-instance pipe/socket — the SAME
kind of non-destructive liveness check
second_instance.rsalready performs for the CURRENT channel’s stale-socket recovery, just pointed at a different(channel, version)pair. A bare connect (no command sent) is side-effect-free w.r.t. the target’s lifecycle, consistent with I4. - Log (never prompt, never dialog, never contact the other instance beyond the liveness probe itself) when a LIVE, strictly OLDER version is found.
Every function here is best-effort: any failure (missing dir, unreadable entry, probe error) is treated as “nothing to report”, never a hard error. This is a diagnostic nicety — it must never block or fail this process’s own launch.
Structs§
- Sibling
Instance - A sibling
(channel, version)directory found on disk, distinct from the caller’s own. Liveness is NOT implied by construction — seelog_older_running_instances, which probes before logging.
Functions§
- enumerate_
sibling_ instances - Walk
<channels_root>/*/versions/*/and return every(channel, version)pair other than(own_channel, own_version). - is_
strictly_ 🔒older - True iff
candidateparses as strictly older thanown. Unparseable input on either side is never treated as older — fail quiet rather than risk a misleading log line. - log_
older_ running_ instances - Enumerate sibling instances, probe each for liveness, and log (via
crate::logging::log) every LIVE instance running a strictly OLDER version thanown_version. Never prompts, never blocks, never sends anything beyond the liveness probe itself. Intended to be called from a detached/spawned task at startup — every failure path here is a no-op, so there is nothing for the caller to react to. - parse_
semver_ 🔒core - Parse a leading
major.minor.patchout of a version string, ignoring any-prereleaseor+buildsuffix. ReturnsNonefor anything that doesn’t start with three dot-separated integers (e.g. a local build’s labeled version, which normally lives in alocal-*channel rather than under a releasedstablechannel anyway). Callers must treatNoneas “can’t compare” — never guess. - probe_
liveness 🔒 - Unix equivalent: a plain
connect()either finds a listening peer or doesn’t. Mirrors the probesecond_instance.rs::bind_socket_with_recoveryalready performs for the current channel’s stale-socket recovery.