Add auto mode for automated task execution without confirmation #3942
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR adds a new automation mode for aider that can perform tasks automatically without requiring confirmation for each step, with enhanced context-finding capabilities.
Features
Auto Mode
AutoCoder
class that inherits fromContextCoder
yes_to_all = True
to bypass confirmationsauto_accept_architect = True
to automatically accept architect changes/auto
to switch to this modeEnhanced Context Finding
get_enhanced_file_mentions
method that uses multiple strategies to identify relevant filesHow to Use
Users can now use the auto mode in several ways:
Start aider with the auto mode:
Start aider with auto mode but disable enhanced context finding:
Customize the minimum identifier length:
Switch to auto mode during a session:
Use the auto mode for a single command:
In auto mode, aider will:
This mode is particularly useful for automating repetitive tasks or for users who want a more streamlined experience without the need to confirm each step.
Issues Fixed
This PR also includes fixes for several issues that were encountered during testing:
1. TypeError in base_coder.py
The first issue was a TypeError in base_coder.py (line 181) where the
deep_context_search
parameter was being passed to theCoder.__init__
method, but the method didn't accept this parameter:This was fixed by:
deep_context_search
andmin_identifier_length
parameters to theCoder.__init__
methodCoder
classget_enhanced_file_mentions
method to theCoder
class2. UnicodeDecodeError in JSON Loading
The second issue was a UnicodeDecodeError when loading JSON files with non-ASCII characters:
This was fixed by:
aider/llm.py
that handles UTF-8 encoding for all JSON files loaded by litellmbase_coder.py
to handle UnicodeDecodeError exceptions:get_abs_fnames_content
choose_fence
get_read_only_files_content
These changes ensure that binary files (like MP3s, MP4s, and other non-text files) are gracefully handled and don't cause the application to crash with UnicodeDecodeError.
3. Token Limit Exceeded with Enhanced Context Finding
When using the enhanced context finding feature, there's a potential issue with exceeding token limits, especially in large codebases:
This is a known limitation when using enhanced context finding in large codebases. Users should be aware that they may need to:
/drop
to remove unneeded files from the chat/clear
to clear the chat history--no-deep-context-search
to disable enhanced context finding in very large codebases--min-identifier-length
parameter to reduce the number of matches