Cursor AI Agent Gets Stuck in Diagnostic Loop Instead of Completing Tasks

Where does the bug appear (feature/product)?

Background Agent (GitHub, Slack, Web, Linear)

Describe the Bug

The screenshot highlights several issues encountered with Cursor AI IDE during the execution of an autonomous development task. Instead of successfully completing the requested workflow — including creating a GitHub repository, initializing Git, committing the project, pushing the code, and generating a detailed README file — the agent became stuck in a repetitive diagnostic and investigation loop. Cursor repeatedly displayed messages such as “Diagnosing why Cursor shows Taking longer than expected” and “Investigating what’s blocking progress,” indicating that the system was unable to progress from the reasoning phase to actual task execution. The logs also suggest that some terminal commands or background processes were hanging or timing out, potentially due to GitHub authentication problems, blocked shell commands, hidden credential prompts, or unstable subprocess execution. Furthermore, the agent continuously scanned files, searched directories, and analyzed configuration files instead of following the original execution plan, demonstrating a loss of task orchestration and workflow continuity. This behavior reflects limitations in Cursor’s autonomous agent system, particularly when handling long-running commands, external authentication requirements, large workspaces, or complex

Steps to Reproduce

To reproduce this issue in Cursor AI IDE, you can create a scenario where the autonomous agent must execute a long multi-step workflow involving Git, GitHub, terminal commands, and project analysis inside a moderately complex workspace. The issue typically appears when the agent encounters blocked commands, authentication prompts, or unstable subprocesses. A reproducible setup would involve opening a large project (for example, a Django + AI agent + MCP/A2A workspace), enabling Cursor Agent mode, and asking it to perform an end-to-end DevOps task such as creating a new GitHub repository, initializing Git, generating documentation, committing files, and pushing the project remotely. If GitHub CLI authentication (gh auth login) is incomplete, SSH keys are missing, terminal permissions are restricted, or Git credentials require interactive confirmation, the agent will often enter an endless diagnostic loop instead of completing the task. Cursor then repeatedly scans files, reads .cursor/settings.json, performs recursive searches, launches background commands, and displays messages like “Taking longer than expected,” “Investigating what’s blocking progress,” or “Waiting for command to finish.” The issue becomes even easier to reproduce when the workspace contains many files, virtual environments (.venv), node_modules, generated artifacts, or MCP servers that increase indexing and orchestration complexity.

Screenshots / Screen Recordings

Operating System

MacOS

Version Information

Version: 3.5.38 (Universal)
VSCode Version: 1.105.1
Commit: 009bb5a3600dd98fe1c1f25798f767f686e14750
Date: 2026-05-26T21:32:06.537Z (1 day ago)
Layout: editor
Build Type: Stable
Release Track: Default
Electron: 39.8.1
Chromium: 142.0.7444.265
Node.js: 22.22.1
V8: 14.2.231.22-electron.0
OS: Darwin arm64 25.5.0

For AI issues: which model did you use?

Auto model

Does this stop you from using Cursor

Sometimes - I can sometimes use Cursor

Hey, thanks for the detailed report. I can see the screenshot with the “Diagnosing…” and “Investigating what’s blocking progress” loop.

There are two related issues here:

  1. The terminal gets stuck on interactive prompts. When the agent runs gh auth login, git push over HTTPS, or anything that needs an SSH passphrase, the command waits for user input that the agent can’t provide. The terminal tool never returns a result and hangs.

  2. Self-diagnostic loop. When tool calls in a row don’t return a result, the model starts “investigating” its own stuck state, like scanning files or reading .cursor/settings.json, instead of aborting. This is known behavior on our side, and we don’t have an ETA for a fix yet.

Workaround for your case, pushing to GitHub:

  • Set up gh auth login ahead of time in a normal terminal, not via the agent, then check gh auth status
  • Or set up an SSH key with no passphrase, or add it to ssh-agent, and use an SSH remote instead of HTTPS
  • For large workspaces with .venv or node_modules, add them to .cursorignore to avoid bloating indexing

After auth is set up, retry the same task. The agent should be able to push without getting blocked.

This symptom is tracked in the canonical thread, you can subscribe for updates: My chats are just hanging with "Planning next moves" and "Taking longer than expected..."