Expand description
Unified data-path resolution for AgentMux.
Single source of truth for where state lives on disk. Replaces the launcher / host / sidecar trio of independent path computations (see docs/specs/archive/SPEC_DATA_DIR_UNIFICATION_2026-05-05.md §3) and the per-version isolation pattern it set up (data was keyed on the build version so My Agents reset on every patch bump). The current model keys data on a channel — a stable identifier that spans versions within the same compat band, so agents survive rebuilds. See docs/specs/SPEC_DATA_CHANNELS_2026_05_24.md and discussion #1026 for the channel design and rationale.
Layout:
~/.agentmux/
├── shared/ (cookies, credentials, account-wide)
├── channels/<channel>/ (installed + portable + custom)
│ ├── data/, config/, logs/, cef-cache/, agents/
│ └── runtime/ (lock + IPC, single instance per channel)
└── dev/<branch>/ (per-branch dev isolation)
└── (same children as channels/<channel>/)Channel resolution (via DataPaths::resolve):
AGENTMUX_CHANNEL=<name>env override wins forInstalled/Portablemodes — lets the operator point a released binary at any channel for parallel-channel testing.RuntimeMode::Installed/Portablew/o override → build-time default fromAGENTMUX_BUILD_CHANNEL_DEFAULT(set by the packaging script; defaults to"stable"if unset, e.g. forcargo run).RuntimeMode::Dev { branch }→ channel name isdev-<branch>for diagnostics; on-disk path stays at~/.agentmux/dev/<branch>/(NOT underchannels/). Both the host (agentmux-cef) and launcher (agentmux-launcher) useDataPaths::resolve_path_onlyfor dev builds to ignoreAGENTMUX_CHANNEL— a dev session launched from inside a parent agentmux pane mustn’t inherit the parent’s channel and break per-branch isolation. Channel override is intentionally NOT supported in dev mode; if you want a different channel, use a portable build.
Structs§
- Data
Paths - All paths a launcher / host / srv needs. Computed once by the launcher; downstream binaries read paths from env vars set by the launcher rather than recomputing (avoids the legacy desync risk where each binary made its own portable / dev-mode determination).
Enums§
- Isolated
Auth Reason - Which rule decided
isolated_auth_enabled’s result — for boot-time diagnostics (seebootstrap/stores.rs’s “shared store: attached” log line) so a developer staring at an empty Connectors → Accounts can tell at a glance whether that is an explicit choice, rather than re-deriving it from the env by hand. Callers that only need the boolean should useisolated_auth_enableddirectly — this exists purely so the two never drift (one resolution, two views). - Isolated
Muxbus Reconnect Reason - Which rule decided
isolated_muxbus_reconnect_enabled’s result — mirrorsIsolatedAuthReason/IsolatedSettingsReasonexactly, same rationale (one resolution, two views). - Isolated
Settings Reason - Which rule decided
isolated_settings_enabled’s result — for boot-time diagnostics, mirroringIsolatedAuthReasonexactly (see that type’s doc comment for the rationale: one resolution, two views, so the boolean and the log line can never drift apart). - Owner
Only Outcome - What
ensure_owner_only_dirdid.
Functions§
- agentmux_
root - The AgentMux root (
~/.agentmux) — the single resolver for it. - ensure_
history_ link - Best-effort: ensure
link_path(aprojects/subdirectory inside anisolated_auth_enabled-isolated provider credential dir) is a directory junction (Windows) / symlink (Unix) pointing attarget_dir(the always-globalDataPaths::identity_history_dir), so a provider’s session transcripts stay reachable across a channel/build change even though the credential directory around them is per-channel isolated. Seedocs/specs/SPEC_AGENT_IDENTITY_HISTORY_PERSISTENCE_PROTOCOL_2026_08_16.md§4.1. - ensure_
owner_ only_ dir - Make
dirowner-only on Unix: create it0700if missing (its parents with the normal umask — they are the user’s, not AgentMux’s), or strip group/other bits from an existing directory, keeping the owner bits as they were. SeeDataPaths::ensure_dirsfor why (#3682). - isolated_
auth_ enabled - Isolated per-channel auth (identity accounts + OAuth credential dirs).
Read directly at every call site rather than cached on
DataPathssoidentities_dir()behaves consistently regardless of whether the caller built itsDataPathsviaresolve()(launcher) orfrom_env()(downstream host/srv). - isolated_
auth_ reason - isolated_
muxbus_ reconnect_ enabled - Skip the automatic, EAGER MuxBus cloud-session reconnect
(
CloudSubscriber::init_global, called at boot) on a randomized per-build local-package channel. Seedocs/retro/retro-macos-0560-stale-cef-cache-launch-crash-2026-09-16.mdfor the incident this closes. - isolated_
muxbus_ reconnect_ reason - isolated_
settings_ enabled - Isolated per-channel
settings.json. Same shape and same reasoning asisolated_auth_enabled— seedocs/specs/SPEC_SETTINGS_ISOLATED_BY_CHANNEL_2026_08_19.md. - isolated_
settings_ reason