Skip to content

fix(windows): detect Cursor Agent Node wrapper#8266

Open
bbingz wants to merge 1 commit into
stablyai:mainfrom
bbingz:fix/windows-cursor-agent-detection
Open

fix(windows): detect Cursor Agent Node wrapper#8266
bbingz wants to merge 1 commit into
stablyai:mainfrom
bbingz:fix/windows-cursor-agent-detection

Conversation

@bbingz

@bbingz bbingz commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Detect Cursor Agent when the native Windows launcher runs its versioned node.exe .../cursor-agent/versions/<version>/index.js entrypoint.
  • Return the canonical cursor-agent process identity for both the interactive parent and worker-server child.
  • Add regression coverage for the full PowerShell/cmd/Node descendant tree while keeping generic Node entrypoints and unrelated Agent.exe binaries unclassified.

Closes #8258.

Screenshots

No visual change.

Testing

  • pnpm lint
  • pnpm typecheck
  • pnpm test — the full suite exceeded the 3-minute local timeout without reporting a failure; the two directly affected suites pass 47/47.
  • pnpm build — not run; this change has no build-system or packaging impact.
  • Added or updated high-quality tests that would catch regressions.

Additional targeted command:

pnpm exec vitest run --config config/vitest.config.ts src/shared/agent-process-recognition.test.ts src/main/providers/agent-foreground-process.test.ts

AI Review Report

Reviewed the shared command-line recognizer and the Windows descendant-resolution path against the process tree reproduced with Cursor Agent 2026.07.09-a3815c0. The main risks checked were false positives from generic index.js files, the installed agent alias colliding with unrelated executables, and ambiguity when both Cursor's main process and worker are present. The matcher is anchored to the official versioned Cursor install layout, both Cursor processes resolve to one canonical identity, and negative tests cover a generic Cursor-named directory plus Grok's agent.exe.

Cross-platform compatibility was checked explicitly. The shared path comparison already normalizes Windows and POSIX separators, and the new match does not change shortcuts, labels, shell launching, Electron APIs, local/SSH routing, or provider-specific review behavior. Non-Windows runtimes remain unaffected unless they expose the same unambiguous Cursor install layout.

Security Audit

The change only classifies an already-observed process command line. It does not execute command-line content, access files, add IPC, change authentication, read secrets, or introduce dependencies. The bounded, suffix-anchored path expression avoids broad substring classification and has no unbounded backtracking structure. No security follow-up is required.

Notes

Manually reproduced on Windows before the fix: Cursor's main and worker Node processes were live while orca worktree ps --json returned agents: []. The direct agent alias is intentionally not classified because another installed product may own Agent.exe; Cursor is recognized from its child Node entrypoint instead.

@coderabbitai

coderabbitai Bot commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 8c51d022-fcae-46a0-b814-57a45875188b

📥 Commits

Reviewing files that changed from the base of the PR and between 6e3ebf5 and 9f6d22a.

📒 Files selected for processing (3)
  • src/main/providers/agent-foreground-process.test.ts
  • src/shared/agent-process-recognition.test.ts
  • src/shared/agent-process-recognition.ts

📝 Walkthrough

Walkthrough

Added Cursor-specific recognition for versioned cursor-agent/.../index.js Node entrypoints before generic Node package matching. Added tests covering valid and unrelated command-line paths, plus a Windows process-tree test that resolves the Cursor agent through its launcher, PowerShell, Node, worker-server, and agent executable chain.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately summarizes the Windows Cursor Agent node-wrapper detection change.
Description check ✅ Passed The description matches the repo template with Summary, Screenshots, Testing, AI Review Report, Security Audit, and Notes filled in.
Linked Issues check ✅ Passed The PR addresses #8258 by recognizing Cursor's versioned Windows Node wrapper and worker-server child, with regression tests and negative cases.
Out of Scope Changes check ✅ Passed The changes stay focused on Cursor Agent process recognition and regression tests, with no unrelated features or files introduced.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@AmethystLiang AmethystLiang self-assigned this Jul 11, 2026
@AmethystLiang AmethystLiang self-requested a review July 11, 2026 16:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Cursor Agent CLI is not detected in the sidebar on Windows

2 participants