Worktrees are not working as expected

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.

A few similar reports from the last few days:

The team is working on fixes for worktree functionality. To help with debugging, can you share:

  1. The Request ID for a specific case where the agent switched directories (chat context menu β†’ Copy Request ID)
  2. The exact prompt text that triggered the switch
  3. 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.