You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ReadFile returns empty response and caches range on files with a trailing blank line #746
ReadFile with range_start: "@000" and range_end: "000@" silently returns no content (and no error) on files ending with a trailing blank line (\n\n), and then blocks all subsequent ReadFile calls on that file with "Earlier contents still valid for 1 operation(s)".
Root Cause
In cecli/tools/read_file.py:
lines = content.splitlines() includes the trailing empty line, so 000@ resolves to e_idx = len(lines) - 1.
hashline_formatted(content, file_name=abs_path) produces hashed_lines with one fewer line (len(hashed_lines) == len(lines) - 1) when the file ends with a trailing blank line.
ConversationService.get_files(coder).update_file_context(abs_path, start_line, end_line, auto_remove=False) runs before the bounds check.
The bounds check e_idx < len(hashed_lines) evaluates to False, so model_response is skipped and nothing is added to new_context_details.
Because the range was already recorded in ConversationService.get_files, every follow-up ReadFile call (even with explicit @L ranges) reports "Earlier contents still valid for 1 operation(s)" even though the model never received the file contents.
Reproduction
Call ReadFile with @000..000@ on any file ending with \n\n (e.g., "line1\nline2\nline3\n\n").
Activity