···253253254254 # Auto-start tmux for new sessions
255255 # Check if we're already in tmux (even through sudo)
256256- if [[ "$TERM" != "linux" && -z "$TMUX" && "$TERM" != "dumb" ]]; then
256256+ # Only run in interactive shells — non-interactive SSH commands must not exec tmux
257257+ if [[ -o interactive && "$TERM" != "linux" && -z "$TMUX" && "$TERM" != "dumb" ]]; then
257258 # Check if we're inside tmux by looking for tmux in the process tree
258259 in_tmux=false
259260 pid=$$