The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
docs(state): state the route-writer prompt invariant in one line
kshitijk4poorf4bdc3dd28f4
diff --git a/hermes_state_sessions.py b/hermes_state_sessions.pyindex 12da6560341..74c861e6608 100644--- a/hermes_state_sessions.py+++ b/hermes_state_sessions.py@@ -680,14 +680,7 @@ class SessionSessionsMixin:"""Set the model after a mid-session /model switch (unconditionally) and drop any Browserruntime lock (lineage markers survive).- The stored system prompt is deliberately PRESERVED: it is the session's provider cache- prefix, and a rebuilt prompt never matches those bytes — clearing the row re-bills the whole- prefix on a commit that may not even have moved the route (the picker re-committing the- session's current model), and the next turn then reads a NULL row and takes the broken-row- branch in ``agent.conversation_loop`` (a WARNING blaming the previous turn's- ``update_system_prompt`` write path). The stale ``Model:``/``Provider:`` footer this used to- null the row for is caught by ``_stored_prompt_matches_runtime`` on the next turn: a real- switch rebuilds there (INFO, then re-persists), a same-route commit reuses the bytes.+ Route writers never touch the stored prompt; ``_stored_prompt_matches_runtime`` decides staleness.When *provider* is given the whole route is written, in both shapes resume reads (top-levelkeys for the TUI/Desktop, ``gateway_runtime`` for the CLI), so a later resume recombines the@@ -761,9 +754,7 @@ class SessionSessionsMixin:confirmed: bool = False,) -> None:"""Persist a Browser / API-client runtime lock into model_config (lineage markers survive).- The stored system prompt stays: a lock that moves the model is caught by the next turn's- ``_stored_prompt_matches_runtime`` identity check, and one that does not must keep the- session's cache prefix byte-identical."""+ Route writers never touch the stored prompt; ``_stored_prompt_matches_runtime`` decides staleness."""lock = {"provider": provider or "", "model": model or "", "model_options": model_options or {},"route_source": route_source or "", "confirmed": bool(confirmed), "updated_at": time.time(),diff --git a/hermes_state_usage.py b/hermes_state_usage.pyindex 41de7e46167..0b2e2fe991b 100644--- a/hermes_state_usage.py+++ b/hermes_state_usage.py@@ -88,9 +88,7 @@ class SessionUsageMixin:"""Unconditionally set the billing route (``update_token_counts`` only COALESCE-fillsNULLs) so the dashboard reflects the latest /model switch.- The stored system prompt is left alone — it is the session's cache prefix and the route- change is caught by the next turn's ``_stored_prompt_matches_runtime`` identity check, which- rebuilds only when the footer it embeds is actually stale.+ Route writers never touch the stored prompt; ``_stored_prompt_matches_runtime`` decides staleness.See #48173, #48248."""