fix(windows): discover Cursor Agent CLI install dir #4569
main fromrefs/pull/4569/head·opened View on GitHubSummary#
- Add
%LOCALAPPDATA%\cursor-agenttoresolveKnownWindowsCliDirsso Windows desktop can find the official Cursor Agent CLI even when the Electron process has a stale User PATH. - Update shell unit tests that assert the known-dir PATH composition.
Why#
On Windows, the Cursor Agent installer places agent.cmd / cursor-agent.cmd under %LOCALAPPDATA%\cursor-agent and updates User PATH. T3's Electron process can still miss that PATH entry (common after install without a full relaunch from a parent with a fresh environment). Provider health checks then report Cursor CLI command agent was not found even though the binary exists and agent --version works in a refreshed shell.
T3 already prepends known Windows CLI dirs (npm, node, Volta, pnpm, bun, scoop) via resolveWindowsEnvironment. Including the Cursor Agent install dir follows that pattern and removes the need for users to hardcode an absolute binaryPath.
Reproduced locally: installed CLI present + on User PATH, T3 still failed until providers.cursor.binaryPath was set to the absolute agent.cmd path. After this fallback, discovery should succeed without that workaround.
Official install docs: https://cursor.com/docs/cli/installation
Test plan#
-
vp test run packages/shared/src/shell.test.ts(29/29 pass) - On Windows desktop: install Cursor CLI, leave default/binary name
agentorcursor-agent, ensure User PATH includes%LOCALAPPDATA%\cursor-agentbut launch T3 from a process that may have a stale PATH; Cursor provider should becomeinstalled/readywithout setting an absolute binary path - Confirm absolute
binaryPathoverride still works
Checklist#
- This PR is small and focused
- I explained what changed and why
- No UI changes
Note
Low Risk Small additive PATH fallback in shared shell utilities; no auth, security, or data-path changes.
Overview
Adds %LOCALAPPDATA%\cursor-agent to the known Windows CLI install directories in resolveKnownWindowsCliDirs, so resolveWindowsEnvironment prepends that folder to PATH the same way it already does for npm, Node, Volta, pnpm, bun, and scoop.
This is meant to fix Cursor provider health checks when the Electron process has a stale User PATH after installing the official Cursor Agent CLI, so agent / cursor-agent can be resolved without setting an absolute binaryPath.
Unit tests for resolveKnownWindowsCliDirs and resolveWindowsEnvironment PATH composition were updated to include the new directory.
Note
Add Cursor Agent CLI install dir to Windows PATH discovery#
Extends resolveKnownWindowsCliDirs in shell.ts to include the cursor-agent directory under LOCALAPPDATA when that environment variable is defined. This brings Cursor Agent in line with other LOCALAPPDATA-based tools already discovered on Windows.
- 1
github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:XS
macroscopeapp[bot](GitHub profile, opens in a new tab) approved these changes
Approvability#
Verdict: Approved
This change simply adds 'cursor-agent' to the list of known Windows CLI directories to search, following the existing pattern. It's a minimal, additive change with updated tests and no runtime risk.
You can customize Macroscope's approvability policy. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).Confirming this on current Windows desktop after the official
irminstaller:cursor-agentis on User PATH under%LOCALAPPDATA%\cursor-agent, a new PowerShell finds it, and T3 still reports not found.This PR's known-dir change looks right for the installer location, but desktop still has a second copy of that list in
DesktopShellEnvironment.ts, so a shared-only patch would not reach the Electron app.Filed https://github.com/pingdotgg/t3code/issues/7360 and opened https://github.com/pingdotgg/t3code/pull/7362 which also reads Machine+User PATH and points desktop at the shared helpers. Happy to close 7362 as redundant if this lands first and desktop is updated here.
Note
🤖 GPT-5.6 Sol responding on behalf of Theo
We're closing this PR as we clean up the T3 Code backlog. Thank you for taking the time to put this together.
The Windows Cursor Agent discovery problem is real. We are keeping the fix in the open #7362, which repairs User PATH discovery for provider CLIs instead of adding one Cursor-only install directory.
If you believe we closed this in error, please reopen the PR and leave a comment explaining what we missed.
t3dotgg(GitHub profile, opens in a new tab) closed this
Sign in to join this conversation.
Important
Review skipped#
Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
.coderabbit.yamlfile in this repository. To trigger a single review, invoke the@coderabbitai reviewcommand.⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID:
634d787e-0868-4110-ad49-c71a64208c2dYou can disable this status message by setting the
reviews.review_statustofalsein the CodeRabbit configuration file.Use the checkbox below for a quick retry:
✨ Finishing Touches
🧪 Generate unit tests (beta)
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