From 69f7c655b4a823740dbff9a9cba3e0cc5ad9d87f Mon Sep 17 00:00:00 2001 From: Teknium <127238744+teknium1@users.noreply.github.com> Date: Sun, 16 Aug 2026 00:49:01 -0700 Subject: [PATCH] docs(tui): document defer_history vs omit_messages precedence MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Follow-up to the #62799 salvage: Desktop sends both defer_history and omit_messages on a cold resume. Make explicit in the deferred branch that defer_history supersedes omit_messages — the single history read happens in the background hydration worker and the synchronous omit_messages read on the cold-resume default path is skipped entirely, so the transcript is never loaded twice for one resume. --- tui_gateway/methods_session.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tui_gateway/methods_session.py b/tui_gateway/methods_session.py index 7e357ab030..cea2e210a7 100644 --- a/tui_gateway/methods_session.py +++ b/tui_gateway/methods_session.py @@ -523,6 +523,14 @@ def _(rid, params: dict) -> dict: # transcript through the paginated REST endpoint. Register the runtime now, # then load model history and initialize optional providers in background. # Repeated requests reuse the record through the live fast path above. + # + # Precedence vs omit_messages: defer_history SUPERSEDES omit_messages. + # Desktop sends both flags on a cold resume; when defer_history is set the + # response never carries a transcript (messages is always []) and the ONE + # history read happens in the background hydration worker — the synchronous + # omit_messages read below (cold resume default) is skipped entirely, so + # the transcript is never loaded twice for one resume. omit_messages only + # governs the response shape of the non-deferred paths. if defer_history and not is_truthy_value(params.get("eager_build", False)): sid = uuid.uuid4().hex[:8] source = _resolve_session_source(str(params.get("source") or "").strip() or None)