Skip to main content

resolve_shared_store_path

Function resolve_shared_store_path 

Source
pub fn resolve_shared_store_path() -> Option<PathBuf>
Expand description

Resolve ~/.agentmux/shared/store.db — the global store for accounts, bundles, drone definitions, and MuxBus credentials.

Uses the same root as the agent registry/definitions so AGENTMUX_HOME_OVERRIDE and AGENTMUX_SHARED_DIR work consistently. Returns None only when the shared root itself can’t be resolved.

When agentmux_common::isolated_auth_enabled() is set, resolves to <instance_dir>/identity-store.db instead — a channel-scoped store for destructive account testing (delete-account flows) that can never touch the real global store other channels/instances depend on. Falls back to the global path if AGENTMUX_INSTANCE_DIR isn’t set (e.g. a bare cargo run outside the launcher) rather than failing outright — this function’s existing None-on-unresolvable contract is preserved, just with an extra source to try first. See docs/specs/SPEC_ISOLATED_AUTH_DEV_TESTING_2026_07_27.md.

IMPORTANT: MigrationContext.home (migrations/runner.rs) must NEVER be derived from this function’s return value (e.g. via .parent().parent()) — it needs the unconditional global root regardless of isolation, and must call resolve_global_shared_root() directly instead. See that module’s comments.