Skip to content

The agent that grows with you

refactor: session_search names the worker store inline

Teknium4fad121a45ef
diff --git a/tools/session_search_tool.py b/tools/session_search_tool.py
index ef5d9572e79..de6b29e902b 100644
--- a/tools/session_search_tool.py
+++ b/tools/session_search_tool.py
@@ -75,18 +75,6 @@ def _loud(fn, log_msg, error_prefix, *log_args):
return None, tool_error(f"{error_prefix}: {e}", success=False)
-def _is_worker_store(db) -> bool:
- """True for the managed-worker facade (``RuntimeSessionStore``), which has no FTS read API.
-
- A worker's agent is built with that store as its ``session_db``; recall reads the profile's
- state DB directly instead of going through the owner RPC (see ``session_search``)."""
- try:
- from agent.runtime_session_store import RuntimeSessionStore
- except ImportError: # pragma: no cover - tools-only install without the worker package
- return False
- return isinstance(db, RuntimeSessionStore)
-
-
def _format_timestamp(ts: float | str | None) -> str:
"""Unix timestamp -> readable date; ISO strings pass through; "unknown" for None."""
if ts is None:
@@ -642,8 +630,8 @@ def session_search(query: str = "", role_filter: str | None = None, limit: int =
# surface, not the FTS read API, and every read is an owner RPC. Handing it here made recall in a
# worker fail with `'RuntimeSessionStore' object has no attribute 'search_messages'` (#141705), so
# recall opens its own read-only handle — the same one the no-db path below uses.
- if _is_worker_store(db):
- logging.debug("session_search: reading a read-only handle instead of the worker's store")
+ from agent.runtime_session_store import RuntimeSessionStore
+ if isinstance(db, RuntimeSessionStore):
db = None
if db is None:
db = _quiet(