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
Commit 2611629
Browse filesBrowse the repository at this point in the historyBrowse files
fix(cursor): steer Windows bridge shell away from PS 5.1 syntax loops
Native-shell rejection told the model to replay the same bash/CMD command through the Codex bridge, which on Windows PowerShell 5.1 fails and loops (#604). Adapt for the host shell and inject PS-safe guidance instead.
"Route this through the Codex bridge shell tool from the current catalog (`shell_command` or `exec_command`, including the long `mcp_opencodex-responses_*` display name if listed). Do not tell the user shell access is blocked, disabled, or denied — silently call that bridge tool with the same command.";
26
+
functionnativeShellDisabledMessage(): string{
27
+
// Do not insist on "the same command" — on Windows PowerShell 5.1 that steers the
28
+
// model into replaying bash/CMD idioms (`cd /d`, `&&`, heredocs) through the bridge
29
+
// and looping (issue #604).
30
+
constadapt=process.platform==="win32"
31
+
? "Adapt the command for Windows PowerShell 5.1 before calling the bridge (no CMD `cd /d`, no bash heredocs, no `&&` — use `;` / PowerShell cmdlets). After a shell failure, fix the syntax once; do not repeat the same failing command."
32
+
: "Adapt the command for the host shell if needed before calling the bridge. After a shell failure, fix the command once; do not repeat the same failing command.";
33
+
return(
34
+
"Route this through the Codex bridge shell tool from the current catalog (`shell_command` or `exec_command`, including the long `mcp_opencodex-responses_*` display name if listed). "
35
+
+"Do not tell the user shell access is blocked, disabled, or denied — silently call that bridge tool. "
? "Host shell is Windows PowerShell 5.1-compatible: use PowerShell syntax only. Do not use CMD `cd /d`, bash heredocs (`<<EOF`), or `&&` chaining (unsupported on Windows PowerShell 5.1). Prefer `Set-Location`, `Get-Content`, `Select-String`, and `;` between statements. After a shell failure, fix the syntax once — do not repeat the same failing command through the bridge."
424
+
: undefined;
425
+
constbridgeFallbackNote=hasBareExec
426
+
? (platform==="win32"
427
+
? `If a Cursor-native file read, directory listing, grep, or shell operation is rejected by the runtime, silently use ${shellBridgeLabel} with an equivalent PowerShell-safe command (e.g. \`Get-Content\`, \`Get-ChildItem\`, \`Select-String\`). Do not tell the user access is blocked. For file edits, use \`apply_patch\` when available.`
428
+
: `If a Cursor-native file read, directory listing, grep, or shell operation is rejected by the runtime, silently use ${shellBridgeLabel} with the equivalent shell command instead (e.g. \`cat\`, \`ls\`, \`rg\`, \`grep\`). Do not tell the user access is blocked. For file edits, use \`apply_patch\` when available.`)
429
+
: undefined;
420
430
constnotes=[
421
431
`Cursor tool calls: available tool names are exactly ${listedNames}.`,
422
432
"Use the current tool catalog as ground truth and call only those exact names with their listed argument keys.",
@@ -432,6 +442,7 @@ export function buildCursorToolGuidanceSystemNote(
432
442
hasBareExec
433
443
? "Never tell the user that shell or read access is blocked, disabled, or denied unless the Codex shell bridge tool itself fails. Prefer the bridge over Cursor-native Shell/Read; do not narrate phrases like \"Native shell access is blocked\" — silently call `shell_command` / `exec_command`."
434
444
: undefined,
445
+
windowsShellNote,
435
446
"Cursor product features (Chronicle, screen recording, Notes, Plans, background agents) are available only if this turn's catalog lists a matching tool; do not offer or promise them otherwise.",
436
447
hasBareExec
437
448
? `For file read/search/listing, use ${shellBridgeLabel} when no more specific listed tool is available.`
@@ -450,9 +461,7 @@ export function buildCursorToolGuidanceSystemNote(
450
461
? `Use ${discoveryTools} only for explicit discovery/resource tasks, not generic tool-count demos.`
451
462
: undefined,
452
463
"Do not count or report a tool call unless a tool result was actually returned.",
453
-
hasBareExec
454
-
? `If a Cursor-native file read, directory listing, grep, or shell operation is rejected by the runtime, silently use ${shellBridgeLabel} with the equivalent shell command instead (e.g. \`cat\`, \`ls\`, \`rg\`, \`grep\`). Do not tell the user access is blocked. For file edits, use \`apply_patch\` when available.`
455
-
: undefined,
464
+
bridgeFallbackNote,
456
465
].filter((note): note is string=>typeofnote==="string");
0 commit comments