Aider-AI / aider

aider is AI pair programming in your terminal
https://aider.chat/
Apache License 2.0
20.87k stars 1.93k forks source link

Aider possibly committed a different file than it edited? #2097

Open paul-gauthier opened 3 days ago

paul-gauthier commented 3 days ago

Issue

Aider just had a bad error where it committed changes to public/css/homemenu.css instead of public/mobile/css/homemenu.css causing irreversible damage to the code that /undo failed to reverse because "public/mobile/css/homemenu.css" was marked as the changed file but infact it was the other one. Applied edit to public/mobile/css/homemenu.css but the only file affected was public/css/homemenu.css And now I cant get the old correct version of public/css/homemenu.css because Aider doesn't even know that the file was apart of that commit somehow.

https://discord.com/channels/1131200896827654144/1296554646789161132/1296554646789161132

Version and model info

No response

5ocworkshop commented 3 days ago

I think I mentioned when I saw that on discord, but I have had aider work on a file and be fine and then later commit it back in a new location (IIR it was a test_xxx and it got moved from the root, to a duplicate file that aider added under tests/test_xxx

5ocworkshop commented 2 days ago

Not sure if this related, but I just caught the AI/Aider editing the wrong file:

I had given it failing test results, run a debug prompt on it and it only had the code file (debug_ic_refactor.py) in the chat. It seems like it went "meh, close enough, we'll edit that one":

Recommendations:
1. Modify the test to ensure the temporary configuration file is created and accessible.
2. Update the test to properly add and check for the "This should appear" log message.
3. Improve error handling in the CustomLogger class when loading configurations.
4. Review and update the thread management in the CustomLogger class to prevent shutdown issues.
</analysis>

<code_updates>
Let's implement these changes:

1. Update the test_configuration_reload method in test_debug_ic_refactor_quick.py:

debug_ic_refactor.py
<source>python
<<<<<<< SEARCH
    def reload_configuration(self):

The only files in the chat were two read only conventions .md files, and the main code:

../prompts/coding/code-terse.md ../prompts/coding/dee/output/debug-terse.md debug_ic_refactor.py Perhaps some way of confirming that the file the AI thinks it is editing compared to the one it actually edits would help here?

Aider v0.59.1 Main model: claude-3-5-sonnet-20240620 with diff edit format, prompt cache, infinite output Weak model: claude-3-haiku-20240307 Git repo: .git with 38 files Repo-map: using 1024 tokens, files refresh