Skip to content

fix(readfile): clamp range indices to hashed_lines bounds for trailing blank lines - #747

Merged
dwash96 merged 1 commit into
cecli-dev:v1.13.0from
philippeback:fix/readfile-trailing-blank-line
Nov 13, 2026
Merged

dwash96 merged 1 commit into
cecli-dev:v1.13.0from
philippeback:fix/readfile-trailing-blank-line

Conversation

@philippeback

Copy link
Copy Markdown

Closes #746

Summary

ReadFile with @000..000@ silently returned no content (and no error) on files ending with a trailing blank line (\n\n), and cached the range in ConversationService.get_files anyway, causing all follow-up ReadFile calls to report "Earlier contents still valid for 1 operation(s)".

Fix

  • Clamp s_idx, e_idx, start_line_idx, and end_line_idx to len(hashed_lines) - 1 before updating ConversationService.get_files and checking e_idx < len(hashed_lines).
  • Return an error instead of silently skipping if hashed_lines is empty.
  • Add regression test test_trailing_blank_line_full_read in tests/tools/test_read_range_execute.py.

Testing

  • pytest tests/tools/test_read_range_execute.py -q (23 passed).

@dwash96
dwash96 changed the base branch from main to v1.13.0 November 13, 2026 05:09
@dwash96
dwash96 merged commit b8c8cb9 into cecli-dev:v1.13.0 Nov 13, 2026
12 checks passed
@dwash96 dwash96 mentioned this pull request Nov 13, 2026
dwash96 added a commit that referenced this pull request Nov 15, 2026
Resolve the conflict with #747 by splitting HashPos output on its actual
newline separator and dropping the index clamp, which silently truncated
trailing blank lines. Keep the empty-file guard by testing the source
content before splitting.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ReadFile returns empty response and caches range on files with a trailing blank line

2 participants