-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Diff-Merge not very reliable - Sweep enhancements #435
Comments
Thanks for trying aider and filing this issue. What aider version, model, and edit-format settings were you using? I would love any concrete examples you have of editing failures. To be most useful, I need as much of the following as you are able to provide.
|
Using latest version (updated a couple of minutes ago). Code to change: ` @SneakyThrows
Aider logs: src\main\java\com\example\rdw\service\sync\eb\service\EbService.java
--- src\main\java\com\example\rdw\service\sync\eb\service\EbService.java @@ ... @@
@@ ... @@
Malformed response #1, retrying... src\main\java\com\example\rdw\service\sync\eb\service\EbService.java does not contain lines that match the diff you provided! src\main\java\com\example\rdw\service\sync\eb\service\EbService.java does not contain these 2 exact lines in a row:
--- src\main\java\com\example\rdw\service\sync\eb\service\EbService.java @@ ... @@
@@ ... @@
Please note that the diff provided is based on the assumption that the original file contains the usage of ForkJoinPool which is being replaced with ExecutorService. If the original file does not containForkJoinPool, please provide the correct context or the specific part of the code that needs to be changed. Committing src\main\java\com\example\rdw\service\sync\eb\service\EbService.java before applying edits. src\main\java\com\example\rdw\service\sync\eb\service\EbService.java does not contain lines that match the diff you provided! src\main\java\com\example\rdw\service\sync\eb\service\EbService.java does not contain these 2 exact lines in a row:
UnifiedDiffNoMatch: hunk failed to apply! src\main\java\com\example\rdw\service\sync\eb\service\EbService.java does not contain lines that match the diff you provided! src\main\java\com\example\rdw\service\sync\eb\service\EbService.java does not contain these 5 exact lines in a row:
--- src\main\java\com\example\rdw\service\sync\eb\service\EbService.java @@ ... @@
@@ ... @@
Please ensure that the provided code snippet is the correct context from the file EbService.java. If the file does not contain the lines mentioned in the diff, the patch will not apply. If Committing src\main\java\com\example\rdw\service\sync\eb\service\EbService.java before applying edits. src\main\java\com\example\rdw\service\sync\eb\service\EbService.java does not contain lines that match the diff you provided! src\main\java\com\example\rdw\service\sync\eb\service\EbService.java does not contain these 2 exact lines in a row:
UnifiedDiffNoMatch: hunk failed to apply! src\main\java\com\example\rdw\service\sync\eb\service\EbService.java does not contain lines that match the diff you provided! src\main\java\com\example\rdw\service\sync\eb\service\EbService.java does not contain these 5 exact lines in a row:
─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── |
Thanks for the detail. Am I correct that you were using the Does your file I ask because it is having trouble applying this diff, which looks to me like it would be trying to modify the imports at the top if your file.
|
Yes, using gpt-4-1106-preview. Imports: ` import com.gargoylesoftware.htmlunit.*; import javax.annotation.PostConstruct; @SuppressWarnings({"SpellCheckingInspection", "ResultOfMethodCallIgnored"})
` |
Do you in general plan to implement the enhancements sweep has done because of the identified weaknesses? |
Thanks for the detailed debugging info. It helped uncover a small bug, which has been fixed. The change is available in the main branch. You can get it by installing the latest version from github:
If you have a chance to try it, let me know if it works better for you. |
Unfortunately no luck (same model + prompt) src\main\java\com\example\raederwerk\service\sync\eb\service\EbService.java
--- src\main\java\com\example\raederwerk\service\sync\eb\service\EbService.java @@ ... @@
@@ ... @@
This diff replaces the usage of ForkJoinPool with ExecutorService and updates the relevant code to use the ExecutorService methods for submitting tasks and shutting down the executor. The import Committing src\main\java\com\example\rdw\service\sync\eb\service\EbService.java before applying edits. src\main\java\com\example\rdw\service\sync\eb\service\EbService.java does not contain lines that match the diff you provided! src\main\java\com\example\rdw\service\sync\eb\service\EbService.java does not contain these 2 exact lines in a row:
UnifiedDiffNoMatch: hunk failed to apply! src\main\java\com\example\rdw\service\sync\eb\service\EbService.java does not contain lines that match the diff you provided! src\main\java\com\example\rdw\service\sync\eb\service\EbService.java does not contain these 2 exact lines in a row:
UnifiedDiffNoMatch: hunk failed to apply! src\main\java\com\example\rdw\service\sync\eb\service\EbService.java does not contain lines that match the diff you provided! src\main\java\com\example\rdw\service\sync\eb\service\EbService.java does not contain these 9 exact lines in a row:
--- src\main\java\com\example\rdw\service\sync\eb\service\EbService.java @@ ... @@
@@ ... @@
This diff replaces the usage of ForkJoinPool with ExecutorService and updates the relevant code to use the ExecutorService methods for submitting tasks and shutting down the executor. The import Malformed response #2, retrying... src\main\java\com\example\rdw\service\sync\eb\service\EbService.java does not contain lines that match the diff you provided! src\main\java\com\example\rdw\service\sync\eb\service\EbService.java does not contain these 2 exact lines in a row:
UnifiedDiffNoMatch: hunk failed to apply! src\main\java\com\example\rdw\service\sync\eb\service\EbService.java does not contain lines that match the diff you provided! src\main\java\com\example\rdw\service\sync\eb\service\EbService.java does not contain these 2 exact lines in a row:
UnifiedDiffNoMatch: hunk failed to apply! src\main\java\com\example\rdw\service\sync\eb\service\EbService.java does not contain lines that match the diff you provided! src\main\java\com\example\rdw\service\sync\eb\service\EbService.java does not contain these 9 exact lines in a row:
I apologize for the confusion. Let's try again with the correct diff. I will now provide a diff that should apply cleanly to the current contents of the file EbService.java. --- src/main/java/com/example/rdw/service/sync/eb/service/EbService.java @@ ... @@
@@ ... @@
This diff replaces the usage of ForkJoinPool with ExecutorService and updates the relevant code to use the ExecutorService methods for submitting tasks and shutting down the executor. The import Malformed response #3, aborting. src/main/java/com/example/rdw/service/sync/eb/service/EbService.java does not contain lines that match the diff you provided! src/main/java/com/example/rdw/service/sync/eb/service/EbService.java does not contain these 2 exact lines in a row:
UnifiedDiffNoMatch: hunk failed to apply! src/main/java/com/example/rdw/service/sync/eb/service/EbService.java does not contain lines that match the diff you provided! src/main/java/com/example/rdw/service/sync/eb/service/EbService.java does not contain these 2 exact lines in a row:
UnifiedDiffNoMatch: hunk failed to apply! src/main/java/com/example/rdw/service/sync/eb/service/EbService.java does not contain lines that match the diff you provided! src/main/java/com/example/rdw/service/sync/eb/service/EbService.java does not contain these 9 exact lines in a row:
|
Thanks for trying the new version. It looks like your code had some of the changes from previous attempts already present in the file. You can see where aider is committing those dirty changes before applying the diffs from GPT when it outputs these lines in the logs you provided:
So the code in your file had already been mostly modified to "replace ForkJoinPool usage with ExecutorService." When you asked GPT to do that again, with the extra request to "Don't forget about imports" that confused GPT. The import changes were already in the file. Maybe revert the file to the state before any of the ExecutorService changes and try again? Is this a real coding problem you are trying to work on? Or just some kind of a test? |
Good catch, after reverting it worked. It's a real coding scenario, even a very simple one. Thank you very much. |
Seems like it's still having issue with the same method when the method is inside a source code file with many lines ~1000loc Other issue is following:Added MyService.java to the chat. com/test/abc/service/sync/eb/service/MyService.java
-> (Callable) () -> {
products by webDriver: " + e.getMessage());
This diff replaces the usage of ForkJoinPool with ExecutorService and adjusts Process finished with exit code 0Seems like it's mixing up with the added File path and automatically refusing to edit (using scripted version) |
What does "using scripted version" mean? |
Not using it via CLI but directly instantiated within a python script. |
It's going to be pretty tricky for me to help debug scripted invocations of aider. It's likely that you're using it in a way that is fairly different from the intended chat use case. |
I'm going to close this issue for now, but feel free to add a comment here and I will re-open or file a new issue any time. |
Malformed response #3, aborting. app-huggingface.py does not contain lines that match the diff you provided! app-huggingface.py does not contain these 14 exact lines in a row:
|
@linhcentrio there's a FAQ entry that might contain helpful information: https://aider.chat/docs/faq.html#aider-isnt-editing-my-files |
Hi,
had the opportunity to tryout some experiments on a Java Repository.
On a 800+ lines class unfortunately Aider failed to perform a clean merge, which triggered multiple attempts until failure.
Trying out Sweep yielded better performance for the same test case and the Diff-Output was kinda valid (although I didn't like the overall performance, missed crucial imports for proposed change).
Question: Do you plan to enhance aider's merging capabilities with the weaknesses mentioned here?
https://docs.sweep.dev/blogs/gpt-4-modification
Thanks for your efforts.
The text was updated successfully, but these errors were encountered: