Agent bash shells should not source user .bashrc/.bash_profile
Bug
Agent-spawned bash shells source the user's full ~/.bashrc and ~/.bash_profile on startup. This caused 7000+ runaway bash processes and forced a full machine restart, killing all running work. This caused irreparable damage to my system.
Root cause
My .bashrc contained source <(ng completion script) — a line auto-added by Angular CLI. This command is known to hang in non-interactive shells. When Claude Code spawned multiple agents, each agent initialized a bash shell, each shell sourced .bashrc, each hung on the ng completion command, and the processes cascaded.
Environment
- Windows 11, Git Bash (MINGW)
- Claude Code CLI
Expected behavior
Agent shells are non-interactive worker processes. They should not source user shell config (.bashrc, .bash_profile, .profile). They don't need completions, aliases, prompt customization, or any interactive shell setup. Sourcing these files is a liability — any slow, hanging, or process-spawning command in user shell config becomes a bomb when multiplied across parallel agents.
Suggested fix
Spawn agent bash shells with --norc --noprofile, or use env -i bash --norc --noprofile to get a clean environment. Pass only the minimal required env vars (PATH, HOME, etc.) explicitly.
Workaround
Removed the offending line from .bashrc. But this is fragile — any future addition to shell config could trigger the same issue.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗