From 44c799209556e1593f9f8a6646a41a6d78b6a835 Mon Sep 17 00:00:00 2001 From: Leo fu Date: Mon, 6 Apr 2026 12:12:34 -0400 Subject: [PATCH] fix(filesystem): correct write success message from bytes to characters len(content) counts Unicode code points, not UTF-8 bytes. For non-ASCII content such as Chinese or emoji, the reported count would be lower than the actual bytes written to disk, which is misleading to the agent. --- nanobot/agent/tools/filesystem.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nanobot/agent/tools/filesystem.py b/nanobot/agent/tools/filesystem.py index 11f05c557..27ae3ccd9 100644 --- a/nanobot/agent/tools/filesystem.py +++ b/nanobot/agent/tools/filesystem.py @@ -186,7 +186,7 @@ class WriteFileTool(_FsTool): fp = self._resolve(path) fp.parent.mkdir(parents=True, exist_ok=True) fp.write_text(content, encoding="utf-8") - return f"Successfully wrote {len(content)} bytes to {fp}" + return f"Successfully wrote {len(content)} characters to {fp}" except PermissionError as e: return f"Error: {e}" except Exception as e: