Where does the bug appear (feature/product)?
Cursor SDK
Describe the Bug
Bug 1: the sync bridge launcher can’t start on Windows
Cause
_bridge._read_discovery (lines 236–284) registers the bridge’s stderr pipe with selectors.DefaultSelector() and calls selector.select(). On Windows, DefaultSelector is SelectSelector, and select.select() only accepts sockets, so any pipe file descriptor raises WinError 10038.
The bridge itself is fine. Launched directly, cursor-sdk-bridge.cmd --workspace <dir> prints its cursor-sdk-bridge ready {...} line to stderr in about a second. The async launcher (AsyncClient.launch_bridge, which uses asyncio.create_subprocess_exec) works on the same machine.
Suggested fix
Don’t use select() on pipes on Windows. For example, read stderr lines on a background thread into a queue.Queue and wait on the queue with the deadline. That thread can also keep draining stderr after discovery. Currently nothing reads the pipe after discovery, so a bridge that logs a lot to stderr could eventually block on a full pipe buffer, on any OS.
Workaround we’re using
We replace cursor_sdk._bridge._read_discovery at runtime with a thread-based reader, as described above. Since Bridge.launch looks the function up by name when it runs, the replacement takes effect. The real fix belongs in the SDK, because we’re replacing a private function.
Bug 2: on Windows, a failed launch leaves the bridge’s node.exe running
Cause
On Windows, the launcher is cursor-sdk-bridge.cmd, so Popen starts cmd.exe, which starts node.exe. When a launch fails, _bridge._terminate_process (line 310) calls process.terminate(), which calls TerminateProcess on cmd.exe only. Windows doesn’t kill child processes when their parent dies, so node.exe keeps running.
A normal close() doesn’t have this problem, because it sends a shutdown RPC to the bridge before terminating. The async _terminate_process (_async_bridge.py line 216) has the same shape. I expect it orphans node.exe the same way, but I haven’t confirmed that.
The orphaned process’s command line also contains the tool-callback auth token, which any local process can read.
Suggested fix
Any of these would work:
- On Windows, launch the bundled
node.exewithdist/bin/cursor-sdk-bridge.jsdirectly instead of going through the.cmdwrapper, soprocess.pidis the bridge itself. - Kill the whole process tree on failure, for example with
taskkill /T /F /PID <pid>, or by putting the child in a Job Object withJOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE. - Pass the callback token through something other than argv. That’s a separate issue, but it’s worth considering since the code already avoids passing the store-callback token through env for a similar reason.
Steps to Reproduce
Bug 1:
from cursor_sdk import Client
with Client.launch_bridge(workspace=r"D:\some\folder") as client:
pass
Bug 2:
Trigger any failure inside Bridge.launch after Popen. Bug 1 does this on every launch. Afterward:
Get-CimInstance Win32_Process -Filter "Name='node.exe'" |
Where-Object { $_.CommandLine -match 'cursor-sdk-bridge' }
That lists a node.exe ...\dist\bin\cursor-sdk-bridge.js --workspace ... --tool-callback-url ... --tool-callback-auth-token ... process. Its parent is gone, and it keeps running until it’s killed by hand.
Operating System
Windows 10/11
Version Information
cursor-sdk 1.0.37, the latest on PyPI at the time of writing
Bundled bridge: cursor-sdk-bridge serverVersion 1.0.0, bundled Node v24.5.0
Python 3.13.15 (CPython, x64)
Windows 11 Enterprise 22631, PowerShell 7.6
Local runtime, with the default bundled bridge (resolve_bridge_path(), which resolves to _vendor/bridge/bin/cursor-sdk-bridge.cmd)
Does this stop you from using Cursor
No - Cursor works, but with this issue