Cursor-agent can not return from simple command under headless mode

Where does the bug appear (feature/product)?

Cursor CLI

Describe the Bug

When using -p to execute cursor-agent command under headless mode, it can not finish even the result is generated completely, you have to hit Ctrl+C to terminate it.

Steps to Reproduce

  1. Use -p for a headless command, like: cursor-agent -p “Generate a txt file to include top largest density materia”
  2. Check execution progress, we can see txt file is generated well, and it return result message like {“type”:“result”,“subtype”:“success”,“duration_ms”:24429,“duration_api_ms”:24429,“is_error”:false …
  3. Command is not finished properly, you have to hit Ctrl+C for shell interaction return.

Expected Behavior

Return to shell after completing command execution

Screenshots / Screen Recordings

Operating System

Linux

Current Cursor Version (Menu → About Cursor → Copy)

2025.09.04-fc40cd1

Does this stop you from using Cursor

Yes - Cursor is unusable

hi @xianglai1.li thank you for the detailed report. I sent the details to the team.

I’m facing the same issue.
I’m using cursor-agent --force --print --output-format text in bash.

And I find Cursor cli created new session and doesn’t stop after the task is done.

This issue basically means Cursor CLI can’t be used in any CI/CD pipeline since someone need to manually stop it.