@@ -166,20 +166,20 @@ def record_successful_tool_call( |
| 166 | 166 | _append_unique(dod.mutating_actions, tool_call.name) |
| 167 | 167 | |
| 168 | 168 | 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", "")) |
| 170 | 170 | content = str(tool_call.arguments.get("content", "")) |
| 171 | 171 | if file_path: |
| 172 | 172 | _append_unique(dod.touched_files, file_path) |
| 173 | 173 | dod.line_changes += _count_lines(content) |
| 174 | 174 | 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", "")) |
| 176 | 176 | old_string = str(tool_call.arguments.get("old_string", "")) |
| 177 | 177 | new_string = str(tool_call.arguments.get("new_string", "")) |
| 178 | 178 | if file_path: |
| 179 | 179 | _append_unique(dod.touched_files, file_path) |
| 180 | 180 | dod.line_changes += max(_count_lines(old_string), _count_lines(new_string)) |
| 181 | 181 | 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", "")) |
| 183 | 183 | if file_path: |
| 184 | 184 | _append_unique(dod.touched_files, file_path) |
| 185 | 185 | for hunk in tool_call.arguments.get("hunks", []): |
@@ -372,6 +372,14 @@ def slugify(task_statement: str) -> str: |
| 372 | 372 | return text[:64] or "task" |
| 373 | 373 | |
| 374 | 374 | |
| 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 | + |
| 375 | 383 | def _append_unique(items: list[str], value: str) -> None: |
| 376 | 384 | if value not in items: |
| 377 | 385 | items.append(value) |