Where does the bug appear (feature/product)?
Cursor IDE
Describe the Bug
Describe the Bug / バグの説明
[English]
The AI Agent's Shell tool fails to spawn a proper shell process on Windows. The terminal shows `pid: -1` and all commands return empty output, even though exit code shows 0.
When asking the Agent to run commands like `git status`, `git commit`, or any shell command:
- Exit code returns 0 (appears successful)
- But stdout is always empty
- Terminal file shows `pid: -1` (process not spawned)
- Commands are NOT actually executed
This makes it impossible for the Agent to:
- Execute git operations (commit, push, pull)
- Run build tools or linters
- Execute any shell commands
Evidence from terminal state file:
---
pid: -1
cwd:
last_command: git status
last_exit_code: 0
---
Note: Regular IDE terminals work fine (pid: 24892, etc.), only Agent-spawned terminals fail.
[日本語]
AIエージェントのシェルツールがWindows環境で正常にシェルプロセスを起動できません。ターミナルには `pid: -1` が表示され、終了コードが0でも全てのコマンド出力が空になります。
`git status`、`git commit` などのコマンドをエージェントに実行させると:
- 終了コードは0(成功に見える)
- しかし標準出力は常に空
- ターミナルファイルには `pid: -1`(プロセス未起動)
- 実際にはコマンドが実行されていない
これにより、エージェントは以下ができません:
- git操作(commit, push, pull)の実行
- ビルドツールやリンターの実行
- あらゆるシェルコマンドの実行
ターミナル状態ファイルの証拠:
---
pid: -1
cwd:
last_command: git status
last_exit_code: 0
---
注:通常のIDEターミナルは正常動作(pid: 24892など)、エージェントが起動するターミナルのみ失敗します。
Steps to Reproduce
Steps to Reproduce / 再現手順
[English]
1. Open any Git repository workspace on Windows
2. Open Agent chat (Ctrl+L or click Agent)
3. Ask the Agent to run a shell command, e.g.: "Run git status"
4. Observe the result:
- Exit code: 0
- Output: empty
- Check terminals folder: pid: -1
[日本語]
1. Windows環境で任意のGitリポジトリをワークスペースとして開く
2. エージェントチャットを開く(Ctrl+L またはAgentをクリック)
3. エージェントにシェルコマンドの実行を依頼する(例:「git statusを実行して」)
4. 結果を確認:
- 終了コード:0
- 出力:空
- terminalsフォルダを確認:pid: -1
Expected Behavior
Expected Behavior / 期待される動作
[English]
When the Agent executes shell commands:
1. A shell process should spawn with a valid PID
2. Commands should actually execute
3. Command output (stdout/stderr) should be captured and returned
4. Files created by commands (e.g., via redirection) should exist
[日本語]
エージェントがシェルコマンドを実行する際:
1. 有効なPIDを持つシェルプロセスが起動されるべき
2. コマンドが実際に実行されるべき
3. コマンド出力(stdout/stderr)がキャプチャされて返されるべき
4. コマンドで作成されるファイル(リダイレクト等)が存在するべき
Operating System
Windows 10/11
Current Cursor Version (Menu → About Cursor → Copy)
Version: 2.1.48 (system setup)
VSCode Version: 1.105.1
Commit: ce371ffbf5e240ca47f4b5f3f20efed084991120
Date: 2025-12-04T19:26:27.263Z
Electron: 37.7.0
Chromium: 138.0.7204.251
Node.js: 22.20.0
V8: 13.8.258.32-electron.0
OS: Windows_NT x64 10.0.26100
Additional Information
Attempted Workarounds / 試した回避策
| # | Workaround / 回避策 | Result / 結果 |
|---|---|---|
| 1 | Reload Window (Developer: Reload Window) / ウィンドウの再読み込み | |
| 2 | Full Cursor restart / Cursorの完全再起動 | |
| 3 | Enable Legacy Terminal Tool (cursor.chat.useLegacyTerminal: true) |
|
| 4 | Change default terminal to Command Prompt / デフォルトターミナルをCommand Promptに変更 | |
| 5 | Enable PowerShell Legacy ReadLine / PowerShell Legacy ReadLineの有効化 | |
| 6 | Use cmd /c prefix for commands / コマンドに cmd /c プレフィックスを使用 |
|
| 7 | Use background execution (is_background: true) / バックグラウンド実行を使用 |
|
| 8 | Redirect output to file / 出力をファイルにリダイレクト | |
| 9 | Change default terminal to Git Bash / デフォルトターミナルをGit Bashに変更 |
Workaround / 回避策
Current Workaround / 現時点での回避策
[English]
Set Git Bash as the default terminal profile for Windows:
- Open Settings (
Ctrl + ,) - Search for “terminal default profile windows”
- Select “Git Bash” from the dropdown
- Restart Cursor
Or add these settings to settings.json:
{
"terminal.integrated.defaultProfile.windows": "Git Bash",
"terminal.integrated.profiles.windows": {
"Git Bash": {
"path": "C:\\Program Files\\Git\\bin\\bash.exe",
"icon": "terminal-bash"
}
}
}
Note: This requires Git for Windows to be installed. After applying this workaround, the Agent can successfully execute shell commands including git operations (commit, push, pull).
[日本語]
Git BashをWindowsのデフォルトターミナルプロファイルに設定する:
- 設定を開く(
Ctrl + ,) - “terminal default profile windows” を検索
- ドロップダウンから “Git Bash” を選択
- Cursorを再起動
または、settings.json に以下の設定を追加:
{
"terminal.integrated.defaultProfile.windows": "Git Bash",
"terminal.integrated.profiles.windows": {
"Git Bash": {
"path": "C:\\Program Files\\Git\\bin\\bash.exe",
"icon": "terminal-bash"
}
}
}
注意: この回避策にはGit for Windowsのインストールが必要です。この回避策を適用後、エージェントはgit操作(commit, push, pull)を含むシェルコマンドを正常に実行できるようになります。
Operating System / オペレーティングシステム
Windows 10/11
(Build 10.0.26100)
Additional Information / 追加情報
[English]
Related issues:
- https://github.com/cursor/cursor/issues/2669
- https://forum.cursor.com/t/agent-shell-tool-fails-to-spawn-shell-process-on-wsl-pid-1/145286
- https://forum.cursor.com/t/windows-dotnet-shell-commands-not-working/138807
Settings applied (no effect):
{
"terminal.integrated.defaultProfile.windows": "Git Bash",
"cursor.chat.useLegacyTerminal": true,
"powershell.integratedConsole.useLegacyReadLine": true
}
[日本語]
関連するIssue:
- https://github.com/cursor/cursor/issues/2669
- https://forum.cursor.com/t/agent-shell-tool-fails-to-spawn-shell-process-on-wsl-pid-1/145286
- https://forum.cursor.com/t/windows-dotnet-shell-commands-not-working/138807
適用した設定(効果なし):
{
"terminal.integrated.defaultProfile.windows": "Git Bash",
"cursor.chat.useLegacyTerminal": true,
"powershell.integratedConsole.useLegacyReadLine": true
}
Does this stop you from using Cursor
No - Cursor works, but with this issue