#453
Guard Powerlevel10k / gitstatusd against daemon accumulation in agent subshells
Summary
In multi-agent and swarm environments (running Codex, Claude Code, OMP, tmux workers), agents frequently invoke subshells with -l -i (e.g., /usr/bin/zsh -l -i -c "$AGENT_PAYLOAD"). Because ~/.zshrc unconditionally sources $HOME/.acfs/zsh/acfs.zshrc, which initializes Powerlevel10k, every automated subshell invocation spawns a dedicated 4-thread gitstatusd daemon (/tmp/gitstatus.POWERLEVEL9K.<UID>.<PID>...).
On a heavily-used development workstation or multi-agent host, this leads to:
- Massive process accumulation: 60–100+ concurrent
gitstatusdinstances left running across tmux panes and subshell sessions. - Severe I/O and page cache contention: Dozens of
gitstatusddaemons continuously query and stat the exact same.gitindices and worktrees simultaneously, contributing to kernel IO wait spikes (folio_wait_bit_common) and disk thrashing. - Wasted resources: Non-interactive or agent-automated subshells have no human prompt to display, making
p10kandgitstatusdcompletely unnecessary in these sessions.
Proposed Fix in ACFS Zsh Configuration
In $HOME/.acfs/zsh/acfs.zshrc (or wherever prompt themes are initialized), guard Powerlevel10k / gitstatusd initialization so it only starts when running in a genuine interactive human terminal (stdout is a TTY and no agent execution payload is present):
# Skip heavy prompt daemons (p10k / gitstatusd) for non-interactive shells or agent subshell wrappers
if [[ ! -t 1 ]] || [[ -n "$CODEX_REMOTE_PAYLOAD" ]] || [[ -n "$SIFS_AGENT" ]] || [[ -n "$AGENT_ENV" ]]; then
export GITSTATUS_ENABLE_DAEMON=0
fiEnvironment
- ACFS on Ubuntu 24.04 / Debian / Linux
- Multi-agent orchestrators (Codex, Claude, OMP, tmux swarms)
Measured on five busy multi-agent ACFS hosts (tmux swarms): 6, 21, 25, 49 and 62 gitstatusd daemons, about 33 threads each, 7 MB average RSS on the busiest host. On the busiest host, all 62 have an interactive login
zshwith a TTY as their parent, one per tmux pane. None come from TTY-less agent subshells. So here the count tracks open panes, not leaked automation shells.Two notes on the proposed guard:
GITSTATUS_ENABLE_DAEMONis not a Powerlevel10k/gitstatus variable, so it would be a no-op. The real switch isPOWERLEVEL9K_DISABLE_GITSTATUS=true, set before p10k loads.[[ ! -t 1 ]]wouldn't touch pane shells, which are the ones that accumulate.If the goal is fewer daemons on agent hosts, two options are cheap and safe. Either set
POWERLEVEL9K_DISABLE_GITSTATUS=truewhen the shell has no TTY ([[ ! -t 0 || ! -t 1 ]]). Or capGITSTATUS_NUM_THREADS(e.g. 2) for every shell, since one prompt's status needs nowhere near ~33 threads. The second option removes most of the thread count without changing any prompt.