The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(file-ops): surrogatepass in bytes_written encode (review finding)
kshitijk4poorfcae5ad49a3e
diff --git a/tools/file_operations.py b/tools/file_operations.pyindex 688bdcf8e53..bd4a5f95de9 100644--- a/tools/file_operations.py+++ b/tools/file_operations.py@@ -1593,8 +1593,11 @@ class ShellFileOperations(FileOperations):# Get bytes written — compute from the content we just wrote# (len(content.encode('utf-8')) matches wc -c for UTF-8) instead- # of spawning a ``wc -c`` subprocess.- bytes_written = len(content.encode('utf-8'))+ # of spawning a ``wc -c`` subprocess. ``surrogatepass`` mirrors the+ # sha256 verification block below: content that flowed through a+ # surrogateescape decode (backend output via patch_replace) may+ # carry lone surrogates a strict encode would reject.+ bytes_written = len(content.encode('utf-8', 'surrogatepass'))# Post-write content verification (cheap, one shell call): compare# the on-disk sha256 to the intended content's hash. Production