Hacktoberfest 2026:維護者為十月標記出來的 issue,仍然開放、適合新手。 瀏覽 Hacktoberfest issue

Copilot Agent sometimes replaces contents of one file with contents of another file

未關閉
#617 5 則留言 2 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

評估

難度
4/5
預估耗時
3-5 天
新手友好度
28/100
Issue 類型
缺陷
描述清晰度
需要釐清
活躍度
停滯
技術堆疊
macos, swift

研究方向

首先查看連結的日誌,並將聊天 UI 的差異檢視器與 Xcode's git view 中顯示的變更進行比較。重點關注跨多個檔案的 Agent 編輯,以及輸入「continue」後的行為;完成的標準是重現該問題,並確保每個檔案都接收到其預期的變更,而不會被另一個檔案的內容取代。

由索引模型根據 Issue 內容生成。

描述

reviewed

Describe the bug
Sometimes when Copilot Agent mode works on a more complicated task, it can happen that the contents of one file are replaced with the contents of another file.

One example: Say we have some files A, B and C that Copilot tries to edit.
Copilot successfully suggests edits for all three files, but looking at the changes actually applied to Xcode only files A and B have the correct changes applied, while C now also contains the same code as for example B.

Versions

  • Copilot for Xcode: 0.44.0
  • Xcode: 26.0.1
  • macOS: 26.1 (happend on 26.0 as well)

Steps to reproduce

  1. Ask an Agent to perform some more complicated changes in a non-small code base.
  2. Watch as the changes are applied incorrectly.

Screenshots
correct edits in the chat ui diff viewer, but incorrectly applied when viewed from the Xcode git view:
Image

after typing continue, the previous changes are applied automatically and the new changes are applied incorrectly once again:
Image

Logs
Here are the logs from the time frame I've tried to reproduce the issue.
The stuff further down is probably more relevant, as I wasn't immediately able to reproduce it.
However, I don't really know what part of these logs actually contains useful information.

Additional context
Interestingly, opening the suggested changes from the chat ui (see example above), the changes for file A, B and C are valid.
They just seem to be applied incorrectly.
Also, the agent was stopped because it reached the maximum attempts limit.

Typing continue made the situation even weirder:
Staying with the example above, where previously there suggested changes were displayed in the chat ui, now only one change is shown.
Applying this change correctly, the whole issue described above would've been resolved.
However, this change was applied incorrectly as well:

actual edits before "continue":
A -> edited A
B -> edited B
C -> edited B

actual edits after "continue":
A -> edited A
B -> edited B -> edited A
C -> edited B

Please note that this A, B, C example might not 100% accurately describe the actually displayed behavior; it's just supposed to roughly illustrate the problem

I was only able to reproduce this in a more complex codebase (i.e. in my own project, where the code can get quite messy and complex in a few places).

When trying to reproduce the issue I used Grok Code Fast 1, I don't know which model I used when I first discovered this problem.

I tried to reproduce the issue in the Simple SwiftUI project, but I had no success.
However, I was able to reproduce the problem in my own project (this is not open source so I can't link to the code here).
I didn't have the time to try it on another larger project though.

主要語言
Swift
星號
6.3k
分支
2k
平均合併
3 天 21 小時
30 天內合併 PR
2

貢獻指南

開啟貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

github/CopilotForXcode 的其他 Issue

查看 github/CopilotForXcode 的全部 Issue

相似的 Issue

更多 Swift Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。