Where does the bug appear (feature/product)?
Cursor IDE
Describe the Bug
My workflow makes heavy use of git worktrees and when the agent cleans up the worktree (like moving the worktree to the main checkout for testing) many times it gets confused because it was using the shell tool at the worktree location and after deleting the directory it tries to use the shell but forgets it’s pointed at the deleted worktree.
it says things like:
“The shell is unresponsive right now — commands are running but not returning. Would you be able to open a fresh terminal and run this yourself?”
and I can (now that I finally figured out what it keeps doing wrong) easily point it in the right direction:
“use a proper CWD in your shell” is all it takes for it to realise it’s mistake and get it on track.
the bug is this: your shell tool, when called with a CWD that deson’t exist, needs to not silently fail, and instead it should hint to the LLM that the CWD does not exist, so that it can auto correct its mistake.
Steps to Reproduce
have the agent create a branched worktree tracking a branch
have the agent run some shell commands in there like run a test or whatever.
have the agent move the worktree and mnove the branch back to main checkout
Have the agent run a shell command again (it will likely forget to use the new CWD)
Expected Behavior
the agent is told by the harness that the CWD used in the shell tool does not exist and it automaticallyu corrects itself.
Screenshots / Screen Recordings
Operating System
MacOS
Version Information
Version: 3.8.23
VS Code Extension API: 1.105.1
Commit: 7cf19b7482706625cdb70db3211b7dd035b7aa30
Date: 2026-06-23T14:57:42.334Z
Layout: glass
Build Type: Stable
Release Track: Default
Electron: 40.10.3
Chromium: 144.0.7559.236
Node.js: 24.15.0
V8: 14.4.258.32-electron.0
xterm.js: 6.1.0-beta.256
OS: Darwin arm64 25.3.0
For AI issues: which model did you use?
Claude Sonnet 4.6 Medium
Does this stop you from using Cursor
No - Cursor works, but with this issue
