mirror of
https://github.com/turnstonelabs/turnstone.git
synced 2026-08-12 23:12:23 -06:00
revert(memory): drop dormant limit kwarg from load_messages
Closes round-2 review finding q-7 (nit).
The kwarg was added to close round-1 perf-2 cosmetically — the
storage backend's signature already accepted ``limit``, but the
single in-tree caller (``ChatSession.resume``) doesn't pass it and
other tail-load consumers go direct to ``storage.load_messages``.
Adding signature surface to mark a perf finding closed without an
actual consumer is API-surface bloat.
When a tail-load consumer is written (e.g. a heuristic in
``session.resume`` to skip ancient wake rows), the kwarg can come
back — at that point with a real caller driving the contract.
(cherry picked from commit 14af6f464e)
This commit is contained in:
@@ -79,15 +79,10 @@ def save_messages_bulk(rows: list[dict[str, Any]]) -> None:
|
||||
log.warning("Failed to bulk-save %d messages", len(rows), exc_info=True)
|
||||
|
||||
|
||||
def load_messages(ws_id: str, *, limit: int | None = None) -> list[dict[str, Any]]:
|
||||
"""Load messages for a workstream and reconstruct OpenAI message format.
|
||||
|
||||
*limit* tail-loads the most recent N rows when set; the storage
|
||||
backend already accepts the kwarg. Used by callers that don't
|
||||
need the full transcript (e.g. browsing a long-running coord).
|
||||
"""
|
||||
def load_messages(ws_id: str) -> list[dict[str, Any]]:
|
||||
"""Load messages for a workstream and reconstruct OpenAI message format."""
|
||||
try:
|
||||
return get_storage().load_messages(ws_id, limit=limit)
|
||||
return get_storage().load_messages(ws_id)
|
||||
except Exception:
|
||||
log.warning("Failed to load messages for ws=%s", ws_id, exc_info=True)
|
||||
return []
|
||||
|
||||
Reference in New Issue
Block a user