-
Notifications
You must be signed in to change notification settings - Fork 45k
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
Fix problematic check_duplicate_operation and calls #3126
Fix problematic check_duplicate_operation and calls #3126
Conversation
This pull request has conflicts with the base branch, please resolve those so we can evaluate the pull request. |
Conflicts have been resolved! 🎉 A maintainer will review the pull request shortly. |
Codecov ReportPatch coverage has no change and project coverage change:
Additional details and impacted files@@ Coverage Diff @@
## master #3126 +/- ##
==========================================
- Coverage 49.63% 41.53% -8.10%
==========================================
Files 64 64
Lines 3022 3014 -8
Branches 505 503 -2
==========================================
- Hits 1500 1252 -248
- Misses 1402 1699 +297
+ Partials 120 63 -57
... and 14 files with indirect coverage changes Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report in Codecov by Sentry. |
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## master #3126 +/- ##
==========================================
+ Coverage 56.88% 56.99% +0.10%
==========================================
Files 67 67
Lines 3043 3053 +10
Branches 509 513 +4
==========================================
+ Hits 1731 1740 +9
Misses 1174 1174
- Partials 138 139 +1
☔ View full report in Codecov by Sentry. |
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Ignored Deployment
|
Please check out #1891. The solution we are looking for is not to remove the logger, but to fix it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please fix the logger instead of removing it
I can implement the suggestion you had on the other there where we hash the content and add this to the log line. However, for append_file, there are many cases where we need to add the same exact content to the same file which will break even with the new changes. I don't think appending the same text to the same file that we have in the past should be an error condition, what do you think? |
This reverts commit d685e5f.
Do you have an example? This feature was implemented because agents would regularly end up in infinite loops, performing the same file operation over and over. That function should be preserved. I think a large fraction of the "duplicate operation" errors can be mitigated by reading/parsing the log in a way that makes sure only the last relevant operations are taken into account to determine whether it is a duplicate or not. Ideas:
|
Sure, here's one example. I would like an agent to track the price of a stock every 5 minutes and record it to a file. The stock starts at 100, goes to 105, then drops back down to 100: write stocks.txt-427BB37B82189ED44CE979C59AA1CF3CDA2BBA42300B00743B0DA5EB14A63164 This is easily solved by adding a timestamp from the client side to the appending content, but it may be a sub-par user experience on the way to finding a solution. If the infinite loops are as big of an issue as you say, I agree we should keep it. I've updated the PR with the first steps (adding hash to log entries) and will see if we need to add a richer experience this week |
Something tells me there are less resource-intensive ways to do that ;) But I get your point. |
The process flow chart for the write_to_file function would be:
|
For sure, typing it out makes me realize how silly it sounds. Either way, I re-added it for now, take a look |
Sounds good, I'll take a look |
Background
Many issues (#1891 (comment)) have been spawned from the fact that check_duplicate_operation will prevent you from writing, appending, or deleting the same file more than once.
Changes
Removed the offending method and calls. I attempted to pursue a solution where we hashed the content and added it to each line of the file logging command, but then realized there were still cases where this would break (if we appended the same text to the same file twice, which is a perfectly valid operation and common as well). So, just removed the offending code.
Documentation
Code removed
Test Plan
Ran unittests and prompt asking chatGPT to test the specific scenario
PR Quality Checklist