Skip to main content

agentmux_root

Function agentmux_root 

Source
pub fn agentmux_root() -> Result<PathBuf, String>
Expand description

The AgentMux root (~/.agentmux) — the single resolver for it.

Public because srv had its own copy (backend/base.rs::get_mux_data_dir) reading a different env var and failing differently: where this returns Err, that one fell back to PathBuf::from("/"), so a host with no resolvable home directory wrote to /.agentmux instead of refusing. A10 of docs/analysis/TRACKING_ARCHITECTURE_REFACTOR_A1_A15_2026_06_18.md.

Two env vars are honoured, in this order, because both already exist in the wild and silently dropping either would move where a live install finds its data:

  • AGENTMUX_HOME_OVERRIDE — this module’s own, used by tests.
  • AGENTMUX_DATA_HOME — srv’s own, read at startup and relied on by the MSIX packaging path (blockcontroller/shell/lifecycle.rs). It is deliberately stripped from pane environments, not exported into them: it is one of the identity vars invariant I7 removes so a pane cannot inherit and resolve another instance’s data dir (backend/pane_env.rs, test the_identity_vars_that_caused_the_breach_are_stripped).

NOT to be confused with AGENTMUX_DATA_DIR, which the launcher exports and which names the per-channel data directory (<root>/channels/<channel>/data), not the root. The similar names are exactly why srv ended up with a second resolver.