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):
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.
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.