feat(flow-chat): add windowed history loading and stable turn navigation - #1978
Merged
Conversation
- persist versioned turn catalog sidecars with bounded previews and safe recovery - expose catalog metadata and timing through desktop and peer session restore responses - render all turn markers with non-navigable placeholders and full-history fallback navigation - cover catalog persistence, compatibility, and FlowChat rail behavior
- Add bounded revision-aware Turn window reads with staged-revert visibility - Route window requests through Desktop, remote workspaces, CLI Peer Host, and Web transports - Cache contiguous Turn ranges with request deduplication and navigation generations - Handle stale catalogs, superseded navigation, and legacy Host fallback safely - Add backend contract, persistence, transport, and frontend behavior coverage
- Materialize catalog targets into contiguous history windows and reuse the shared turn-pin transaction. - Prefetch adjacent windows with boundary sentinels, stable Virtuoso indexes, and element-anchor preservation. - Keep historical reading isolated from streaming tail follow and restore the live tail on explicit latest navigation. - Make unloaded turn markers navigable by ordinal and cover the windowing flow with focused tests.
- Render turn markers in a fixed-height ordinal window with overscan. - Keep active turns visible and preserve keyboard focus across virtual windows. - Retain tooltip, visible-turn highlighting, and hidden-scrollbar behavior with regression coverage.
- Skip automatic full restores for catalog-backed sessions and centralize explicit hydration. - Load adjacent tail history through bounded Turn windows while preserving legacy Host fallback. - Hydrate search, edit, and rollback consumers on demand and document scroll and Peer invariants.
- Enforce soft and hard budgets for non-tail loaded Turn ranges. - Preserve live tail, active presentation, pending targets, and in-flight windows during eviction. - Track per-ordinal recency and safely slice merged ranges when reclaiming cache. - Add regression coverage for LRU ordering, protected windows, and tail retention.
- Update aligned incomplete catalogs without reading the full Turn history. - Preserve untouched placeholders while repairing saved or newly appended Turn entries. - Fall back to a complete catalog rebuild when physical Turn indices are misaligned. - Add regression coverage for incremental repair, tail append, and rebuild fallback.
- Exit the history-window presentation before handling a new-message Turn pin. - Materialize the submitted Turn in the canonical tail before applying sticky pinning. - Preserve history-window reading during passive live-tail and streaming updates. - Add regression coverage for presentation restoration and pin ordering.
- Resolve focus targets using stable Turn IDs and absolute session ordinals - Route usage, BTW, and subagent parent navigation through catalog-backed history windows - Prevent absolute Turn indexes from being reused as partial-list indexes - Add regression coverage for partial tails and history-window materialization
- Carry absolute Turn ordinals and status through the virtual message projection - Allow editing and rollback for Turns outside the canonical tail - Resolve mutation indexes after full-history hydration using stable Turn IDs - Invalidate cached projections when catalog or partial-history metadata changes - Add regression coverage for sparse history windows and catalog repairs
- Base catalog revisions on the structural Turn storage sequence - Persist metadata repaired during initial tail and bounded-window loading - Avoid synthetic stale retries when only Turn IDs or previews are enriched - Preserve staged-revert suffixes and skip unsafe padded-index persistence - Add regression coverage for legacy sessions and missing Turn files
- Track element-anchor ownership with transaction-specific leases - Release anchors when adjacent history requests fail or are not handled - Prevent stale request completions from releasing newer viewport transactions - Add regression coverage for failed requests and overlapping anchor leases - Document the adjacent-window anchor cleanup contract
- Defer history presentation commits until user scroll input becomes quiet - Cancel stale commits across session and presentation ownership changes - Preserve and refresh prepend anchors while Virtuoso updates the rendered window - Remove the hidden paging sentinel gap from history-window presentations - Add regression coverage and document the updated viewport ownership contract
- separate cached history residency from viewport and follow-output state - reactivate LRU-cached history windows without redundant backend loads - normalize turn-rail navigation and preserve explicit jump-to-latest behavior - route initial history navigation and pagination through Virtuoso - replace the legacy static scroller with a non-interactive snapshot handoff - update scroll-stability documentation and regression coverage
- derive restored-tail boundaries from the canonical tail instead of merged cache ranges - reactivate contiguous LRU-cached Turn windows without redundant backend loads - reset paging transactions and distinguish exhausted, cancelled, and unavailable boundaries - prevent initial projection handoffs from covering history-window presentations - add regression coverage and update the scroll-stability contract
- Keep complete small-session history projections mounted when jumping to latest - Separate viewport intent from presentation mode so streaming follow resumes without rebuilding the list - Merge canonical tail updates and new turns into cached projections with gap and budget safeguards - Add regression coverage and document the fallback behavior for incomplete or large projections
- truncate turn catalogs, loaded ranges, and access metadata with rolled-back turns - clear stale history navigation and projection state after session truncation - prevent invalid history presentations from restoring removed turns - add regression coverage for rollback followed by history navigation and new turns
- preserve workspaceHostname independently during FlowChat session hydration - filter local host sentinels from frontend session API requests - harden desktop scope resolution while retaining legacy remote sessions - add regression coverage for local and loopback SSH identities
- Keep transient turn pins pending until geometry is stable. - Expand temporary Virtuoso materialization range during navigation. - Preserve logical pin ownership while target elements are rematerialized. - Gate initial positioning to the first Virtuoso mount. - Add regression coverage and document the scroll-stability contract.
- Reserve a stable scrollbar gutter on the projection handoff overlay. - Add a regression test for overlay and Virtuoso width alignment. - Verify focused FlowChat styles and Web UI type checking.
- add explicit exact and best-effort turn pin alignment policies - avoid synthetic footer space when turn navigation reaches the natural scroll limit - keep sticky-latest alignment exact for streaming output - update navigation tests and scroll stability documentation
- propagate scene activity into the virtual message list - rebase scroll geometry and reservations when the viewport becomes visible - defer pinning and stream-end reconciliation while the scene is inactive - add regression coverage for hidden viewport transitions
wsp1911
marked this pull request as ready for review
August 2, 2026 13:35
- include the viewport coordinator dependency where it is used - remove the unused dependency from collapse reservation handling
This was referenced Aug 5, 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.
Summary
Type and Areas
Type:
Feature / performance / regression fix
Areas:
Rust core, runtime contracts, services, desktop/Tauri, CLI Peer Host, Web UI, remote workspace support
Motivation / Impact
Large sessions previously required broad history hydration and relied on indexes tied to the currently loaded message list. This increased startup and rendering cost, and made navigation fragile when only part of a session was available.
This PR adds a persistent Turn catalog and bounded history-window pipeline. Users can navigate large histories without loading every Turn, while the live tail, search, editing, rollback, remote sessions, and streaming output retain stable behavior.
It also prevents hidden FlowChat viewports from interpreting zero-sized layout measurements as large content shrink events, eliminating excessive blank space after switching away from and back to an active conversation.
Verification
pnpm run type-check:web— passedpnpm --dir src/web-ui run test:run src/flow_chat/components/modern/VirtualMessageList.session-boundary.test.tsx src/flow_chat/components/modern/ModernFlowChatContainer.history-state.test.tsx— 106 tests passedReviewer Notes
upstream/main.Checklist