Block a read of file lines already in the agent's context, unless a compaction dropped them or the file changed #387

Merged
lilleman merged 19 commits from item-239 into main 2026-10-28 17:31:31 +01:00
Showing only changes of commit e9e130cb77 - Show all commits
+1 -1
View File
@@ -429,13 +429,13 @@ class RepeatRead(unittest.TestCase):
self.read(2, 11)
self.assertEqual(self.found("Read", {"file_path": self.file, "limit": 10}), [])
# Claude Code's Edit refuses a file changed since the agent last read it with Read, or wrote it with Edit or Write, until it reads it again.
def test_calls_that_neither_read_nor_write_the_file_are_passed_over(self):
self.used("Grep", {"pattern": "line", "path": self.folder}, "f.txt")
self.used("Bash", {"command": "ls"}, "f.txt")
self.read(1, 10)
self.assertEqual(rules(self.found("Read", {"file_path": self.file, "offset": 1, "limit": 10})), ["repeat-read"])
# Claude Code's Edit refuses a file changed since the agent last read it with Read, or wrote it with Edit or Write, until it reads it again.
def test_a_change_in_the_millisecond_of_the_last_read_counts_as_before_it(self):
self.read(1, 10)
at = datetime.datetime(2026, 6, 1, tzinfo=datetime.UTC).timestamp()