Your lightweight open-source personal agent.
Python agent-frameworkai-agentai-agentschatbotchatopsdiscord-botllm-agentsllmslocal-llmmcpmodel-context-protocolmulti-agentopenai-compatibleopenclawpersonal-ai-assistantpythonself-hostedtelegram-bot-ai-assistantwebuiworkflow-automation
fix(memory): also fsync directory for rename durability
yorkhellen53ca2836e7bf
diff --git a/nanobot/agent/memory.py b/nanobot/agent/memory.pyindex 3b34f68d7..4cf687d4a 100644--- a/nanobot/agent/memory.py+++ b/nanobot/agent/memory.py@@ -369,6 +369,19 @@ class MemoryStore:f.flush()os.fsync(f.fileno())os.replace(tmp_path, self.history_file)++ # fsync the directory so the rename is durable.+ # On Windows, opening a directory with O_RDONLY raises+ # PermissionError — skip the dir sync there (NTFS+ # journals metadata synchronously).+ try:+ fd = os.open(str(self.history_file.parent), os.O_RDONLY)+ try:+ os.fsync(fd)+ finally:+ os.close(fd)+ except PermissionError:+ pass # Windows — directory fsync not supportedexcept BaseException:tmp_path.unlink(missing_ok=True)raise