Plugin marketplace sync runs `git ls-remote` with no timeout, leaking hundreds of stuck git/sh/ssh processes on Remote SSH (Windows)

Where does the bug appear (feature/product)?

Cursor IDE

Describe the Bug

Summary
Each time the agent runs on the remote host, it resolves the git ref of a plugin marketplace repo using git ls-remote over SSH, with no timeout. On a network where TCP port 22 connects but the SSH greeting never arrives, the call hangs forever. Each hung attempt leaves a git.exe, sh.exe and ssh.exe process behind. I found 325 of each (975 processes) after about 28 hours, and the count was still rising while I watched.

Root cause (from reading the shipped extension code)

  • The code is in extensions/cursor-agent-exec/dist/main.js and the same logic in cursor-agent-host. MarketplaceCacheManager.ensureClonedImpl rewrites an https marketplace URL to [email protected]:... and calls a git ref resolver that runs git ls-remote.
  • The SSH attempt sets sshBatchMode, which only avoids prompts and does not limit how long the call can hang.
  • lsRemoteTimeoutMs() returns undefined unless the sparsePluginClones option is on (30000 ms when it is).
  • Because the call never fails, the catch block that falls back to HTTPS is never reached.
  • Verified on the same machine: git ls-remote https://github.com/octoplus-sa/claude-skills.git main returned the commit in about 1 second.

Suggested fix

  • Always set a timeout on ls-remote, for example by also passing -o ConnectTimeout=10 or ServerAliveInterval, and kill the whole process tree when it expires.
  • Apply the same timeout whether or not sparsePluginClones is on.
  • Kill or reap child processes when the parent exits.

Workaround found: adding this to the remote host’s ~/.ssh/config makes the SSH attempt fail after 10 seconds, so the fallback runs and nothing hangs:

Host github.com
    ConnectTimeout 10

Impact: The remote host accumulated about 1,000 stuck processes. Nothing broke, but this wastes process slots and memory and makes the process list hard to use.

Steps to Reproduce

  1. Install a plugin whose marketplace repo is hosted on GitHub. Mine is a JSL scripting plugin, and I never added a marketplace by hand. The marketplace is octoplus-sa/claude-skills. This is a public repo, and HTTPS access to it works.

  2. Use a network where SSH to github.com hangs. The connection opens but no greeting comes back. ssh -v [email protected] reports “Connection timed out during banner exchange”. This happens on both port 22 and 443 (ssh.github.com). There was no SSH key on the remote host (.ssh held only authorized_keys).

  3. Connect with Remote SSH and use the agent normally.

  4. After a while, list processes on the remote host. The count of identical stuck commands keeps rising:

    git.exe -c credential.interactive=false -c core.fsmonitor=false -c core.longpaths=true ls-remote [email protected]:octoplus-sa/claude-skills.git main
    ssh.exe -oBatchMode=yes -o SendEnv=GIT_PROTOCOL [email protected] "git-upload-pack 'octoplus-sa/claude-skills.git'"
    

Expected Behavior

Expected: The ref lookup times out after a reasonable period, kills the child process, and falls back to HTTPS. No processes are left behind.

Actual:

  • The call never returns. It waits on ssh.exe indefinitely, so the HTTPS fallback never runs.
  • When the launching node process exits, the git and ssh children are left running, with no parent.
  • Batches appear every few minutes while the agent is in use, usually three at a time.

Operating System

Windows 10/11

Version Information

  • Cursor 3.27.14, commit 69b724ebc67ec522c1b5d287a5025f7a7e81be90, built 2026-10-23
  • Remote host: Windows 11 (NT 10.0.26300), Git for Windows 2.56.0, OpenSSH_for_Windows_9.5p2
  • Connected via Remote SSH. The agent runs on the remote host.

Does this stop you from using Cursor

Sometimes - I can sometimes use Cursor

Hey @AustinS, thanks for the detailed write-up. I was able to reproduce this, and your ConnectTimeout workaround is the right thing to keep in place for now. Just keep the value under 30 seconds so the HTTPS fallback still runs.

It’s safe to stop the git.exe, sh.exe, and ssh.exe processes that are already stuck on octoplus-sa/claude-skills.

What you’re describing isn’t intended behavior, and we’ve let the team know. I’ll post here when there’s an update.

Thanks for the replies. Just a quick follow up on the workaround in case it’s helpful:

About an hour after I added ConnectTimeout 10 to ~/.ssh/config, stuck processes started building up again. In about 67 minutes, 20 new ssh.exe processes appeared, all running the same git-upload-pack 'octoplus-sa/claude-skills.git' call. They stayed alive for over an hour.

Each stuck ssh.exe had a socket in the Bound state with remote address 0.0.0.0:0. It never reached SynSent or Established, and it used almost no CPU. The timeout only starts once ssh begins connecting, so it never fired. Run by hand, the same ssh call, and the same git ls-remote spawned from Node with pipes and no console, timed out cleanly after about 10 seconds. I could not reproduce the stuck state outside the agent’s own spawns. I don’t know what holds the connection (possibly a network or security layer on the host).

Some of the stuck git and sh processes did exit, but the ssh.exe child outlived them.

What worked: having ssh never open a socket for github.com:

Host github.com
    ConnectTimeout 10
    ProxyCommand cmd /c exit 1

With this, ssh fails in about 0.2 seconds and the agent’s git ls-remote fails in about 0.5 seconds with “Could not read from remote repository”. That error is what should trigger the fallback to HTTPS. After applying it and clearing the old processes, none had returned by the next morning. The obvious downside is that ssh cannot open a connection to github.com with this configuration.

The takeaway is that a ref lookup that depends on ssh-level options can’t be guaranteed to time out. Cursor could enforce the timeout itself, for example by killing the whole process tree (taskkill /T) after a fixed time. It could also set a timeout whether or not sparsePluginClones is enabled.