[BUG] AI Assistant Terminal Commands Never Auto-Complete

[BUG] AI Assistant Terminal Commands Never Auto-Complete

:bug: Problem Description

When Cursor’s AI assistant executes terminal commands using the run_terminal_cmd tool, commands execute successfully and display correct output, but Cursor never automatically detects command completion. Users must manually click the “Skip” button for every command to proceed with the conversation.

:counterclockwise_arrows_button: Current Broken Process Flow

Cursor AI → run_terminal_cmd → Shell Process → Command Execution
    ↑                                                     ↓
Manual Skip ←←←← Hangs Here ←←←← Output + New Prompt

What happens:

  1. :white_check_mark: Command executes successfully
  2. :white_check_mark: Output displays correctly
  3. :white_check_mark: New shell prompt appears
  4. :cross_mark: Cursor hangs at “Running terminal command…”
  5. :computer_mouse: User forced to click “Skip” button manually

:white_check_mark: Expected Process Flow

Cursor AI → run_terminal_cmd → Shell Process → Command Execution
    ↑                                                     ↓
Auto Continue ←←←← Detects Completion ←←←← Output + New Prompt

:counterclockwise_arrows_button: Steps to Reproduce

  1. Start a conversation with Cursor AI assistant
  2. Ask AI to run any terminal command (e.g., “run echo test”)
  3. AI calls run_terminal_cmd tool
  4. Command executes and shows correct output
  5. New shell prompt appears normally
  6. :cross_mark: Cursor shows “Running terminal command…” indefinitely
  7. User must manually click “Skip” button to continue

:desktop_computer: Environment

  • OS: macOS 14.5.0 (Darwin 24.5.0)
  • Cursor Version: 1.0.0
  • Shell: zsh with oh-my-zsh + Powerlevel10k
  • Working Directory: Any directory

:bar_chart: Test Results

All commands show identical behavior:

Command Type Example Output Prompt Returns Auto-Complete
Simple echo echo "test" :white_check_mark: Normal :white_check_mark: Yes :cross_mark: No
No output true :white_check_mark: None :white_check_mark: Yes :cross_mark: No
Unicode text echo "테스트" :white_check_mark: Normal :white_check_mark: Yes :cross_mark: No
Directory listing ls -la :white_check_mark: Normal :white_check_mark: Yes :cross_mark: No
Current path pwd :white_check_mark: Normal :white_check_mark: Yes :cross_mark: No

:wrench: Troubleshooting Attempted

Shell Configuration Changes:

  • :white_check_mark: Tested with minimal .zshrc (only PATH export)
  • :white_check_mark: Switched default shell to bash
  • :white_check_mark: Tested with simple prompt (removed Powerlevel10k)
  • :white_check_mark: Added non-interactive shell guards

Environment Variables:

  • :white_check_mark: Set TERM=dumb, PS1='$ ', CURSOR_SHELL=1
  • :white_check_mark: Modified shell initialization scripts

Result: Problem persists across all configurations

:bullseye: Impact Assessment

  • Severity: High - affects all AI terminal interactions
  • Frequency: 100% - occurs with every terminal command
  • Workaround: Manual “Skip” button click (severely impacts UX)
  • Scope: All users using AI assistant terminal features

:test_tube: Technical Analysis

Evidence points to Cursor’s completion detection logic:

  1. Process execution: :white_check_mark: Commands run successfully
  2. Output handling: :white_check_mark: stdout/stderr display correctly
  3. Process termination: :white_check_mark: Commands complete normally
  4. Shell prompt: :white_check_mark: New prompt appears as expected
  5. Completion detection: :cross_mark: Cursor doesn’t recognize completion

The Problem Zone:

Command Completes → New Prompt Appears → [CURSOR HANGS HERE] → Manual Skip Required

Likely root causes:

  • Shell prompt pattern recognition failure
  • Process exit status detection bug
  • Output stream completion detection issue
  • Platform-specific terminal interaction bug

:laptop: System Context

Terminal Environment:

# Shell: /bin/zsh
# Prompt: Powerlevel10k with git status
~/Desktop/project  main !2 ?1  ✔  system Node  19:52:49

:link: Reproduction Video

[If possible, attach a screen recording showing the issue]

:paperclip: Additional Information

  • Issue is specific to Cursor AI assistant terminal tool
  • External terminal applications work normally
  • Problem occurs regardless of command complexity
  • No error messages or warnings displayed
  • Issue persists across Cursor restarts

:hammer_and_wrench: Suggested Investigation Areas

  1. Prompt Detection Logic: Review how Cursor identifies shell prompt completion
  2. Process Exit Handling: Check process termination signal handling
  3. Output Buffer Management: Investigate output stream completion detection
  4. Platform Compatibility: Test terminal interaction on different macOS versions

:sos_button: Current Workaround

Users must manually click the “Skip” button after every terminal command execution to continue the conversation.

5 Likes

I have the same and you can see its issuing a q to quit the terminal which is not understood -
main >1 *1 !1 q ok base py 10:37:58 AM
zsh: command not found: q

Any update? It makes using Cursor impossible.

Same here, is there is another workaround instead of skip button? may be different terminal?
My main enviroment under WSL with cursor plugin - anysphere.remote-wsl

ok i find more live thread with similiar problem - Agent not detecting that a command has completed - #29 by niccolofanton

please fix this this is an atrocious bug. is anyone using oh my zsh and perhaps all the different formatting is the problem?

1 Like

I’m using oh-my-zsh and I’m having the same issue.

If I ‘Move to background’ the hung terminal window, Cursor agent will carry on with the task at hand.

# Simplify prompt in Cursor (VS Code) to fix AI assistant detection
if [[ "$TERM_PROGRAM" == "vscode" ]]; then
  export PS1='%~ %# '
else
  # Load Oh-My-Zsh and Powerlevel10k for normal terminals
  export ZSH="$HOME/.oh-my-zsh"
  ZSH_THEME="powerlevel10k/powerlevel10k"
  plugins=(git zsh-syntax-highlighting)
  source $ZSH/oh-my-zsh.sh
  [[ -f ~/.p10k.zsh ]] && source ~/.p10k.zsh
fi

It seems to be related to the instant prompt.
I’ve added some logic to check if it’s VS_CODE and if it is to just load a simple prompt… otherwise go OMZ and PL10k.

That’s working around whatever the issue is.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.