Skip to main content

Module logging

Module logging 

Source

Constantsยง

MAX_LOG_BYTES ๐Ÿ”’
Rotation cap for agentmux-launcher.log (SPEC_WIN10_PAGEFILE_OOM_CRASH_ 2026_06_29 P1). This file mirrors the srv subprocessโ€™s entire stderr stream verbatim, forever, with no rotation of its own โ€” left unbounded it grew to 406 MB across 69 days on a real machine, directly tightening the page-file ceiling the pagefile-OOM spec is about. 50 MB per file ร— 3 rotated files + the live file โ‰ˆ 200 MB worst case, versus unbounded.
MAX_ROTATED_FILES ๐Ÿ”’

Functionsยง

dirs_fallback_home ๐Ÿ”’
Home dir without depending on dirs for THIS specific lookup. Kept to avoid a dirs dep cycle from log() โ€” log() is called from data_dir::resolve_paths via failure paths, and we want it to work even if dirs itself is mid-failure.
log ๐Ÿ”’
Append a timestamped line to ~/.agentmux/logs/agentmux-launcher.log. Best-effort โ€” silently no-ops if the log dir doesnโ€™t exist yet.
rotate_if_oversized ๐Ÿ”’
Size-based rotation: agentmux-launcher.log -> .log.1 -> .log.2 -> .log.3 (oldest dropped), run once per log() call before appending. A metadata() stat per call is cheap relative to the disk write that follows; simplicity here matters more than shaving a syscall. Best-effort like log() itself โ€” any failure (permissions, concurrent access) just leaves the current file growing past the cap rather than losing log data or panicking.
rotated_path ๐Ÿ”’