The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
docs: make the mutate-then-persist marker contract explicit (#92231 review)
Kshitij Kapoor183e53656ee7
diff --git a/run_agent.py b/run_agent.pyindex 6704ad7cbdd..5da066ab183 100644--- a/run_agent.py+++ b/run_agent.py@@ -276,6 +276,15 @@ _MAX_TOOL_WORKERS = 8# (agent/transports/chat_completions.py, agent/chat_completion_helpers.py) strip# every top-level ``_``-prefixed key before the request leaves the process, so# this never reaches a strict OpenAI-compatible gateway.+#+# CONTRACT (#92231): the marker asserts "this dict's CONTENT is durable as+# written". Loaded rows are stamped at materialization time+# (hermes_state._rows_to_conversation), so any code that mutates a loaded or+# flushed dict's content in place and needs the change persisted MUST pop the+# marker (and invalidate _db_flush_scan_prefix if the dict may sit inside the+# bounded-scan prefix) — see agent/turn_finalizer.py (fill-empty-tail) and+# agent/context_compressor.py (micro-compaction defrag) for the two canonical+# pop sites. Mutating without popping leaves the DB silently stale._DB_PERSISTED_MARKER = "_db_persisted"