[BUG] Unwanted file navigation after edit acceptance: End up on unrelated files

Resolved 💬 5 comments Opened Oct 27, 2025 by attison Closed Jan 9, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

When starting a new request while sitting on a file in the IDE (eg DataService.php), Claude makes the requested edit (correctly) in another file (eg User.php). When the edit is accepted, the IDE navigates to an unrelated and seemingly random third file (eg comm-header.blade.php) with no prompt context justifying it. These files are usually but not always other open files in the editor, but are not necessarily among the most recently viewed or edited files.

This issue occurs 100% of the time when accepting single-file edits.

What Should Happen?

After acceptance, stay focused on either the edited file or the original file; no unsolicited navigation.

Error Messages/Logs

Steps to Reproduce

  1. Open at least 1 file in VS Code
  2. Use the integrated terminal to start Claude and initiate a request
  3. Accept the request by hitting 1 or clicking the accept button on the preview page in VS Code
  4. Change is accepted, preview mode closes, and unrelated file appears on the screen

Claude Model

Sonnet (default)

Is this a regression?

No, this never worked

Last Working Version

_No response_

Claude Code Version

2.0.27

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

VS Code integrated terminal

Additional Information

_No response_

View original on GitHub ↗

This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗