Copilot overwriting newer files when switching between nested workspaces

Open
#317,607 2 comments 0 reactions 1 assignee View on GitHub

@hediet is already working on this.

Since May 20, 2026.

Assessment

This issue has not been assessed yet.

Description

Type: Bug

Hello,

I have been noticing a "weird behaviour" when using copilot in 2 workspaces, where second workspace is nested in the first one, some files started randomly getting overwritten with their old version.

I have found out i am not in fact going insane, and managed to get reproduction steps and video:

Example hiearchy:
In this example workspace B is nested in the workspace A, with some files

  • Workspace A
    • somefile-A.ts
    • Workspace B
      • somefile-B.ts

Example scenario:

  1. Open up workspace A
  2. Update somefile-B.ts via copilot edit, but do not accept changes
  3. Open up workspace B, change content of somefile-B.ts to something entirely different, save changes
  4. Open up worspace A again, and revisit conversation from step 2 with unconfirmed (but still already written) changes
  5. somefile-B.ts reverts changes made in step 3 back to copilot cached state from conversation from step 2

Why this sucks:

When working in monolith architecture where you want to work in 2 different scopes:

  • Monolith scope for managing project-project interactions
  • Single project scope for finetuning internal logic without needing to have monolith context

And current behaviour does really mess you up if you do this after huge edits and have no idea what is going on and why it occured, I lost a lot of hours facepalming and scrathing my head.

My ideas for solving this

  • Some popup informing me that current file contents are newer than ones cached in that copilot session, and asking ME as developer if i want to revert back to copilot cached version or keep the newer one (even though that would invalidate the copilot session diff)

Right now this is done automatically and is destructive

Video evidence of this happening
(NOTE: file names differ from hiearchy from example, autosave is on)

https://github.com/user-attachments/assets/a5d72dd5-3402-4e77-b9ab-2feeacab92b4

Here is my vscode and copilot version:

Visual Studio Code
Version: 1.120.0 (system setup)
Commit: 0958016b2af9f09bb4257e0df4a95e2f90590f9f
Date: 2026-05-12T20:17:22Z (1 wk ago)
Electron: 39.8.8
ElectronBuildId: 13870025
Chromium: 142.0.7444.265
Node.js: 22.22.1
V8: 14.2.231.22-electron.0
OS: Windows_NT x64 10.0.26200
Identifier github.copilot-chat
Version 0.48.1
Last Updated 4 days ago

Dominant language
TypeScript
Stars
193k
Forks
42.9k
PR merge metrics
PR metrics pending

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from microsoft/vscode

All issues in microsoft/vscode

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.