Apply code update from chat creates a new file

In the previous version 0.41.3 a code update to my file it would apply it to the correct file. An update came I accepted the update. when it reopened this started happening. Now it creates a new file in a new folder with the updated code. I uninstalled and reinstalled the previous version and the issue still persists. Anyone have thoughts on how to fix this?

2 Likes

Hi @Dan.Lane

Could you show me the steps to reproduce it?

I want to share the video recording of the bug but for some reason, I am not allowed to upload a video in the forumā€¦ let me take screenshots and see if that will show.


Let me know if you need further explanation.

and because I am a new user I can only upload one imageā€¦ ughhhā€¦

1 Like


had to wait 16 seconds to postā€¦

Yeah, itā€™d be great if you could provide a bit more detail. I canā€™t quite figure out whatā€™s happening from the screenshots. You could also record a YouTube Shorts video and send the link.

here is the basics. I asked the chat to review my file and shared it in the chat. It generated the code you see. I click on apply. It created a new file in the incorrect directory structure although it was correct placement it was not in the correct place. I already have the file and it is not updating the file it is rather creating a whole new file in a new directory. Rather than updating the file.

Also if I click on the name in the chat window to the left of ask copy apply it opens the correct file.

image

Wait, but as far as I know, the chat canā€™t create files, let alone directories. Thatā€™s something Composer can do. Maybe you have two identical files in different directories? It happens sometimes.

I added a file to the composer and removed it is still doing it. Not to every file itā€™s randomā€¦ If I uninstall and delete the files for Cursor reinstallā€¦ will this resolve my issue? what will I lose by doing this? It is causing me to not be able to do as much as I would like as quickly as I would like.

also verified I only have the one file with the files it seems to be doing it to. One other thing is it is doing it to files that chat ai suggests parts of a code for a file. If I click apply for the suggested code change it applies then the next one down for the same file it goes and creates the file in a completely new directory albeit the dir structure is correct as well as the file name.

Thanks for reporting this and for the video! It seems like the apply is thinking you want to edit src/{file} whereas you are actually on {project_dir}/src/{file}. This is either a model intelligence issue or an issue with our path resolution (perhaps specifically on Windows). We didnā€™t make any changes to this logic in this new release, so it should not be coming from the new release.

To confirm, this happens on every apply or just on some applies?

CCā€™ing @shaoruu

(Also @deanrie, it is possible for apply to create a file from chat if apply thinks the code should be added to a file location that doesnā€™t already exist, but this happens very rarely and when it does happens it is often erroneous).

1 Like

Thank you for your reply. I will try this in the other models and see if that is the fix.

It applies on some of the suggested code updates, not all of them, but when it happens on a particular file and it updates all of the code for that particular file, it will always happen on that file no matter what I do.

Hmm strange, thanks for the info. We have someone looking into it trying to reproduce. If itā€™s ultimately a model intelligence issue, then trying other models should help, as youā€™ve been doing.

Thank you by the way, I was using sonnet 3.5.

I have the same issue, last week when i was working i didnā€™t have the issue, for now the solution would be to just copy the text from chat instead of pressing the apply button, it does it with all models it seemsā€¦

Same, both windows and osx

I have the same issue with claude-3.5-sonnet but it works fine with gpt-4o.

When on Sonnet and using Chat, new suggestions always create a new tab and paste the whole code there. They are no longer applied to my code unless I switch models.

Iā€™m having this issue as well. On MacOS, using claude-3.5-sonnet-20241022. Apply has worked for me in general, but on a set of files Iā€™m working now, if I click apply it creates a file in the wrong path. This is in ā€˜chatā€™. I know chat isnā€™t supposed to create files, but I think itā€™s doing it as part of the logic of ā€œupdatingā€ the file at the wrong path.

In my case I have a VSCode workspace with multiple folders mounted as top-level projects. Iā€™m working in one of the folders, but the ā€œapplyā€ incorrectly happens in another one (the first project in the list).

Itā€™s 100% reproducible with these files. I havenā€™t experienced this with other uses of apply. Happy to jump on a zoom or something if someone wants to debug this. Itā€™s pretty annoying.

2 Likes