Worktrees get ignored by agent when triying to ask to copy some work from non worktree folder/original folder
Steps to Reproduce
start working on a worktree using agent window
ask it to copy some changes from current window
Cursor will behave weirdly by moving the agent to current window and out of worktree created
thus current work gets hampered
although it shows in agent work is being done in worktree but still we can see clearly that cursor has shifted the agent and work to current window which is using orginal folder not the worktree folder at all
Expected Behavior
Agent should be working inside the worktree only and should never shift to current window at all
Operating System
MacOS
Current Cursor Version (Menu β About Cursor β Copy)
Hey, thanks for the report. This looks like a known issue with worktrees, where the agent loses the worktree context and switches back to the main directory.
The team is working on fixes for worktree functionality. To help with debugging, can you share:
The Request ID for a specific case where the agent switched directories (chat context menu β Copy Request ID)
The exact prompt text that triggered the switch
Did you use file mentions (the @ symbol) to reference files from the main directory?
Item 3 is especially interesting. Thereβs a known bug where file mentions in worktrees can cause edits to be applied to files in the main branch instead of the worktree.
Hi, I answered with the Request Id 6 hours ago, strangely my response has disapeared.
Find below to data you have required :
Request Id : e4d25486-8f95-43bf-877c-060b1037bb01
Prompt in Ask Mode : change the folder name to widgets and carefully review every place where components keyword is used and if it should be changed as well.
then Prompt in Agent Mode - Auto : Apply these changes