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:
Patrick Buckley
2026-05-06 22:50:21 -07:00
parent 46f3571c93
commit a99ce49311
+3 -8
View File
@@ -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 []