Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
0cda1c3
fix: Add BadGatewayError to exceptions list for retry.
szmania Nov 26, 2025
0a45d42
feat: Add BadGatewayError handling and test case
szmania Nov 26, 2025
129bf85
fix: Deduplicate tools before sending to the model to avoid errors.
szmania Nov 26, 2025
feb5e7a
feat: Deduplicate tool declarations and add a test for it.
szmania Nov 26, 2025
6bab0c1
refactor: Simplify test_legacy_tool_call_propagation and remove dedup…
szmania Nov 26, 2025
6c6ac4b
updated .gitignore
szmania Nov 26, 2025
dcd3db7
fixed merge conflicts
szmania Nov 26, 2025
fc7bffa
feat: Fix line endings in changed files since v0.88.10
szmania Nov 26, 2025
bee371e
converted line endings from windows to unix
szmania Nov 27, 2025
6ed6be0
removed fix line ending script
szmania Nov 27, 2025
76778c6
Bump Version
dwash96 Nov 27, 2025
cd92a2c
Add gitattributes
dwash96 Nov 27, 2025
e17c459
Merge remote-tracking branch 'szmania/gemini_2_5_pro_fix' into v0.88.31
dwash96 Nov 27, 2025
951257e
Allow retries on BadGatewayErrors
dwash96 Nov 27, 2025
0cb6631
Add context block configuration for more control over message sizes
dwash96 Nov 27, 2025
a3dfc86
Fix formatting
dwash96 Nov 27, 2025
d74ee43
Add similarity lookups a hedge against repetitious tool calls
dwash96 Nov 27, 2025
7436d45
update text to aider-ce when it asks you to re-run
burnettk Nov 27, 2025
c3e0584
Add multiple changes to improve agent mode task horizon length and ca…
dwash96 Nov 27, 2025
1d68527
Merge pull request #196 from burnettk/re-run-program-name-text-change
dwash96 Nov 27, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text=auto eol=lf
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
# Specific Files
!/.dockerignore
!/.flake8
!/.gitattributes
!/.gitignore
!/.pre-commit-config.yaml
!/CHANGELOG.md
Expand Down
2 changes: 1 addition & 1 deletion aider/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from packaging import version

__version__ = "0.88.30.dev"
__version__ = "0.88.31.dev"
safe_version = __version__

try:
Expand Down
243 changes: 184 additions & 59 deletions aider/coders/agent_coder.py

Large diffs are not rendered by default.

14 changes: 1 addition & 13 deletions aider/coders/agent_prompts.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,6 @@ class AgentPrompts(CoderPrompts):
1. **Turn 1**: Use `ShowNumberedContext` to get the exact, current line numbers.
2. **Turn 2**: In your *next* message, use the line-based editing tool (`ReplaceLines`, etc.) with the verified numbers.

### 2. SEARCH/REPLACE (Last Resort Only)
Use this format **only** when granular tools are demonstrably insufficient for the task (e.g., a complex, non-contiguous pattern change). Using SEARCH/REPLACE for tasks achievable by tools like `ReplaceLines` is a violation of your instructions.

**You MUST include a justification comment explaining why granular tools cannot be used.**

Justification: I'm using SEARCH/REPLACE because [specific reason granular tools are insufficient].
path/to/file.ext <<<<<<< SEARCH Original code to be replaced.
New code to insert.

REPLACE

</context>

Always reply to the user in {language}.
Expand Down Expand Up @@ -89,9 +78,8 @@ class AgentPrompts(CoderPrompts):
<context name="critical_reminders">
## Reminders
- Any tool call automatically continues to the next turn. Provide no tool calls in your final answer.
- Prioritize granular tools. Using SEARCH/REPLACE unnecessarily is incorrect.
- For SEARCH/REPLACE, you MUST provide a justification.
- Use context blocks (directory structure, git status) to orient yourself.
- Remove files you are done with viewing/editing from the context with the `Remove` tool. It is fine to re-add them later

{lazy_prompt}
{shell_cmd_reminder}
Expand Down
17 changes: 14 additions & 3 deletions aider/coders/base_coder.py
Original file line number Diff line number Diff line change
Expand Up @@ -688,7 +688,10 @@ def show_pretty(self):
return True

def get_abs_fnames_content(self):
for fname in list(self.abs_fnames):
# Sort files by last modified time (earliest first, latest last)
sorted_fnames = sorted(self.abs_fnames, key=lambda fname: os.path.getmtime(fname))

for fname in sorted_fnames:
content = self.io.read_text(fname)

if content is None:
Expand Down Expand Up @@ -783,8 +786,11 @@ def get_files_content(self, fnames=None):

def get_read_only_files_content(self):
prompt = ""
# Sort read-only files by last modified time (earliest first, latest last)
sorted_fnames = sorted(self.abs_read_only_fnames, key=lambda fname: os.path.getmtime(fname))

# Handle regular read-only files
for fname in self.abs_read_only_fnames:
for fname in sorted_fnames:
content = self.io.read_text(fname)
if content is not None and not is_image_file(fname):
relative_fname = self.get_rel_fname(fname)
Expand Down Expand Up @@ -829,8 +835,13 @@ def get_read_only_files_content(self):

prompt += f"{self.fence[1]}\n"

# Sort stub files by last modified time (earliest first, latest last)
sorted_stub_fnames = sorted(
self.abs_read_only_stubs_fnames, key=lambda fname: os.path.getmtime(fname)
)

# Handle stub files
for fname in self.abs_read_only_stubs_fnames:
for fname in sorted_stub_fnames:
if not is_image_file(fname):
relative_fname = self.get_rel_fname(fname)
prompt += "\n"
Expand Down
33 changes: 23 additions & 10 deletions aider/coders/chat_chunks.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,31 @@ class ChatChunks:
chat_files: List = field(default_factory=list)
cur: List = field(default_factory=list)
reminder: List = field(default_factory=list)
chunk_ordering: List = field(default_factory=list)

def __init__(self, chunk_ordering=None):
if chunk_ordering is not None:
self.chunk_ordering = chunk_ordering

def all_messages(self):
return (
self.system
+ self.examples
+ self.readonly_files
+ self.chat_files
+ self.repo
+ self.done
+ self.cur
+ self.reminder
)
if self.chunk_ordering:
messages = []
for chunk_name in self.chunk_ordering:
chunk = getattr(self, chunk_name, [])
if chunk:
messages.extend(chunk)
return messages
else:
return (
self.system
+ self.examples
+ self.readonly_files
+ self.chat_files
+ self.repo
+ self.done
+ self.cur
+ self.reminder
)

def add_cache_control_headers(self):
if self.examples:
Expand Down
2 changes: 1 addition & 1 deletion aider/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class ExInfo:
"The API provider is not able to authenticate you. Check your API key.",
),
ExInfo("AzureOpenAIError", True, None),
ExInfo("BadGatewayError", False, None),
ExInfo("BadGatewayError", True, None),
ExInfo("BadRequestError", False, None),
ExInfo("BudgetExceededError", True, None),
ExInfo(
Expand Down
2 changes: 1 addition & 1 deletion aider/versioncheck.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ async def install_upgrade(io, latest_version=None):
)

if success:
io.tool_output("Re-run aider to use new version.")
io.tool_output("Re-run aider-ce to use new version.")
sys.exit()

return
Expand Down
25 changes: 22 additions & 3 deletions aider/website/docs/config/agent-mode.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,8 @@ Agent Mode can be configured using the `--agent-config` command line argument, w
- **`skip_cli_confirmations`**: YOLO mode, be brave and let the LLM cook, can also use the option `yolo` (default: False)
- **`tools_includelist`**: Array of tool names to allow (only these tools will be available)
- **`tools_excludelist`**: Array of tool names to exclude (these tools will be disabled)
- **`include_context_blocks`**: Array of context block names to include (overrides default set)
- **`exclude_context_blocks`**: Array of context block names to exclude from default set

#### Essential Tools

Expand All @@ -164,6 +166,18 @@ Certain tools are always available regardless of includelist/excludelist setting
- `view` - View files
- `finished` - Complete the task

#### Context Blocks

The following context blocks are available by default and can be customized using `include_context_blocks` and `exclude_context_blocks`:

- **`context_summary`**: Shows current context usage and token limits
- **`directory_structure`**: Displays the project's file structure
- **`git_status`**: Shows current git branch, status, and recent commits
- **`symbol_outline`**: Lists classes, functions, and methods in current context
- **`todo_list`**: Shows the current todo list managed via `UpdateTodoList` tool

When `include_context_blocks` is specified, only the listed blocks will be included. When `exclude_context_blocks` is specified, the listed blocks will be removed from the default set.

#### Other Aider-CE CLI/Config Options for Agent Mode

- `preserve-todo-list` - Preserve todo list across sessions
Expand All @@ -187,8 +201,14 @@ aider-ce --agent --agent-config '{"tools_excludelist": ["command", "commandinter
# Custom large file threshold
aider-ce --agent --agent-config '{"large_file_token_threshold": 10000}'

# Custom context blocks configuration
aider-ce --agent --agent-config '{"include_context_blocks": ["directory_structure", "git_status"]}'

# Exclude specific context blocks
aider-ce --agent --agent-config '{"exclude_context_blocks": ["symbol_outline", "todo_list"]}'

# Combined configuration
aider-ce --agent --agent-config '{"large_file_token_threshold": 10000, "tools_includelist": ["view", "makeeditable", "replacetext", "finished", "gitdiff"]}'
aider-ce --agent --agent-config '{"large_file_token_threshold": 10000, "tools_includelist": ["view", "makeeditable", "replacetext", "finished", "gitdiff"], "include_context_blocks": ["directory_structure", "git_status"]}'

# Command Line Options
aider-ce --agent --agent-config '{"large_file_token_threshold": 10000, "tools_includelist": ["view", "makeeditable", "replacetext", "finished", "gitdiff"]}' --preserve-todo-list --use-enhanced-map
Expand All @@ -204,5 +224,4 @@ This configuration system allows for fine-grained control over which tools are a
- **Scalable exploration**: Can handle large codebases through strategic context management
- **Recovery mechanisms**: Built-in undo and safety features

Agent Mode represents a significant evolution in aider's capabilities, enabling more sophisticated and autonomous codebase manipulation while maintaining safety and control through the tool-based architecture.

Agent Mode represents a significant evolution in aider's capabilities, enabling more sophisticated and autonomous codebase manipulation while maintaining safety and control through the tool-based architecture.
11 changes: 11 additions & 0 deletions tests/basic/test_exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,17 @@ def test_rate_limit_error():
assert "rate limited" in ex_info.description.lower()


def test_bad_gateway_error():
"""Test specific handling of BadGatewayError"""
ex = LiteLLMExceptions()
from litellm import BadGatewayError

bad_gateway_error = BadGatewayError(message="Bad Gateway", llm_provider="openai", model="gpt-4")
ex_info = ex.get_ex_info(bad_gateway_error)
assert ex_info.retry is True
assert ex_info.name == "BadGatewayError"


def test_context_window_error():
"""Test specific handling of ContextWindowExceededError"""
ex = LiteLLMExceptions()
Expand Down
Loading
Loading