fix(tools): close empty-write races and preserve clears

This commit is contained in:
Nicholai
2026-10-01 20:18:33 -06:00
committed by Nicholai
parent 9056bac95b
commit 3a125dcce5
4 changed files with 150 additions and 13 deletions
+7 -1
View File
@@ -1442,7 +1442,13 @@ def function_call_to_tool_block(name: str, arguments: str) -> Optional[ToolBlock
elif tool_type == "get_workspace":
content = ""
elif tool_type == "write_file":
content = args.get("path", "") + "\n" + args.get("content", "")
body = args.get("content")
if isinstance(body, str) and body.strip():
content = args.get("path", "") + "\n" + body
else:
# Preserve missing/empty intent for WriteFileTool instead of folding
# all empty shapes into the same path-plus-newline representation.
content = json.dumps(args)
elif tool_type == "edit_file":
content = json.dumps(args)
elif tool_type == "apply_patch":