Skip to content

Bug: run_shell_command hangs for 5 mins on interactive/slow commands (! Shell awaiting input) #24707

@jyongchul

Description

@jyongchul

Bug Description

When an AI agent uses the run_shell_command tool in Gemini CLI, it is granted a hardcoded 5-minute timeout. If the AI executes a command that requires interactive input (e.g., git pull waiting for credentials) or is extremely slow (e.g., grep -r on a large NTFS drive via WSL), the CLI opens an interactive PTY showing:

! Shell awaiting input (Tab to focus)

However, the AI agent is completely blocked and unaware that it should provide input or cancel the command. It just hangs silently until the 5-minute timeout is reached, severely disrupting automated workflows.

Expected Behavior

  1. Provide an option in settings.json (e.g., shell.disablePtyForAgents: true) to force commands to run non-interactively (e.g., automatically appending < /dev/null).
  2. Provide a shorter, configurable timeout for run_shell_command so agents can fail fast and try a different approach instead of waiting 5 minutes.

Current Workaround

Users have to manually instruct the system prompt (Master Instruction) to forbid agents from using grep -rn via the shell and instead force them to use native MCP tools (grep_search), or explicitly tell the agent to ALWAYS append < /dev/null to commands.

Submitted automatically via Gemini CLI.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/agentIssues related to Core Agent, Tools, Memory, Sub-Agents, Hooks, Agent Qualitystatus/need-triageIssues that need to be triaged by the triage automation.status/possible-duplicate

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions