Expand description
Runtime mode detection — single source of truth.
The launcher computes RuntimeMode::current once at startup and
propagates the result to host + srv via the AGENTMUX_RUNTIME_MODE
environment variable. No binary should call [current] more than
once per process; downstream binaries read the env var via
[from_env] instead.
Replaces the legacy mix of cfg!(debug_assertions), env::var ("AGENTMUX_DEV").is_ok(), and == Ok("1") checks across launcher,
host, and sidecar — which were each correct in isolation but
desynchronized in combination (see docs/specs/
SPEC_DATA_DIR_UNIFICATION_2026-05-05.md §2.1).
§Detection priority
AGENTMUX_RUNTIME_MODEenv override (testing, CI).- Marker-based portable detection: an
agentmux-portable.markerfile written byscripts/package-portable.sh. Looked for next to the detecting exe, one level down inruntime/(the packaging puts it there to keep the extract root clean; the launcher is at the root and the host/srv run fromruntime/), and two levels up for macOS .app bundles. - Path-based dev detection: exe is under a known dev-build dir
(
dist/cef-dev/,target/debug/,target/release/). AGENTMUX_DEV_BRANCHenv override (CI override for dev mode).- Default:
Installed.
Enums§
- Runtime
Mode - Where this AgentMux binary is running from. Determines data path
layout (see
crate::DataPaths).
Functions§
- derive_
clone_ id - Walk up from
exe_dirlooking for a workspace-root marker, then hash that absolute (canonical) path with FNV-1a and return a 16-char hex string. Used as the per-clone discriminator in~/.agentmux/dev/<branch>/<clone_id>/. ReturnsNoneif no marker is found (extreme edge case —task devalways runs from inside a clone with.git/Cargo.toml/Taskfile.yml). - is_
dev_ build_ exe - True when this binary is running from one of our known dev-build
output directories (
dist/cef-dev/,target/debug/,target/release/). Walks ancestors to handle nested cases (CEF subprocesses run from aruntime/subdir even in dev). Path-only — does not read env. - is_
dev_ self - True iff THIS binary is a source-tree /
task devbuild, determined from the binary’s path + portable marker viaRuntimeMode::current_path_only— NOT fromAGENTMUX_RUNTIME_MODE. A runningtask devAgentMux exportsAGENTMUX_RUNTIME_MODE=dev:<branch>into its environment, which every descendant process inherits; a packaged build launched from a terminal / agent pane inside a dev instance would otherwise mis-identify as Dev (e.g. the “DEV” status-bar badge on a release build). Build identity is a property of the binary on disk, not of whoever launched it.