Where does the bug appear (feature/product)?
Cursor IDE
Describe the Bug
When the Agent runs shell commands via the built-in Shell tool, Terminal tabs often remain listed as “∞ Cursor (command…)” even after the command finishes, times out, is aborted in chat, or has no live OS process (ps shows nothing to kill).
Symptoms:
- Agent shell commands hang or return empty output
- Commands may be moved to background or show “terminated_by_user” / “aborted”
- Terminal panel keeps stale “∞ Cursor (command…)” rows (ghost shells)
- Aborting in chat does NOT remove those terminal tabs
- After several ghost tabs accumulate, new Agent shell spawns often fail or hang until the user manually trash-cans the ghost rows
- The SAME commands work normally in a user-opened terminal in the same workspace (same cwd, same env)
Environment: - OS: Linux on WSL2 (linux 5.15.167.4-microsoft-standard-WSL2)
- Shell: bash
- Workspace: WSL path (/home/droot/projects/myproject)
- Context: Agent mode, built-in Shell tool (block_until_ms, background on timeout)
Example commands that triggered this: - php artisan test --filter AiAssistant
- php artisan tinker --execute=“…”
- git status / git fetch
- even short commands like: sed -n ‘97p’ file | xxd | head
Impact: Agent cannot reliably run tests, git, or diagnostics; user must run commands manually in a normal terminal tab.
Steps to Reproduce
- Open a workspace on WSL2 (Remote/WSL: \wsl.localhost... or “Open in WSL”).
- Start an Agent chat and ask it to run shell commands (e.g. php artisan test, git status, or a short sed/xxd command).
- Repeat several times, or let some runs hit timeout / background / abort in chat.
- Observe Terminal panel: multiple rows labeled “∞ Cursor (command…)” remain as if still running.
- Check host: ps may show no matching process for those tabs.
- Ask Agent to run another shell command → often hangs, returns empty output, or fails to spawn until ghost “∞ Cursor” tabs are manually deleted (trash can).
- Control: run the same command in a user-created terminal tab → completes normally.
Expected Behavior
- Agent runs a command (git, php artisan test, etc.).
- When the process exits—or the user aborts the Agent action—the Terminal tab closes or clearly shows “completed”.
- Aborting in chat should tear down the associated Agent terminal session/tab.
- The next Agent shell spawn should start cleanly and return stdout/stderr.
- Stale terminal rows should not block subsequent Agent shell spawns when no OS process is running.
Operating System
Linux
Version Information
WSL2 on Windows 11
Version: 3.16.29 (user setup)
VS Code Extension API: 1.128.0
Commit: 6246455961129c32969845e00aa25d87ae926ec0
Date: 2026-08-18T01:26:26.285Z
Layout: Agent Window
Build Type: Stable
Release Track: Default
Electron: 40.10.3
Chromium: 144.0.7559.236
Node.js: 24.15.0
V8: 14.4.258.32-electron.0
xterm.js: 6.1.0-beta.291
OS: Windows_NT x64 10.0.26200
For AI issues: which model did you use?
Agent / Auto (Cursor Agent with built-in Shell tool). Issue is with Agent terminal lifecycle, not model output quality.
For AI issues: add Request ID with privacy disabled
[Leave blank unless you have one from a failed Agent run: Chat → … → Copy Request ID]
Additional Information
Possible contributing factor on WSL: non-interactive bash startup (~/.ssh/ensure-ssh-agent.sh via BASH_ENV / .bashrc) can hang if ssh-add -l blocks on a bad agent socket — every Agent command then hangs with empty output. Even after fixing that, the main bug remains: ghost “∞ Cursor (command…)” tabs persist after abort/timeout with no process to kill, blocking the next Agent shell spawn.
Workaround: run commands in a normal user terminal tab; manually trash-can ghost “∞ Cursor” rows; avoid chaining many Agent shell calls when ghost tabs are present.
Request: properly tear down Agent terminal sessions on exit/abort/background; don’t leave ghost tabs; don’t let stale UI state block new Agent shell spawns.
Does this stop you from using Cursor
Sometimes - I can sometimes use Cursor