CopilotForXcode icon indicating copy to clipboard operation
CopilotForXcode copied to clipboard

Agent's follow up changes reverts the previous changes and causes endless loop

Open jduenas-fbin opened this issue 5 months ago • 7 comments

Describe the bug When using agent mode, if the agent needs to make changes in steps, the first set of changes gets reverted by the second set of changes, which causes the agent to attempt to fix it by redoing the first changes, which reverts the second set of changes, and it gets into an endless loop of trying to fix this.

Versions

  • Copilot for Xcode: 0.40.0
  • Xcode: 16.4
  • macOS: 15.5

Steps to reproduce

  1. Use agent mode to request changes to a single file. The agent needs to make changes in multiple steps. For example, adding a property first, then changing a function to use that property.
  2. Observe the agent making the first change successfully.
  3. When the agent then makes the second change, it reverts the first change when applying the second.
  4. The agent then realizes the first change isn't there, and so it decides to fix this.
  5. When re-applying the first change, it ends up reverting the second change.
  6. The agent then realizes this too, and attempts to fix it, which puts it into an endless loop.

Screenshots

Logs github-copilot-for-xcode.log

Additional context

jduenas-fbin avatar Jul 24 '25 14:07 jduenas-fbin

Found this same issue posted in the forum just now, but didn't see any similar issues here https://github.com/orgs/community/discussions/163388

jduenas-fbin avatar Jul 24 '25 18:07 jduenas-fbin

@jduenas-fbin thank you for reaching out. It's a known issue that we're fixing it, hope we can make a fix soon. The root cause is a document sync issue, where the agent fails to recognize the previous change correctly and repeatedly tries to revert or reapply it.

testforstephen avatar Jul 25 '25 01:07 testforstephen

@jduenas-fbin We just released a pre-release version https://github.com/github/CopilotForXcode/releases/tag/0.40.132 to fix the agent edit_file reliability issue, feel free to have a try.

testforstephen avatar Aug 01 '25 07:08 testforstephen