[BUG] Claude Code auto-backgrounds Bash commands containing cd + piped chains, causing permanent deadlocks

Resolved 💬 4 comments Opened Mar 31, 2026 by binod Closed May 10, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

Claude Code auto-backgrounds Bash commands containing cd + piped chains, causing permanent deadlocks

Key details for the report:

  • cd /path && rg ... | wc -l && rg ... | wc -l → auto-backgrounded, deadlocks forever
  • Same command without cd (using absolute paths) → completes in seconds
  • timeout parameter is ignored once auto-backgrounded — no kill timer
  • run_in_background is NOT set — Claude Code decides on its own
  • Orphaned processes survive indefinitely (we found 16+ hour old zombies)
  • Reproducible on macOS, Claude Code v2.1.77, claude-opus-4-6

What Should Happen?

There should not be any deadlocks.

Error Messages/Logs

Steps to Reproduce

Key details for the report:

  • cd /path && rg ... | wc -l && rg ... | wc -l → auto-backgrounded, deadlocks forever
  • Same command without cd (using absolute paths) → completes in seconds
  • timeout parameter is ignored once auto-backgrounded — no kill timer
  • run_in_background is NOT set — Claude Code decides on its own
  • Orphaned processes survive indefinitely (we found 16+ hour old zombies)
  • Reproducible on macOS, Claude Code v2.1.77, claude-opus-4-6

Claude Model

Opus

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

v2.1.77

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

_No response_

View original on GitHub ↗

This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗