[BUG] Bash tool hangs indefinitely on 'git remote show origin' — blocks session and remote-control clients
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?
The Bash tool hung indefinitely while running git remote show origin | grep "HEAD branch" | awk '{print $NF}' (used to detect the base branch). This command makes a live network call to the remote even when run locally, and blocked without any timeout.
As a consequence, the entire session stopped responding — including a connected mobile remote-control client, which received no reply even after sending follow-up messages. Only pressing ESC on the desktop unblocked the session.
What Should Happen?
The Bash tool should apply a default timeout to commands that may block on network I/O, or surface a timeout error after a reasonable wait (e.g., 30s) so the session can recover.
Error Messages/Logs
No error output. The tool call displayed:
Bash — Detect base branch: git remote show origin | grep "HEAD branch" | awk '{print $NF}'
...and never completed.
Steps to Reproduce
- Open Claude Code in VS Code integrated terminal
- Connect a mobile remote-control client to the session
- From mobile, send a message that triggers auto-detection of the git base branch (e.g., invoking
/run-autonomous) - Claude Code runs
git remote show originvia the Bash tool - If the SSH/HTTPS connection to the remote is slow or unresponsive, the command hangs indefinitely
- The desktop session is blocked; the mobile client receives no response to any further messages
Claude Model
Sonnet (default)
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.96 (Claude Code)
Platform
Anthropic API
Operating System
Other Linux (Arch Linux)
Terminal/Shell
VS Code integrated terminal
Additional Information
git remote show originqueries the remote server even when run locally — unlikegit remote get-url originwhich reads local config only- A safer alternative for base branch detection that avoids network calls:
git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null | sed 's@^refs/remotes/origin/@@' - The Bash tool has no visible timeout mechanism — any blocking command (network I/O, interactive prompts) can freeze a session indefinitely
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗