From e74339453789868a1cd6bf74e8d1e4b44e79b32f Mon Sep 17 00:00:00 2001 From: "Paul Gauthier (aider)" Date: Fri, 25 Apr 2025 07:54:32 -0700 Subject: [PATCH] feat: Skip scanning files larger than 1MB for AI comments --- aider/watch.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/aider/watch.py b/aider/watch.py index a575b371f..fe0887300 100644 --- a/aider/watch.py +++ b/aider/watch.py @@ -104,6 +104,10 @@ class FileWatcher: if self.verbose: dump("ok", rel_path) + # Check file size before reading content + if path_abs.is_file() and path_abs.stat().st_size > 1 * 1024 * 1024: # 1MB limit + return False + # Check if file contains AI markers try: comments, _, _ = self.get_ai_comments(str(path_abs))