perf(desktop): make session resume incremental (salvage of #62799) - #87522
Merged
Conversation
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.
Contributor
૮ >ﻌ< ა ci reviewran on cfcaee1 — docs(tui): document defer_history vs omit_messages precedenc
|
This was referenced Aug 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Salvage of #62799 by @embwl0x — Desktop cold resume now returns its
session.resumeacknowledgement in <1ms by deferring the transcript read off the RPC path (measured 19x faster RPC-critical section on a real 1175-message production session).Infographic
What this is
Rebase/salvage of #62799 (perf(desktop): make session resume incremental) by @embwl0x onto current
main, with authorship preserved via cherry-pick. The original branch predates themethods_session.pysplit-out and several resume-path changes on main; the cherry-picks landed cleanly on top of them and the integration was re-verified against main's current resume machinery (profile-scoped DB ownership,assert_resume_safe,resolve_resume_session_id, deferred agent build, lazy watch resumes,omit_messages).Carried vs dropped
Carried (main lacks all of this):
defer_history: trueopt-in onsession.resume: gateway registers the runtime and returns the descriptor immediately (hydrating: true, emptymessages), then loads replay/display history on a background worker (_schedule_resume_hydrationintui_gateway/server.py).session.resume_progressevents (loading/complete/failed)._start_agent_buildgates on history readiness (resume_history_ready) and rechecks runtime ownership before building;_finalize_sessioncancels a waiting build on close.tests/tui_gateway/test_session_resume_db_ownership.pytest).defer_historyon cold resumes (use-session-actions), keeps REST as the transcript authority, and paints the bounded latest page as it arrives;hydrating?added toSessionResumeResponse.Dropped as redundant (already on main):
_schedule_agent_build).methods_session.pylayout is kept; the deferred branch slots in between the lazy/watch branch and the cold-resume default.Follow-up (own commit, not folded into contributor's):
docs(tui): explicit precedence comment —defer_historySUPERSEDESomit_messages; the single history read happens in the background worker, the synchronousomit_messagesread is skipped, so the transcript is never loaded twice for one resume.Validation
E2E against a real 297MB production
state.dbcopy (session20260812_162043_803c70, 1175 messages), SessionDB imported from this branch:Tests (targeted, this branch):
tests/test_tui_gateway_server.py+tests/tui_gateway/test_session_resume_db_ownership.py+tests/tui_gateway/test_protocol.py: 640 passed, 0 failedtests/test_tui_gateway_server.py tests/tui_gateway/sweep: 1049 passed, 2 skipped, 2 failed — both failures (test_cold_start_gil_stall,test_iso_certify_seam) reproduce identically on bareorigin/mainwith the same interpreter: pre-existing minimal-venv env gaps, not introduced here (verified by running the same test ids on detached origin/main).vitest run use-session-actions.test.tsx— 54 passed (includes the new bounded deferred-resume test);npm run check:lint— 0 errors (108 pre-existing warnings).Notes