Agent terminal reports "no exit status" for most commands (Windows / PowerShell

Where does the bug appear (feature/product)?

Cursor IDE

Describe the Bug

In the agent terminal over Remote-SSH (Windows host, PowerShell), most commands return “no exit status” — the command appears to run but no exit code is captured. Only simple in-process Verb-Noun commands return a proper exit code. Persists across “Developer: Reload Window.” Likely shell-integration completion markers (OSC sequences) being stripped/garbled over SSH.

Steps to Reproduce

Connect to a Windows host via Remote-SSH (PowerShell shell).
Run an agent/terminal command and observe exit-status capture:
Works (exit 0 returned):

Write-Output OK
Test-Path 'C:'; Test-Path 'C:'; Test-Path 'C:'
Hangs (“no exit status”):

‘hello’
Write-Output (1 + 1)
Get-ChildItem 'C:' -Directory
1..3 | ForEach-Object { “line $_” }
cmd /c “echo a& echo b& echo c”
powershell -ExecutionPolicy Bypass -File script.ps1
Rules out obvious causes: not line count (3-line Test-Path works), not filesystem (1..3 | %{} hangs), not metacharacters alone (powershell -File hangs), not PS-vs-cmd (both hang).

Operating System

Windows 10/11

Version Information

Cursor version: 3.5.38 (system setup)
VSCode version: 1.105.1
Commit: 009bb5a3600dd98fe1c1f25798f767f686e14750
Date: 2026-05-26T21:32:06.537Z
Release Track: Stable
Electron: 39.8.1
Chromium: 142.0.7444.265
Node.js: 22.22.1
V8: 14.2.231.22-electron.0
OS (this client): Windows_NT x64 10.0.22631
Remote host (where commands run): Windows Server 2022 (win32 10.0.20348), via Remote-SSH
Shell: PowerShell 5.1

For AI issues: which model did you use?

Opus 4.8 High

Does this stop you from using Cursor

Sometimes - I can sometimes use Cursor

Hey, thanks for the detailed report. The repro steps and the pattern breakdown really help.

The “no exit status” message means the agent is honestly telling you that PowerShell didn’t return a completion marker or exit code. It is not faking a success like before, where the same failure could get masked as exit 0. So this is a correct error for a real issue.

Root cause: PowerShell 5.1 shell integration does not reliably send completion markers OSC sequences over Remote-SSH on Windows hosts. That matches your pattern. Simple in-process cmdlets return to the prompt fast and the marker arrives, but pipelines, subprocesses, and cmd /c can break the timing, especially over SSH. This is a known class of issues and there is no ETA for a fix yet.

As a workaround, try PowerShell 7+ pwsh instead of Windows PowerShell 5.1 on the remote host if you can install it. The shell integration markers are usually more reliable there. I can’t guarantee it will fully fix it over SSH, but it is worth a try. Let me know if it helps.

Thanks for the follow-up.

I installed PowerShell 7.6.2 on the remote Windows Server 2022 host and set the default terminal profile in Remote User Settings (SSH) to pwsh.exe (disabled the Windows PowerShell 5.1 profile).

Results:

  • Integrated terminal: Fixed. $PSVersionTable shows 7.6.2, and commands that previously failed in the agent ('hello', 1+1, Get-ChildItem, pipelines) all work normally there.

  • Agent shell version: Now reports 7.6.2 (was 5.1 before the remote settings change).

  • Agent exit-status capture: Still broken for the same patterns. Examples that still return “no exit status”:

    • 'hello'

    • Write-Output (1 + 1)

    • Get-ChildItem 'C:\GameServer' -Directory | Select-Object -ExpandProperty Name

Simple agent commands still work (e.g. Write-Output OK → exit 0).

So upgrading to pwsh 7 fixed the manual terminal and updated what version the agent reports, but it did not resolve the missing completion/exit-code issue over Remote-SSH for the agent. Happy to provide more logs or retest if you need a specific build or setting (e.g. Legacy Terminal Tool).

Thanks for doing such a clean retest, it’s really helpful. The fact that pwsh 7 fixed the integrated terminal, but the agent still returns “no exit status” on the same commands, pretty much rules out PowerShell as the cause. So this isn’t about PowerShell’s shell integration markers, it’s about how the agent’s shell-exec works on top of Remote-SSH on Windows. This is a known class of issues, and I can’t share an ETA for a fix yet.

Since you offered to test, try enabling Legacy Terminal Tool for the agent. Go to Cursor Settings, search for “terminal”. It uses a different command execution path that doesn’t rely on the new shell-exec flow, and in Remote-SSH setups it sometimes avoids this exact problem. No guarantees, but it’s worth checking in your case.

If you try it, let me know if it worked. And if it doesn’t, please include the Request ID from one of the failing commands during the Legacy Terminal Tool test right top chat menu > Copy Request ID. That’ll help if we need to dig deeper.