Skip to content

Commit 84e5aea

Browse files
greenpoloclaude
andcommitted
fix(cursor): scope cursor-execute to file ops only; defer shell to caller
Cursor's `agent acp` mode has two distinct upstream bugs (no software fix available, both confirmed by Cursor staff): 1. Windows shell auto-detection picks WSL bash instead of PowerShell, so Terminal/execute tool calls hang at tool_call_update[in_progress] forever. forum.cursor.com/t/.../155544 2. MCP tool calls silently stop emitting mcpToolCall events starting 2026.04.17. forum.cursor.com/t/.../158988 Workarounds tried per forum: Legacy Terminal Tool, removing WSL from PATH, disabling MCP. None help. Last known-good version is 2026.04.14 which the user does not have cached. Practical fix: stop trying to use Cursor's Terminal tool. Cursor's role in this marketplace is the fast-lane file writer (200+ lines, multi-file patterns, mechanical implementation) — file ops via ACP work fine. Move shell verification to the parent Claude thread, which has a reliable Bash tool. Changes: - agents/cursor-execute.md framing: "DO NOT use Terminal/execute" + the ## Verification section is now "(deferred — caller runs)" instead of asking Cursor to run commands and report exit codes. - cursor/commands/execute.md: scope note + post-dispatch instruction for the calling thread to run verification and surface results. - adapters/cursor.mjs: expanded the known-bad-version warning to cover both bugs and broaden coverage (added 2026.04.29 to the affected set). This unblocks daily use while we wait for upstream Cursor fixes. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent bb9bb1a commit 84e5aea

3 files changed

Lines changed: 50 additions & 21 deletions

File tree

plugins/cursor/commands/execute.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ allowed-tools: Bash(node:*), AskUserQuestion, Agent
66

77
Invoke the `multi:cursor-execute` subagent via the `Agent` tool, forwarding the user's request as the prompt.
88

9-
The subagent runs Cursor in Agent mode on Auto model — give it a concrete, well-defined plan step and Cursor implements it with full tool access. Cursor is the fast lane: pick it over `/codex:execute` when the spec is clear, the work is mostly mechanical (long file writes, pattern application across many files, 200+ lines of code), and you want throughput over deep reasoning.
9+
The subagent runs Cursor in Agent mode on Auto model — give it a concrete, well-defined plan step and Cursor writes the files. **Scope: file operations only** (Read, Write, Edit, Apply Patch). Cursor's shell exec is unreliable in agent acp mode on Windows due to an upstream bug, so the subagent intentionally does not run verification commands. After it returns, run any listed verification yourself.
10+
11+
Cursor is the fast lane: pick it over `/codex:execute` when the spec is clear, the work is mostly mechanical (long file writes, pattern application across many files, 200+ lines of code), and you want throughput over deep reasoning.
1012

1113
Raw user request:
1214
$ARGUMENTS
@@ -18,4 +20,6 @@ Execution:
1820
- If the user passes `--resume`, the subagent will continue the latest Cursor execute thread for this repo.
1921
- If the request includes no prompt text, ask what Cursor should implement before proceeding.
2022

21-
Return Cursor's output verbatim.
23+
After the subagent returns, read its `## Verification` section and run those commands via your own Bash tool. Then surface the report and the verification results to the user.
24+
25+
Return Cursor's output verbatim, followed by your verification results.

plugins/multi/agents/cursor-execute.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ The forwarding contract — flag handling, runtime controls, safety rules, failu
1818
Prepend this framing block to the user's task text, then a blank line, then the user's task verbatim. Skip framing if the user already wrote outcome-style framing themselves.
1919

2020
```
21-
You are Cursor in Agent mode with full tool access. The task below is a well-defined plan step — implement it end-to-end without asking for confirmation. Batch file reads in parallel; batch edits per file. Skip upfront plans for clear tasks.
21+
You are Cursor in Agent mode. Use Read, Write, Edit, and Apply Patch — file ops are reliable. The task below is a well-defined plan step — implement it end-to-end without asking for confirmation. Batch file reads in parallel; batch edits per file. Skip upfront plans for clear tasks.
22+
23+
DO NOT use the Terminal/execute tool. Cursor's shell exec in agent acp mode has an upstream Windows bug (WSL bash auto-detection) that hangs commands silently. Do not run python, pytest, git, ls, wc, or any other shell command. If the task asks for shell-based verification, leave it for the caller to run after — do not attempt it yourself.
2224
2325
End your response with a structured final report in this exact format (verbatim markdown headers, no extra commentary after):
2426
@@ -29,8 +31,7 @@ End your response with a structured final report in this exact format (verbatim
2931
- relative/path/to/file (created|modified|deleted) — one-line reason
3032
3133
## Verification
32-
- command run — exit code — one-line interpretation
33-
(or "no verification commands run" if none)
34+
- (deferred — caller runs verification commands after dispatch; list any commands the caller should run, one per line)
3435
3536
## Notes
3637
- (optional, only if anything surprised you, was deferred, or remains open)
@@ -39,7 +40,7 @@ Task:
3940
<user task verbatim>
4041
```
4142

42-
The structured final report is what main Claude surfaces to the user. Cursor's chain-of-thought stream gets discarded once the report is in place — this turns Cursor's verbose token streaming into a codex-shaped clean answer.
43+
The structured final report is what main Claude surfaces to the user. Cursor's chain-of-thought stream gets discarded once the report is in place — this turns Cursor's verbose token streaming into a codex-shaped clean answer. The caller (main Claude) is responsible for running the verification commands listed in `## Verification` after the dispatch returns.
4344

4445
## Companion invocation
4546

@@ -53,3 +54,7 @@ Role-specific defaults that override or extend the multi-cli-runtime contract:
5354
- Cursor does not support `--effort`; ignore that flag if present.
5455
- For prompts expected to take more than ~90 seconds (multi-file refactors, large scaffolding, anything with >5 file ops), prefer `--background` so progress is visible via `/multi:status` instead of blocking the parent agent. Bounded prompts (1–3 file ops) stay foreground.
5556
- Append `2>&1` to the Bash call so runtime diagnostics surface.
57+
58+
## After the dispatch returns
59+
60+
When you (the parent Claude thread receiving this subagent's output) read the structured report, run the commands listed in `## Verification` yourself via your own Bash tool. Cursor cannot run shell commands reliably in agent acp mode on Windows (upstream WSL bash detection bug — see cursor.mjs comments and forum.cursor.com/t/shell-commands-in-agent-mode-are-not-returning-output/155544). Cursor's job is file writing; verification is yours.

plugins/multi/scripts/lib/adapters/cursor.mjs

Lines changed: 35 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -81,18 +81,37 @@ function buildPrompt(role, userTask) {
8181

8282
// ─── Known-bad version warning ────────────────────────────────────────────────
8383
//
84-
// Cursor 2026.04.17-787b533 has a documented regression: MCP tool calls and
85-
// the Terminal (execute) tool both silently break in agent acp mode. We can't
86-
// fix it from the client; we just want users to know about it instead of
87-
// spending hours debugging mysterious hangs.
84+
// Cursor's `agent acp` mode has two distinct upstream bugs we have to live
85+
// with. Both are confirmed by Cursor staff with no published fix or ETA:
8886
//
89-
// Forum threads:
90-
// https://forum.cursor.com/t/cursor-agent-cli-mcp-tool-calls-silently-stopped-working-in-2026-04-17/158988
91-
// https://forum.cursor.com/t/acp-permission-rejection-not-reported-to-client/153825
87+
// Bug 1 — MCP tool-call regression starting in 2026.04.17.
88+
// Tool descriptors are visible to the model but mcpToolCall events silently
89+
// never fire. CLI/headless only; the IDE is fine.
90+
// Forum:
91+
// https://forum.cursor.com/t/cursor-agent-cli-mcp-tool-calls-silently-stopped-working-in-2026-04-17/158988
92+
// Last known working version per Cursor staff: 2026.04.14-ee4b43a.
93+
// Workaround: pin via CURSOR_AGENT_PATH if you have an older binary cached.
9294
//
93-
// Auto-quiet on any other version. Warning fires once per process.
94-
95-
const KNOWN_BROKEN_CURSOR_VERSIONS = new Set(["2026.04.17-787b533"]);
95+
// Bug 2 — Windows shell auto-detection picks WSL bash (C:\Windows\System32\
96+
// bash.exe) instead of PowerShell, so command output capture fails silently
97+
// and Terminal/execute tool calls hang at tool_call_update[in_progress]
98+
// forever. Confirmed Windows-only; Cursor IDE handles this differently.
99+
// Forum:
100+
// https://forum.cursor.com/t/shell-commands-in-agent-mode-are-not-returning-output/155544
101+
// https://forum.cursor.com/t/acp-permission-rejection-not-reported-to-client/153825
102+
// Tested workarounds that don't help: Legacy Terminal Tool, removing WSL
103+
// from PATH, disabling MCP. No working software fix as of 2026-04-30.
104+
//
105+
// Our response: cursor-execute.md instructs Cursor to NOT use Terminal in agent
106+
// acp mode and defers shell verification to the parent Claude thread. File ops
107+
// (Read/Write/Edit/Apply Patch) work fine and that's what cursor-execute is
108+
// scoped to do. Warning below fires once per process if a known-affected
109+
// version is detected.
110+
111+
const KNOWN_BROKEN_CURSOR_VERSIONS = new Set([
112+
"2026.04.17-787b533",
113+
"2026.04.29-c83a488"
114+
]);
96115
let warnedAboutCursorVersion = false;
97116

98117
function maybeWarnAboutCursorVersion(versionString) {
@@ -102,11 +121,12 @@ function maybeWarnAboutCursorVersion(versionString) {
102121
if (!KNOWN_BROKEN_CURSOR_VERSIONS.has(v)) return;
103122
warnedAboutCursorVersion = true;
104123
process.stderr.write(
105-
`[cursor] Note: agent ${v} has known ACP regressions — ` +
106-
`Terminal/execute tool calls and MCP tools may stall in agent acp mode. ` +
107-
`cli-config.json allowlist (auto-injected) keeps simple shell exec working; ` +
108-
`complex multi-tool runs may still hang upstream. Pin an older build via ` +
109-
`CURSOR_AGENT_PATH if needed; otherwise wait for the next Cursor release.\n`
124+
`[cursor] Note: agent ${v} has known upstream ACP regressions — ` +
125+
`Terminal/execute tool calls hang on Windows (WSL shell auto-detection) and ` +
126+
`MCP tool calls silently fail (regression starting in 2026.04.17). ` +
127+
`cursor-execute is scoped to file ops only and defers shell verification ` +
128+
`to the parent thread. Pin 2026.04.14-ee4b43a via CURSOR_AGENT_PATH if ` +
129+
`you need MCP tools through Cursor; otherwise wait for the next Cursor release.\n`
110130
);
111131
}
112132

0 commit comments

Comments
 (0)