Skip to content

Agent Zero AI framework

fix: text_editor clear mtime after patch so next patch requires re-read

linuztx9f6a44a40fec
diff --git a/plugins/text_editor/tools/text_editor.py b/plugins/text_editor/tools/text_editor.py
index 3050e1c1d..1fcbf661e 100644
--- a/plugins/text_editor/tools/text_editor.py
+++ b/plugins/text_editor/tools/text_editor.py
@@ -151,7 +151,7 @@ class TextEditor(Tool):
data={"path": expanded, "total_lines": total_lines},
)
- _record_mtime(self.agent, expanded)
+ _clear_mtime(self.agent, expanded)
patch_content = _read_patch_region(
expanded, ext_data["edits"], total_lines, _get_config(self.agent)
@@ -217,6 +217,12 @@ def _record_mtime(agent, path: str):
pass
+def _clear_mtime(agent, path: str):
+ mtimes = agent.data.get(_MTIME_KEY)
+ if mtimes is not None:
+ mtimes.pop(os.path.realpath(path), None)
+
+
def _check_mtime(agent, path: str) -> str:
mtimes = agent.data.get(_MTIME_KEY, {})
real = os.path.realpath(path)