[AI generated] Cursor foreground shell stays running after a PowerShell CI script has already finished on Windows

Where does the bug appear (feature/product)?

Cursor IDE

Describe the Bug

On Windows, Cursor’s foreground shell can continue to show a PowerShell command as “running” for several minutes after the script has already completed successfully.

The script in question is a long-running PowerShell orchestration/CI script that:

  • runs for about 1 minute,
  • launches several native child processes sequentially,
  • streams mixed progress output,
  • has some quiet periods,
  • writes a final report/result file near the end,
  • prints a final summary line,
  • exits with code 0.

Observed behavior:

  • the script finishes its actual work in about 48-66 seconds;
  • the final report file is already written with a valid completion timestamp;
  • the final summary line is already printed;
  • no relevant worker processes appear to remain active;
  • but Cursor’s foreground shell still does not return control and continues to treat the command as running until I manually interrupt it several minutes later.

The same command completes normally when started in background mode. This makes it look like a foreground shell completion-detection problem in Cursor, not an actual hang inside the PowerShell script itself.

I do not yet have a guaranteed minimal standalone repro script, but the behavior appears tied to longer PowerShell scripts that orchestrate multiple native child processes and then exit normally.

Steps to Reproduce

  1. Use Cursor on Windows with PowerShell 7.6.0 as the shell.
  2. Run a long-running PowerShell script in the foreground shell. The script should:
    • run for roughly 1 minute,
    • launch multiple native child processes,
    • print status/progress output over time,
    • include some silent periods,
    • write a final report/result file,
    • print a final completion line,
    • exit with code 0.
  3. Wait until the script has clearly finished its work:
    • the final report/result file has been written,
    • the final completion line is already visible in the shell output.
  4. Observe that Cursor still keeps the foreground shell command in a running state and does not return the prompt.
  5. Wait several more minutes.
  6. Observe that the command still appears stuck until it is manually interrupted.

Important note:

  • Running the same command in background mode does not show the problem.
  • Very short or simple PowerShell commands may not reproduce it.
  • The issue seems to require a longer PowerShell script that manages native child processes and then exits normally.

Expected Behavior

Once the PowerShell script has finished its work, printed its final output, written its final report/result file, and exited with code 0, Cursor should immediately mark the foreground shell command as completed and return control to the user.

Cursor should not keep the foreground command in a running state for several additional minutes after the script has already finished.

Operating System

Windows 10/11

Version Information

Version: 3.4.1 (system setup)
VSCode Version: 1.105.1
Commit: 2a298dd06944a9b9ea541d28225b779fcbcc6200
Date: 2026-05-08T16:05:07.818Z
Layout: editor
Build Type: Stable
Release Track: Nightly
Electron: 39.8.1
Chromium: 142.0.7444.265
Node.js: 22.22.1
V8: 14.2.231.22-electron.0
OS: Windows_NT x64 10.0.22631

For AI issues: which model did you use?

GPT-5.4 XHigh, Composer 2

For AI issues: add Request ID with privacy disabled

RID: 7530556e-9dc5-4ab9-a0d9-33f6671ce2b8

Additional Information

[human text]
It looks like the agent’s shell tool is freezing. The problem is somewhere around the control return. Moreover, it’s impossible to send such a frozen terminal to the background. And if you leave it for several dozen minutes, it will disappear from the chat altogether, with the Agent in the “continuing operation” status.

I asked GPT-5.4 make a PoC, but the PoC doesn’t hang like that.

Does this stop you from using Cursor

Yes - Cursor is unusable

Hi @Artemonim,

This is a known class of bug.

A few things to try and some info that would help us narrow this down:

  1. Switch terminal profile to cmd.exe as a test: go to Cursor Settings > terminal.integrated.defaultProfile.windows and set it to Command Prompt. Then run the same script. If it completes normally with cmd, that confirms the issue is specific to the PowerShell shell integration layer.

  2. Developer Console output when it hangs: press Ctrl+Shift+I (or Help > Toggle Developer Tools), click the Console tab, then trigger the script. When Cursor gets stuck in “running” state, copy any red error messages from the console. This will show us if the shell integration is throwing errors during completion detection.

  3. PowerShell profile loading: does your PowerShell profile ($PROFILE) load any custom modules or modify the prompt? Custom prompt functions can interfere with the terminal integration markers that Cursor uses to detect command boundaries.

  4. Workaround for now: since background mode works reliably, you can use that to avoid the hang. We know that’s not ideal for interactive workflows, but it should unblock you while we work on this.

The additional issues you mentioned (can’t send a frozen terminal to background, and the terminal eventually disappearing from chat) are useful data points and help confirm where the problem is in the lifecycle.

Our team is aware of this class of terminal completion-detection issues on Windows and is actively investigating.

Last night, an entire Subagent disappeared from my Agent chat - a Subagent that was stuck on this bug.

I will try to get back to you with feedback on the other points within the next 48 hours.