From a99ce49311198155cec5208aa324355eba8955fa Mon Sep 17 00:00:00 2001 From: Patrick Buckley Date: Wed, 6 May 2026 22:50:21 -0700 Subject: [PATCH] revert(memory): drop dormant limit kwarg from load_messages MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 14af6f464e3e0aa9297b4c7c7a68ca11fbd923e8) --- turnstone/core/memory.py | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/turnstone/core/memory.py b/turnstone/core/memory.py index 99e43fc6..8c7bd6c2 100644 --- a/turnstone/core/memory.py +++ b/turnstone/core/memory.py @@ -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 []