Composer Agent terminal PowerShell readline issues - new since 0.44

Hi, thanks for reporting an issue with Cursor.

Before you report this, we’d appreciate if you can search this forum to see if this issue has already been reported.

If you have done so, please check this box.
on

Describe the Bug

When starting a new session in the composer agent mode, the first terminal command will work. If you ask it to run another, without selecting “Pop out terminal”, it will most of the time fail with the following error (error can be caught by selecting “Pop out terminal”):

PS /Users/test> curl https://cursor.com | cat
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100    15    0    15    0     0    163      0 --:--:-- --:--:-- --:--:--   164
Redirecting...
PS /Users/test> curl https://cursor.com | cat
Oops, something went wrong.
Please report this bug with ALL the details below, including both the 'Environment' and 'Exception' sections.
Please report on GitHub: https://github.com/PowerShell/PSReadLine/issues/new?template=Bug_Report.yaml
Thank you!

### Environment
PSReadLine: 2.3.6+d2e770f93b7a53d8660a6402eb29d1ae1c35e767
PowerShell: 7.4.2
OS: Darwin 23.6.0 Darwin Kernel Version 23.6.0: Mon Jul 29 21:13:04 PDT 2024; root:xnu-10063.141.2~1/RELEASE_ARM64_T6020
BufferWidth: 107
BufferHeight: 1

Last 60 Keys:

 c u r l Spacebar h t t p s : / / c u r s o r . c o m Spacebar | Spacebar c a t Enter
 c u r l Spacebar h t t p s : / / c u r s o r . c o m Spacebar | Spacebar c a t Enter


### Exception

System.InvalidOperationException: Cannot locate the offset in the rendered text that was pointed by the original cursor. Initial Coord: (16, 5) Buffer: (107, 6) Cursor: (17, 0)
PS /Users/test> curl https://cursor.com | cat                                                              
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current, String defaultColor)
                                 Dload  Upload   Total   Spent    Left  Speed
100    15    0    15    0     0    274      0 --:--:-- --:--:-- --:--:--   277
Redirecting...t.PowerShell.PSConsoleReadLine.Insert(Char c)
PS /Users/test> PowerShell.PSConsoleReadLine.SelfInsert(Nullable`1 key, Object arg)
   at Microsoft.PowerShell.PSConsoleReadLine.ProcessOneKey(PSKeyInfo key, Dictionary`2 dispatchTable, Boolean ignoreIfNoAction, Object arg)
   at Microsoft.PowerShell.PSConsoleReadLine.InputLoop()
   at Microsoft.PowerShell.PSConsoleReadLine.ReadLine(Runspace runspace, EngineIntrinsics engineIntrinsics, CancellationToken cancellationToken, Nullable`1 lastRunStatus)

Steps to Reproduce

  • Start a new agent session
  • Send the message:
    run “curl https://cursor.com” or “run ls”
  • Run it
  • Ask it to run it again, run it

Expected Behavior

For the commands to complete successfully.

Screenshots / Screen Recordings

Operating System

MacOS

Current Cursor Version (Menu → About Cursor → Copy)

Version: 0.44.8
VSCode Version: 1.93.1
Commit: f3b5a63019e4e2283033b4db987a35f8413c7570
Date: 2024-12-22T05:48:08.427Z
Electron: 30.5.1
Chromium: 124.0.6367.243
Node.js: 20.16.0
V8: 12.4.254.20-electron.0
OS: Darwin arm64 23.6.0

Additional Information

Within the same agent chat session, if you select popout terminal, it starts a new terminal and then works once more before it fails again.

This was working fine in 0.43 - I had never seen this issue before.

Does this stop you from using Cursor

Sometimes - I can sometimes use Cursor

1 Like

I see this issue also in longer commands where its rendered multiple times:

Prompt:

Run the following command:
Write-Host "PSReadLine version: $((Get-Module PSReadLine).Version); BufferSize: $(try {$Host.UI.RawUI.BufferSize} catch {'Not supported or 1-line'})"

(this works fine in zsh, i have alias etc, this isn't pwsh code)

Affects me also, the agent CLI tools are almost unusable as it gets stuck with the PS errors. I’m on Mac.

2 Likes

Will this be fixed, or should I downgrade? The agents are unusable with any CLI tooling.

2 Likes

I’ve downgraded to 0.43.5 for now and it’s working.

By the looks of things, 0.43.5 spawns a zsh terminal rather than 0.44.8 which is spawning pwsh… for what it’s worth.

Serious question:

Have you tried running cursor as admin on your box?

I was having issues a while back where cursor couldnt actually run the commands directly, but when I pasted them into the terminal session within cursor, thhey ran fine - -I then ran cursor in administration and it ran everything fine…

Whi many wont be able to do so on a work machine, or may not want to on whatever home box they run cursor from - for me on a dedicated cursor laptop - I dont mind…


Any ideas on this one? I have to keep downgrading

1 Like

I’m having the same issue, 0.44.11

I replaced some details in the strings to obscure private-ish information. That said, the edits don’t affect the core point: I’m experiencing this issue too.

Here’s what happened when I ran this command:

find src/mock_api -name "*.py" | sort  

Instead of working as expected, I got this error:

PS /Users/username/Library/CloudStorage/OneDrive/Documents/VS Code Projects/mock-api> file pep.cbtechnrwd.in.macbook_host_nameps1
Oops, something went wrong.
Please report this bug with ALL the details below, including both the 'Environment' and 'Exception' sections.
Please report on GitHub: https://github.com/PowerShell/PSReadLine/issues/new?template=Bug_Report.yaml
Thank you!

### Environment
PSReadLine: 2.3.5+2cc85806c561a9395751a96a818e8ff1592d19f7
PowerShell: 7.4.6
OS: Darwin 24.2.0 Darwin Kernel Version 24.2.0: Fri Dec  6 18:56:34 PST 2024; root:xnu-11215.61.5~2/RELEASE_ARM64_T6020
BufferWidth: 108
BufferHeight: 1

Last 47 Keys:

 f i n d Spacebar s r c / m o c k _ a p i Spacebar - n a m e Spacebar " * . p y " Spacebar | Spacebar s o r t Enter


### Exception

System.InvalidOperationException: Cannot locate the offset in the rendered text that was pointed by the original cursor. Initial Coord: (25, 1) Buffer: (80, 30) Cursor: (26, 0)
   at Microsoft.PowerShell.PSConsoleReadLine.RecomputeInitialCoords(Boolean isTextBufferUnchanged)
   at Microsoft.PowerShell.PSConsoleReadLine.ReallyRender(RenderData renderData, String defaultColor)
   at Microsoft.PowerShell.PSConsoleReadLine.ForceRender()
   at Microsoft.PowerShell.PSConsoleReadLine.Render()
   at Microsoft.PowerShell.PSConsoleReadLine.Insert(Char c)
   at Microsoft.PowerShell.PSConsoleReadLine.SelfInsert(Nullable`1 key, Object arg)
   at Microsoft.PowerShell.PSConsoleReadLine.ProcessOneKey(PSKeyInfo key, Dictionary`2 dispatchTable, Boolean ignoreIfNoAction, Object arg)
   at Microsoft.PowerShell.PSConsoleReadLine.InputLoop()
   at Microsoft.PowerShell.PSConsoleReadLine.ReadLine(Runspace runspace, EngineIntrinsics engineIntrinsics, CancellationToken cancellationToken, Nullable`1 lastRunStatus)
   
PS /Users/username/Library/CloudStorage/OneDrive/Documents/VS Code Projects/mock-api> find src/mock_api -name "*.py" | sort
src/mock_api/__init__.py
src/mock_api/api/__init__.py
src/mock_api/api/models/__init__.py
src/mock_api/api/models/base.py
<removed dir listing for brevity>
src/mock_api/services/work_locations.py
src/mock_api/services/workers.py
PS /Users/username/Library/CloudStorage/OneDrive/Documents/VS Code Projects/mock-api>

Afterward, the response from Cursor (or Claude) was something like:
“I see there was an issue with the command. Let me try a different approach:”

It then tried an alternate approach to achieve the same task without running the command in the prompt.

This happens every time I need to run a command in the prompt. I’ve had to constantly tell the tool: “Don’t run any commands for me. Just list all the commands needed for each step, and I’ll handle them manually in a terminal.” I end up copying and pasting each command myself.

For context, I’m a new Cursor user. During my trial period, this workflow used to work, but it broke around Christmas (give or take a few days).

I’m currently on v0.44.11, but the issue existed on the previous version as well.

I’m not sure why there is radio silence from Cursor on this bug. It could be due to Composer Agent being an experimental feature, but I don’t want to speculate any further on that. I’m hoping it’s fixed soon so I can take advantage of the improvements on newer versions. They have the moat currently, so I can’t scream and shout here :money_mouth_face:

This issue has also been raised on GitHub.

The “I see there was an issue with the command. Let me try a different approach:” is due to the fact the PSReadLine error we are seeing is also fed to the LLM as the command output response, and it has no context this is a cursor bug, so it thinks the command that was ran was just incorrect and tries to issue another command it thinks will work (trying to use /bin/ls instead of just ls), issuing another function call starting a loop that will just fail every time as the shell is never respawned until “Pop out terminal” is selected.

I’m certain there will be other users who are confused thinking their commands aren’t right and just allowing it to continue in this failed loop.

On 0.44.11 the process which starts the commands from Cursor composer agent window is:
/usr/local/bin/pwsh -l -noexit -command . “/Applications/Cursor.app/Contents/Resources/app/out/vs/workbench/contrib/terminal/browser/media/shellIntegration.ps1”

Previous on 0.43.5 where it worked it is:
/bin/zsh ‘-il’

Both versions hold onto the same process to run further commands until you pop out the terminal and then another process is spawned when it generates the next command. “Pop out terminal” after each command is a workaround for me.

I tried debugging further by looking at the dev tools and tracing the processes but ultimately didn’t have the time or knowledge to go any further.

If you pop out the terminal after each one it is a workaround. Still I keep downgrading to 0.43 as the workflow I had with composer agent was really powerful and I would be at a big loss without it now.

A comment from Sanger2000 on the GitHub issue gave me some further direction. Doing this fixed it:
In terminal settings:

Select zsh:

Or…
Cmd+Shift+P
Search:
Open User Settings (JSON)

Add this

{
    // ... other settings you may already have ...
    "terminal.integrated.defaultProfile.osx": "zsh",
}

Something happened between the versions I guess to rank pwsh higher if there is no default set maybe.

Version: 0.43.5
VSCode Version: 1.93.1
Commit: 2eaa79a1b14ccff5d1c78a2c358a08be16a8e5a0
Date: 2024-11-27T09:11:51.854Z
Electron: 30.5.1
Chromium: 124.0.6367.243
Node.js: 20.16.0
V8: 12.4.254.20-electron.0
OS: Darwin arm64 23.6.0

Version: 0.44.11
VSCode Version: 1.93.1
Commit: fe574d0820377383143b2ea26aa6ae28b3425220
Date: 2025-01-03T07:59:06.361Z
Electron: 30.5.1
Chromium: 124.0.6367.243
Node.js: 20.16.0
V8: 12.4.254.20-electron.0
OS: Darwin arm64 23.6.0

Anyway, I feel silly for it being such a simple fix, but anyway, I’m happy again.

1 Like

FYI, this did not resolve the issue for me.


Version: 0.44.11
VSCode Version: 1.93.1
Commit: fe574d0820377383143b2ea26aa6ae28b3425220
Date: 2025-01-03T07:59:06.361Z
Electron: 30.5.1
Chromium: 124.0.6367.243
Node.js: 20.16.0
V8: 12.4.254.20-electron.0
OS: Darwin arm64 24.2.0