[BUG] Bash tool hangs indefinitely on 'git remote show origin' — blocks session and remote-control clients

Resolved 💬 3 comments Opened Apr 8, 2026 by vitalwarley Closed May 29, 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?

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

  1. Open Claude Code in VS Code integrated terminal
  2. Connect a mobile remote-control client to the session
  3. From mobile, send a message that triggers auto-detection of the git base branch (e.g., invoking /run-autonomous)
  4. Claude Code runs git remote show origin via the Bash tool
  5. If the SSH/HTTPS connection to the remote is slow or unresponsive, the command hangs indefinitely
  6. 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 origin queries the remote server even when run locally — unlike git remote get-url origin which 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

View original on GitHub ↗

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