Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

Fixing Oh My Zsh Subshell Latency in Coding Agent CLI Runners

Description and use

Autonomous coding agents spawn subshells that inherit Oh My Zsh initialization, causing latency. Adding an early‑exit guard in ~/.zshrc and exporting AGENT_RUNNER reduces subshell launch time from 680 ms to 14 ms.

Problem

Autonomous coding agents spawn subshells that inherit Oh My Zsh initialization, causing significant latency per command.

Outcome

Subshell latency reduced from ~680 ms to ~14 ms per launch, cutting cumulative idle time in multi‑step agent workflows by over 30 seconds.

Workflow

  • 1. Benchmark current subshell startup: time for i in {1..10}; do zsh -i -c exit; done
  • 2. Add guard at top of ~/.zshrc: if [[ -n "$AGENT_RUNNER" || $- != *i* ]]; then export PATH="$HOME/.local/bin:$PATH"; return 0; fi
  • 3. Configure agent runner to export AGENT_RUNNER=1 in its environment
  • 4. Verify reduced latency with the benchmark command

Evidence

10 spawns averaged 6.8 seconds (~680ms per shell).

Source

Subshell spin‑up immediately drops from ~680ms to ~14ms.

Source

  • Record date: 2026-10-07T20:41:20.282Z