tenseleyflow/loader / 79dc7fb

Browse files

Resolve tilde in touched file paths so verification test -f uses correct absolute path

Authored by espadonne
SHA
79dc7fb618bc478f903f4ef0b3b69ebdf4bf236a
Parents
395c2ec
Tree
0fd2b23

1 changed file

StatusFile+-
M src/loader/runtime/dod.py 11 3
src/loader/runtime/dod.pymodified
@@ -166,20 +166,20 @@ def record_successful_tool_call(
166166
         _append_unique(dod.mutating_actions, tool_call.name)
167167
 
168168
     if tool_call.name == "write":
169
-        file_path = str(tool_call.arguments.get("file_path", "")).strip()
169
+        file_path = _resolve_touched_path(tool_call.arguments.get("file_path", ""))
170170
         content = str(tool_call.arguments.get("content", ""))
171171
         if file_path:
172172
             _append_unique(dod.touched_files, file_path)
173173
         dod.line_changes += _count_lines(content)
174174
     elif tool_call.name == "edit":
175
-        file_path = str(tool_call.arguments.get("file_path", "")).strip()
175
+        file_path = _resolve_touched_path(tool_call.arguments.get("file_path", ""))
176176
         old_string = str(tool_call.arguments.get("old_string", ""))
177177
         new_string = str(tool_call.arguments.get("new_string", ""))
178178
         if file_path:
179179
             _append_unique(dod.touched_files, file_path)
180180
         dod.line_changes += max(_count_lines(old_string), _count_lines(new_string))
181181
     elif tool_call.name == "patch":
182
-        file_path = str(tool_call.arguments.get("file_path", "")).strip()
182
+        file_path = _resolve_touched_path(tool_call.arguments.get("file_path", ""))
183183
         if file_path:
184184
             _append_unique(dod.touched_files, file_path)
185185
         for hunk in tool_call.arguments.get("hunks", []):
@@ -372,6 +372,14 @@ def slugify(task_statement: str) -> str:
372372
     return text[:64] or "task"
373373
 
374374
 
375
+def _resolve_touched_path(raw: object) -> str:
376
+    """Expand ~ and resolve a file path from tool arguments for DoD tracking."""
377
+    text = str(raw).strip()
378
+    if not text:
379
+        return ""
380
+    return str(Path(text).expanduser().resolve())
381
+
382
+
375383
 def _append_unique(items: list[str], value: str) -> None:
376384
     if value not in items:
377385
         items.append(value)