AutoGPT: File Operations logger breaks incremental edits

Duplicates

  • I have searched the existing issues

Steps to reproduce 🕹

  1. come up with prompt that writes to a file
  2. it suggest following:
CRITICISM:  I need to ensure that the report is saved correctly and that it is easy to read and understand.
SPEAK:  Let's save the report to a file using the 'write_to_file' command so that we can access it later. What would you like to name the file?
Attempting to fix JSON by finding outermost brackets 
Apparently json was fixed. 
NEXT ACTION:  COMMAND = write_to_file ARGUMENTS = {'file': '<file_name>', 'text': 'Here is the text to write to file'}
Enter 'y' to authorise command, 'y -N' to run N continuous commands, 'n' to exit program, or enter feedback for ...
Input:y
-=-=-=-=-=-=-= COMMAND AUTHORISED BY USER -=-=-=-=-=-=-= 
SYSTEM:  Command write_to_file returned: Error: File has already been updated.
 THOUGHTS:  Let's delete the file we just created using the 'delete_file' command and then save the report again using a different file name.
REASONING:  Deleting the file will allow us to save the report again using a different file name. This will ensure that we have a clean slate to work with and that we don't accidentally overwrite the previous report.

Note that the <file_name> is from the actual output so that’s the file name it tries to save to.

Current behavior 😯

Writing to file fails and the filename is weird.

Expected behavior 🤔

It should succeed with correct file name.

Likely relates to this issue: https://github.com/Significant-Gravitas/Auto-GPT/issues/1889 Both are trying to use the same malformed file name.

Your prompt 📝

# Paste your prompt here

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 9
  • Comments: 18 (6 by maintainers)

Most upvoted comments

image

only comment these 2 lines and seems working well

When I manually delete the file_logger.txt before the next write happens, the write is then done correctly.

Same issue. I think looking at write_to_file under file_operations.py I saw that check_duplicate_operation() is causing my error where it just updates once in a session and because it was updated once it doesn’t allow more data/info to be placed in the created .txt file.

Saw some logging issue was updated with append but I think I’m on ‘stable’ and still get the error shown here.

I think the duplicate checking thing should be removed. Appending to the same file (and even the same content to the same file) is a valid operation, same with writing to the same file etc.

I’m also having this issue

I have the same problem. Its always something new, starting to get used to this

Ah got it - it looks like this is occurring because somebody introduced a file logging system which results in an infinite loop. I’ll have a PR out soon to fix