fix: text_editor clear mtime after patch so next patch requires re-read
linuztx committed
Feb 28, 2026 at 11:05 UTC
9f6a44a40fec810b28c1a5ecf8355c4082a295a9
1 file changed
+7
-1
plugins/text_editor/tools/text_editor.py
+7
-1
@@ -151,7 +151,7 @@ class TextEditor(Tool):
151
data={"path": expanded, "total_lines": total_lines},
152
)
153
154
- _record_mtime(self.agent, expanded)
154
+ _clear_mtime(self.agent, expanded)
155
156
patch_content = _read_patch_region(
157
expanded, ext_data["edits"], total_lines, _get_config(self.agent)
@@ -217,6 +217,12 @@ def _record_mtime(agent, path: str):
217
pass
218
219
220
+def _clear_mtime(agent, path: str):
221
+ mtimes = agent.data.get(_MTIME_KEY)
222
+ if mtimes is not None:
223
+ mtimes.pop(os.path.realpath(path), None)
224
+
225
+
226
def _check_mtime(agent, path: str) -> str:
227
mtimes = agent.data.get(_MTIME_KEY, {})
228
real = os.path.realpath(path)