Aider-AI / aider

aider is AI pair programming in your terminal
https://aider.chat/
Apache License 2.0
22.59k stars 2.1k forks source link

Feature Request: Option to limit retries when search/replace blocks fail #2385

Open FelixLisczyk opened 1 week ago

FelixLisczyk commented 1 week ago

Currently, when Aider receives malformed search and replace blocks from the LLM, it automatically attempts to recover by requesting corrected blocks from the LLM. While this is very helpful in most cases, it can also lead to:

  1. Multiple failed iteration cycles
  2. Unnecessary API token consumption and increased costs
  3. Frustration when the error is not recoverable (e.g., when the LLM is working with outdated code)

Proposed Solution: Add configuration options to control retry behavior:

Benefits:


Aider version: 0.63.1 Python version: 3.12.7 Platform: macOS-15.1-arm64-arm-64bit Python implementation: CPython Virtual environment: Yes OS: Darwin 24.1.0 (64bit) Git version: git version 2.39.5 (Apple Git-154)

Aider v0.63.1 Main model: claude-3-5-sonnet-20241022 with diff edit format, prompt cache, infinite output Weak model: claude-3-5-haiku-20241022 Git repo: .git with 1,118 files Warning: For large repos, consider using --subtree-only and .aiderignore See: https://aider.chat/docs/faq.html#can-i-use-aider-in-a-large-mono-repo Repo-map: using 1024 tokens, files refresh

khrome83 commented 16 hours ago

I have noticed a high cost associated with this feature for not being able to modify it. I believe this has already cost me about 30-40% of my token usage today, because of the retry logic. The retry does not take into account rate limiting, and keeps hammering the service, which makes the problem worse.