Skip to content

feat(flow-chat): add windowed history loading and stable turn navigation - #1978

Merged
wsp1911 merged 25 commits into
GCWing:mainfrom
wsp1911:dev2
Aug 2, 2026
Merged

feat(flow-chat): add windowed history loading and stable turn navigation#1978
wsp1911 merged 25 commits into
GCWing:mainfrom
wsp1911:dev2

Conversation

@wsp1911

@wsp1911 wsp1911 commented Aug 2, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Add versioned persistent Turn catalogs and bounded Turn-window reads across runtime ports, desktop, CLI Peer Host, and Web UI adapters.
  • Introduce catalog-backed history presentation with a virtualized Turn rail, on-demand hydration, adjacent-window loading, and bounded LRU caching.
  • Preserve cached history projections while switching between historical reading and the live tail.
  • Make search, usage, BTW, edit, rollback, and cross-feature Turn navigation work with partially loaded histories.
  • Stabilize Virtuoso anchoring, cached-window reactivation, rollback invalidation, remote session scope resolution, and inactive viewport restoration.

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 — passed
  • pnpm --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 passed
  • Manual regression check: start a new conversation, switch to Settings, return to the conversation — passed with no excessive trailing whitespace
  • Broader Rust workspace and full Web UI suites were not rerun while preparing this PR description

Reviewer Notes

  • Suggested review order: persistence/contracts, host and remote adapters, FlowChat store/window cache, history presentation, then viewport and Turn-rail behavior.
  • Legacy sessions and hosts retain full-history fallback paths when catalog or bounded-window capabilities are unavailable.
  • Catalog repair is incremental when physical Turn indexes remain aligned and falls back to a full rebuild when structural mismatches are detected.
  • The branch contains 22 implementation commits plus 2 merges from upstream/main.

Checklist

  • This PR is focused and does not include secrets, temporary prompts, generated scratch files, or unrelated artifacts.
  • Relevant verification is recorded above, or skipped checks are explained.
  • User-facing strings, docs, and locales are updated where applicable.

wsp1911 added 24 commits August 1, 2026 01:35
- 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
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
@wsp1911
wsp1911 merged commit 63d1522 into GCWing:main Aug 2, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant