Skip to content

Long-running shell commands incorrectly trigger loop detection #19519

@LyalinDotCom

Description

@LyalinDotCom

What would you like to be added?

When the CLI executes a shell command that takes a significant amount of time to complete (such as a heavy grep search across a large directory), it incorrectly triggers the "potential loop detected" warning.

This results in a poor user experience. Instead of receiving clear feedback that a long shell process is currently executing, the user is left waiting, only to eventually receive a loop warning that makes the product feel buggy and unresponsive.

Steps to reproduce

  1. Run a command that takes a long time to return output but is not actually looping (e.g., a broad grep command like grep -ri "function call" packages/core/src/tools/definitions/ on a large codebase).
  2. Wait for the command to process.
  3. Observe the CLI prompt: ? A potential loop was detected with options to keep or disable loop detection.
  4. Note that the command also exits with code 1 in this state.

Why is this needed?

The CLI should differentiate between a single, long-running shell execution and actual repetitive, looping tool calls. If a command is legitimately taking a long time, the UI should reflect this with clear feedback (e.g., a "running..." spinner or status indicator) rather than halting with a loop detection error.

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    workstream-rollupLabel used to tag epics and features that are associated with one of the three primary workstreams🔒 maintainer only⛔ Do not contribute. Internal roadmap item.

    Type

    No fields configured for Bug.

    Projects

    Status

    Closed

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions