Skip to content

The agent that grows with you

feat(file): raise read_file default limit from 500 to 2000 lines

Tekniumaf27e60603fc
diff --git a/tests/tools/test_file_operations.py b/tests/tools/test_file_operations.py
index 7be49c51c31..3c53a4e25c9 100644
--- a/tests/tools/test_file_operations.py
+++ b/tests/tools/test_file_operations.py
@@ -278,7 +278,7 @@ class TestShellFileOpsHelpers:
def test_normalize_read_pagination_clamps_invalid_values(self):
assert normalize_read_pagination(offset=0, limit=0) == (1, 1)
assert normalize_read_pagination(offset=-10, limit=-5) == (1, 1)
- assert normalize_read_pagination(offset="bad", limit="bad") == (1, 500)
+ assert normalize_read_pagination(offset="bad", limit="bad") == (1, 2000)
assert normalize_read_pagination(offset=2, limit=999999) == (2, 2000)
@@ -319,7 +319,7 @@ class TestShellFileOpsHelpers:
assert result.error is None
assert commands[0] == "wc -c < '/c/Users/alice/notes.txt' 2>/dev/null"
assert commands[1] == "head -c 1000 '/c/Users/alice/notes.txt' 2>/dev/null"
- assert commands[2] == "sed -n '1,500p' '/c/Users/alice/notes.txt'"
+ assert commands[2] == "sed -n '1,2000p' '/c/Users/alice/notes.txt'"
assert commands[3] == "wc -l < '/c/Users/alice/notes.txt'"
def test_is_likely_binary_by_extension(self, file_ops):
diff --git a/tests/tools/test_file_tools.py b/tests/tools/test_file_tools.py
index 1efe6566980..74e6ae4dfcf 100644
--- a/tests/tools/test_file_tools.py
+++ b/tests/tools/test_file_tools.py
@@ -27,7 +27,7 @@ class TestReadFileHandler:
result = json.loads(read_file_tool("/tmp/test.txt"))
assert result["content"] == "line1\nline2"
assert result["total_lines"] == 2
- mock_ops.read_file.assert_called_once_with("/tmp/test.txt", 1, 500)
+ mock_ops.read_file.assert_called_once_with("/tmp/test.txt", 1, 2000)
@patch("tools.file_tools._get_file_ops")
diff --git a/tools/code_execution_tool.py b/tools/code_execution_tool.py
index 6346ac63a57..4a9f8771a3c 100644
--- a/tools/code_execution_tool.py
+++ b/tools/code_execution_tool.py
@@ -341,7 +341,7 @@ _TOOL_STUBS = {
),
"read_file": (
"read_file",
- "path: str, offset: int = 1, limit: int = 500",
+ "path: str, offset: int = 1, limit: int = 2000",
'"""Read a file (1-indexed lines). Returns dict with "content" and "total_lines"."""',
'{"path": path, "offset": offset, "limit": limit}',
),
@@ -1900,7 +1900,7 @@ _TOOL_DOC_LINES = [
" Returns {\"results\": [{\"url\", \"title\", \"content\", \"error\"}, ...]} where content is markdown.\n"
" No LLM summarization. Pages over char_limit (default 15000) are head+tail truncated; full text stored on disk (path in the content footer)."),
("read_file",
- " read_file(path: str, offset: int = 1, limit: int = 500) -> dict\n"
+ " read_file(path: str, offset: int = 1, limit: int = 2000) -> dict\n"
" Lines are 1-indexed. Returns {\"content\": \"...\", \"total_lines\": N}"),
("write_file",
" write_file(path: str, content: str) -> dict\n"
diff --git a/tools/file_operations.py b/tools/file_operations.py
index 59224325d88..0796ec913f6 100644
--- a/tools/file_operations.py
+++ b/tools/file_operations.py
@@ -435,7 +435,7 @@ class FileOperations(ABC):
"""Abstract interface for file operations across terminal backends."""
@abstractmethod
- def read_file(self, path: str, offset: int = 1, limit: int = 500) -> ReadResult:
+ def read_file(self, path: str, offset: int = 1, limit: int = 2000) -> ReadResult:
"""Read a file with pagination support."""
...
@@ -711,7 +711,7 @@ MAX_LINES = 2000
MAX_LINE_LENGTH = 2000
MAX_FILE_SIZE = 50 * 1024 # 50KB
DEFAULT_READ_OFFSET = 1
-DEFAULT_READ_LIMIT = 500
+DEFAULT_READ_LIMIT = 2000
DEFAULT_SEARCH_OFFSET = 0
DEFAULT_SEARCH_LIMIT = 50
@@ -1116,7 +1116,7 @@ class ShellFileOperations(FileOperations):
# READ Implementation
# =========================================================================
- def read_file(self, path: str, offset: int = 1, limit: int = 500) -> ReadResult:
+ def read_file(self, path: str, offset: int = 1, limit: int = 2000) -> ReadResult:
"""
Read a file with pagination, binary detection, and line numbers.
diff --git a/tools/file_tools.py b/tools/file_tools.py
index ad3050efd5a..22d523033cf 100644
--- a/tools/file_tools.py
+++ b/tools/file_tools.py
@@ -1261,7 +1261,7 @@ def clear_file_ops_cache(task_id: str = None):
_file_ops_cache.clear()
-def read_file_tool(path: str, offset: int = 1, limit: int = 500, task_id: str = "default") -> str:
+def read_file_tool(path: str, offset: int = 1, limit: int = 2000, task_id: str = "default") -> str:
"""Read a file with pagination and line numbers."""
try:
offset, limit = normalize_read_pagination(offset, limit)
@@ -2164,7 +2164,7 @@ READ_FILE_SCHEMA = {
"properties": {
"path": {"type": "string", "description": "Path to the file to read (absolute, relative, or ~/path)"},
"offset": {"type": "integer", "description": "Line number to start reading from (1-indexed, default: 1)", "default": 1, "minimum": 1},
- "limit": {"type": "integer", "description": "Maximum number of lines to read (default: 500, max: 2000)", "default": 500, "maximum": 2000}
+ "limit": {"type": "integer", "description": "Maximum number of lines to read (default: 2000, max: 2000). Reads are additionally capped at a ~100K-character budget with a next_offset continuation.", "default": 2000, "maximum": 2000}
},
"required": ["path"]
}