The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix: stamp timestamps in model_metadata, turn_finalizer
Tuck261ed6e8557d
diff --git a/agent/model_metadata.py b/agent/model_metadata.pyindex 9a44b2c9bc6..c3a0fc4b414 100644--- a/agent/model_metadata.py+++ b/agent/model_metadata.py@@ -24,6 +24,7 @@ if TYPE_CHECKING: # pragma: no cover — runtime import is lazy (see below)from utils import atomic_json_write, atomic_yaml_write, base_url_host_matches, base_url_hostnamefrom hermes_constants import OPENROUTER_MODELS_URL+from agent.message_metadata import PERSISTENCE_ONLY_MESSAGE_FIELDSlogger = logging.getLogger(__name__)@@ -3350,7 +3351,7 @@ def _wire_message_shadow(msg: Dict[str, Any]) -> Dict[str, Any]:)shadow: Dict[str, Any] = {}for k, v in msg.items():- if k in ("_anthropic_content_blocks", "reasoning_details"):+ if k in ("_anthropic_content_blocks", "reasoning_details") or k in PERSISTENCE_ONLY_MESSAGE_FIELDS:continueif k == "api_content":# Always popped before the request is built; only counted when itdiff --git a/agent/turn_finalizer.py b/agent/turn_finalizer.pyindex 7297c7edca8..402e1b6a5dd 100644--- a/agent/turn_finalizer.py+++ b/agent/turn_finalizer.py@@ -26,6 +26,7 @@ import osfrom agent.codex_responses_adapter import _summarize_user_message_for_logfrom agent.message_content import flatten_message_text+from agent.message_metadata import append_message, stamp_message_timestampfrom agent.message_sanitization import _sanitize_surrogates@@ -315,7 +316,10 @@ def finalize_turn(if _tail_role != "assistant":# Tail is not an assistant row — append the final response# so the durable turn closes with the answer (#43849/#44100).- messages.append({"role": "assistant", "content": final_response})+ append_message(+ messages,+ {"role": "assistant", "content": final_response},+ )elif isinstance(_tail, dict) and _tail.get("content") != final_response and _is_pure_tool_call_tail(_tail):# The tail IS an assistant row, but a *pure tool-call turn*:# tool_calls with no text of its own. The role check alone@@ -332,6 +336,10 @@ def finalize_turn(# candidate collapse — the provisional answer was persisted and# reused as the terminal response, #65919 §7)._tail["content"] = final_response+ # The normal assistant builder already stamps this row. Cover+ # legacy/exceptional pure-tool tails before they become a+ # delivered final response.+ stamp_message_timestamp(_tail)# The row may have already been flushed to SQLite by the# incremental tool-call persist (conversation_loop.py:4990),# which stamps ``_DB_PERSISTED_MARKER`` so subsequent flushes