You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Windows: Source Control AI cannot run argv-prompt agents through .cmd/.bat shims #11374
On Windows, Source Control AI (commit message / branch name / PR description generation) cannot run any agent whose spec uses promptDelivery: 'argv' when the resolved executable is a .cmd/.bat shim. The generated prompt is multiline by construction, and getSpawnArgsForWindows rejects multiline/metacharacter arguments for batch scripts rather than escaping them.
This affects Cursor today. It is not specific to any one agent — it is a property of the argv delivery path plus batch-shim resolution.
Failure chain
src/shared/commit-message-agent-spec.ts defines Cursor with promptDelivery: 'argv'.
On Windows, resolveCliCommand('cursor-agent') prefers cursor-agent.cmd. A standard Cursor IDE install likewise exposes cursor.cmd.
runLocalPlan() passes the generated prompt in argv to getSpawnArgsForWindows().
getSpawnArgsForWindows() (src/main/win32-utils.ts) rejects any .cmd/.bat argument matching /[&|<>^"%!\r\n]/ and throws UnsafeWindowsBatchArgumentsError.
Source Control AI prompts contain newlines, so the rejection is reached every time.
The rejection itself is deliberate and correct in intent — the comment notes that cmd.exe re-parses the command line and the prompt may contain arbitrary staged diff text. Escaping is genuinely unsafe here. The gap is that no alternative launch path exists, so the feature is simply unavailable.
Reproduction
Reported by @iFwu on Windows, Orca 1.4.160, Cursor Agent 2026.07.23-e383d2b, with the standalone installer providing %LOCALAPPDATA%\cursor-agent\cursor-agent.cmd. Branch auto-naming fails until the agent command is overridden to launch cursor-agent.ps1 via an absolute powershell.exe -File ..., after which the same end-to-end flow succeeds.
#10190 adds a platform-mocked regression test in src/main/win32-utils.test.ts that locks the present behaviour: both cursor-agent.cmd and cursor.cmd reject a multiline argv prompt, and a non-batch powershell.exe -File ...ps1 launcher passes the same prompt through untouched. That test documents the limitation; it does not fix it. Whoever implements a fix will need to update it deliberately.
Possible directions
Launch batch-shim agents through PowerShell (powershell.exe -File <shim>.ps1), matching the override shape already verified to work. Requires the .ps1 variant to exist alongside the .cmd.
Avoid cmd.exe re-parsing entirely for argv prompts, e.g. resolve past the shim to the underlying interpreter/entry script.
Fall back to stdin delivery on Windows where the agent CLI supports it, bypassing argv length and escaping constraints.
Option 1 is the only one with a confirmed working end-to-end reproduction.
Scope note
Deliberately split out of #10190, which is scoped to detecting which Cursor CLI is actually installed. That PR neither introduces nor worsens this failure — cursor-agent already fails this way on main, since the spec has always used argv delivery.
Filing note, plus a few open questions for whoever picks this up.
I don't have a Windows environment, so I'm not planning to take this further myself — I split it out of #10190 so the problem is documented rather than buried in a PR that's scoped to CLI detection. It's unassigned and open to anyone.
@iFwu, no obligation at all here, but since you have the only setup that's demonstrated a working launch path, a few details from your environment would save whoever implements this a lot of guesswork:
Does cursor-agent.ps1 reliably ship alongside cursor-agent.cmd in the standalone installer, or was that specific to your version? If it isn't guaranteed, a PowerShell strategy needs a fallback.
Does a standard Cursor IDE install expose a .ps1 next to cursor.cmd, or only the .cmd? That determines whether a fix covers both entry points or just the standalone one.
Did powershell.exe -File ...ps1 handle the multiline prompt at realistic diff sizes, or was it only tried with short input? Argv length limits and newline handling are the most likely places for this to break later.
Also relevant to #11375, if you happen to know: do quoted Windows paths with spaces (e.g. "C:\Program Files\...\foo.exe") survive the current tokenizer, or is that path broken too?
Answers are useful whenever — or not at all. Thanks again for tracing the failure chain; that's what made these two issues writable in the first place.
I'd like to take this. I have access to a Windows host, so I'll first verify the installed Cursor shim layout and reproduce the multiline argv failure there. Then I'll add a failing regression and implement the narrowest launch path that avoids cmd.exe re-parsing, with an explicit fallback when no safe sibling launcher exists.
Thanks for the questions. I tested this live on Windows against #11384 at
86c3594676d5be7c644b5e0e655fcc4b8a751306.
My standalone Cursor Agent installation (2026.07.23-e383d2b) includes both
cursor-agent.cmd and cursor-agent.ps1. My standard Cursor IDE installation
only includes cursor.cmd; there is no sibling cursor.ps1.
Using Orca's real Source Control commit-message generation path with
cursor-grok-4.5-high-fast:
On main, a roughly 14.5K staged diff was rejected immediately as an unsafe
Windows batch argv prompt.
A roughly 28.9K staged diff also completed successfully.
A 31,605-character patch produced a 32,143-character prompt and failed before
Cursor started. The Orca dev log reported spawn ENAMETOOLONG.
So the sibling PowerShell fallback works end-to-end for the standalone Cursor
Agent, including reasonably large multiline diffs, but it remains subject to
the Windows process command-line limit. It also does not cover the standard
Cursor IDE launcher on this machine because that installation has no cursor.ps1.
For #11375: quoted Windows paths are also corrupted by the current POSIX-style
tokenizer. #11380's execution-target-aware approach looks like the more complete
fix for that case.
Given the remaining standard-IDE and large-prompt cases, should #11374 remain
open, or should #11384 narrow its "Fixes" scope to the standalone shim case?
The live results confirm that #11384 should remain a partial fix. I updated the PR description from Fixes #11374 to Partially addresses #11374, so this issue stays open for the standard Cursor IDE launcher without a sibling .ps1 and for prompts that exceed the Windows process command-line limit. The existing PR will stay focused on the validated standalone cursor-agent.cmd/cursor-agent.ps1 path; the remaining cases need a non-argv delivery path or resolution to the underlying executable rather than more cmd.exe escaping.
Activity
MumuTW commentedon Jul 29, 2026
Filing note, plus a few open questions for whoever picks this up.
I don't have a Windows environment, so I'm not planning to take this further myself — I split it out of #10190 so the problem is documented rather than buried in a PR that's scoped to CLI detection. It's unassigned and open to anyone.
@iFwu, no obligation at all here, but since you have the only setup that's demonstrated a working launch path, a few details from your environment would save whoever implements this a lot of guesswork:
cursor-agent.ps1reliably ship alongsidecursor-agent.cmdin the standalone installer, or was that specific to your version? If it isn't guaranteed, a PowerShell strategy needs a fallback..ps1next tocursor.cmd, or only the.cmd? That determines whether a fix covers both entry points or just the standalone one.powershell.exe -File ...ps1handle the multiline prompt at realistic diff sizes, or was it only tried with short input? Argv length limits and newline handling are the most likely places for this to break later.Also relevant to #11375, if you happen to know: do quoted Windows paths with spaces (e.g.
"C:\Program Files\...\foo.exe") survive the current tokenizer, or is that path broken too?Answers are useful whenever — or not at all. Thanks again for tracing the failure chain; that's what made these two issues writable in the first place.
bbingz commentedon Jul 29, 2026
I'd like to take this. I have access to a Windows host, so I'll first verify the installed Cursor shim layout and reproduce the multiline argv failure there. Then I'll add a failing regression and implement the narrowest launch path that avoids cmd.exe re-parsing, with an explicit fallback when no safe sibling launcher exists.
iFwu commentedon Jul 29, 2026
Thanks for the questions. I tested this live on Windows against #11384 at
86c3594676d5be7c644b5e0e655fcc4b8a751306.
My standalone Cursor Agent installation (2026.07.23-e383d2b) includes both
cursor-agent.cmd and cursor-agent.ps1. My standard Cursor IDE installation
only includes cursor.cmd; there is no sibling cursor.ps1.
Using Orca's real Source Control commit-message generation path with
cursor-grok-4.5-high-fast:
Windows batch argv prompt.
cursor-agent.ps1.
Cursor started. The Orca dev log reported spawn ENAMETOOLONG.
So the sibling PowerShell fallback works end-to-end for the standalone Cursor
Agent, including reasonably large multiline diffs, but it remains subject to
the Windows process command-line limit. It also does not cover the standard
Cursor IDE launcher on this machine because that installation has no cursor.ps1.
For #11375: quoted Windows paths are also corrupted by the current POSIX-style
tokenizer. #11380's execution-target-aware approach looks like the more complete
fix for that case.
Given the remaining standard-IDE and large-prompt cases, should #11374 remain
open, or should #11384 narrow its "Fixes" scope to the standalone shim case?
bbingz commentedon Jul 30, 2026
The live results confirm that #11384 should remain a partial fix. I updated the PR description from
Fixes #11374toPartially addresses #11374, so this issue stays open for the standard Cursor IDE launcher without a sibling.ps1and for prompts that exceed the Windows process command-line limit. The existing PR will stay focused on the validated standalonecursor-agent.cmd/cursor-agent.ps1path; the remaining cases need a non-argv delivery path or resolution to the underlying executable rather than morecmd.exeescaping.