Skip to content

The agent that grows with you

fix(agent): a managed worker's session store offers main's two model_config calls

Tekniumefd57c8c1021
diff --git a/agent/runtime_session_store.py b/agent/runtime_session_store.py
index 396462acf53..ec6c77f8cbd 100644
--- a/agent/runtime_session_store.py
+++ b/agent/runtime_session_store.py
@@ -346,6 +346,18 @@ class RuntimeSessionStore(RuntimeSessionCompressionMixin, RuntimeSessionLifecycl
from hermes_state_sessions import _parse_model_config
return _parse_model_config(self.get_session(session_id).get('model_config')).get(key, default)
+ def update_conversation_model_config_value(self, session_id, key, update):
+ # A worker owns exactly its session row, so the read-modify-write is that row's; the owner applies
+ # the patch in its own transaction (``None`` removes the key, as on SessionDB).
+ self._session(session_id)
+ self.patch_session_model_config(session_id, {key: update(self.get_session_model_config_value(session_id, key))})
+ return session_id
+
+ def session_ids_with_model_config_key(self, key):
+ # The scan a worker can answer: its own session (it may read no other row).
+ sid = self.scope['session_id']
+ return [sid] if self.get_session_model_config_value(sid, key) is not None else []
+
def update_system_prompt(self, session_id, system_prompt):
self._session(session_id)
self._apply('session.prompt', {'system_prompt': system_prompt})