Skip to content

fix(cursor): reject desktop launcher forwarders#4371

Open
christopheraaronhogg wants to merge 2 commits into
pingdotgg:mainfrom
christopheraaronhogg:fix/cursor-desktop-forwarder
Open

fix(cursor): reject desktop launcher forwarders#4371
christopheraaronhogg wants to merge 2 commits into
pingdotgg:mainfrom
christopheraaronhogg:fix/cursor-desktop-forwarder

Conversation

@christopheraaronhogg

@christopheraaronhogg christopheraaronhogg commented Jul 23, 2026

Copy link
Copy Markdown

What Changed

  • Resolve the configured Cursor Agent command before provider health checks.
  • Inspect only small wrapper scripts and reject shims that forward to cursor agent, the desktop editor launcher.
  • Return a clear standalone-CLI setup error without spawning the shim.
  • Add regression coverage for Windows batch and POSIX shell forwarders, including a no-spawn assertion.

Why

Cursor's supported standalone command is cursor-agent. A local shim such as cursor-agent.cmd containing cursor agent %* launches the desktop editor instead of ACP. T3's five-minute provider refresh then opens Cursor repeatedly and can leave expensive editor processes running.

This is a follow-up safety guard to #4094 and covers the desktop-launcher failure mode reported in #2516. Correct standalone Cursor CLI binaries and ordinary wrappers remain unchanged.

Official CLI installation: https://cursor.com/docs/cli/installation

Verification

  • vp test run apps/server/src/provider/Layers/CursorProvider.test.ts -t 'rejects desktop forwarder|recognizes shell wrappers'
  • vp lint apps/server/src/provider/Layers/CursorProvider.ts apps/server/src/provider/Layers/CursorProvider.test.ts --report-unused-disable-directives
  • vp fmt --check apps/server/src/provider/Layers/CursorProvider.ts apps/server/src/provider/Layers/CursorProvider.test.ts
  • vp run --filter t3 typecheck

The full Cursor provider test file also runs 22/25 tests on native Windows; its three existing ACP fixture tests fail with spawn EFTYPE because they execute .sh wrappers directly. The new tests pass on native Windows.

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • No UI changes

Note

Low Risk
Scoped guard in Cursor provider status checks with file-size limits; legitimate standalone CLI binaries are unchanged.

Overview
Cursor provider health checks now block desktop-launcher shims so periodic refreshes no longer spawn wrappers that open the editor instead of ACP.

Before agent about, checkCursorProviderStatus resolves the configured binary with resolveCommandPath, reads only small regular files (≤64 KiB), and uses isCursorDesktopAgentForwarderScript to detect batch/shell scripts that forward to cursor agent. Matches return installed: false, status: "error", and a message pointing users to the standalone cursor-agent CLI—without executing the shim.

Regression tests cover POSIX/Windows forwarder patterns, the script predicate (including commented lines), and a no-spawn assertion when a forwarder is configured.

Reviewed by Cursor Bugbot for commit b1069cd. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Reject desktop launcher forwarder scripts in checkCursorProviderStatus

  • Adds isCursorDesktopAgentForwarderScript to detect shell/batch wrappers that forward to the cursor agent desktop launcher via a case-insensitive regex.
  • Adds an early guard in checkCursorProviderStatus that reads the configured binary, checks if it is a forwarder script, and returns an error probe with installed=false without spawning any subprocess.
  • Behavioral Change: configs pointing to a desktop forwarder shim now immediately fail with a user-facing message instead of attempting to spawn the agent.

Macroscope summarized b1069cd.

@coderabbitai

coderabbitai Bot commented Jul 23, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: e8ce2a77-492b-4b4c-8044-7a646619ee5f

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:M 30-99 changed lines (additions + deletions). labels Jul 23, 2026
Comment thread apps/server/src/provider/Layers/CursorProvider.ts Outdated

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Want fixes drafted automatically? Bugbot Autofix can create code changes for findings. A team admin can enable Autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit ad61bd0. Configure here.

Comment thread apps/server/src/provider/Layers/CursorProvider.ts

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ad61bd01e4

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

}

export function isCursorDesktopAgentForwarderScript(script: string): boolean {
return /^[^\S\r\n]*(?!(?:#|::|rem(?:[^\S\r\n]|$)))(?:(?:exec|@?call|&)[^\S\r\n]+)?@?(?:"[^"\r\n]*[\\/]cursor(?:\.exe|\.cmd|\.bat)?"|cursor(?:\.exe|\.cmd|\.bat)?)[^\S\r\n]+agent(?:[^\S\r\n]|$)/im.test(

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Match unquoted Cursor launcher paths

When a shim calls the desktop cursor binary through an unquoted path, such as exec /usr/local/bin/cursor agent "$@" or C:\...\cursor.exe agent %*, this pattern returns false because the unquoted branch only accepts the bare command name cursor. Those wrappers then fall through to runCursorAboutCommand, so provider refresh can still spawn the desktop launcher that this guard is intended to reject.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in b1069cd. The detector now accepts unquoted POSIX and Windows paths; regression tests cover /usr/local/bin/cursor and C:\tools\cursor.exe.

@macroscopeapp

macroscopeapp Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Needs human review

This PR introduces new validation logic that changes runtime behavior by rejecting certain Cursor configurations. An unresolved review comment questions whether the regex correctly handles all forwarder patterns, which warrants human verification.

You can customize Macroscope's approvability policy. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M 30-99 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant