Skip to content

fix(flow-chat): restore history paging and resynchronization recovery - #3935

Merged
kev1n77 merged 2 commits into
openBitFun:mainfrom
kev1n77:fmy/perf
Nov 16, 2026
Merged

kev1n77 merged 2 commits into
openBitFun:mainfrom
kev1n77:fmy/perf

Conversation

@kev1n77

@kev1n77 kev1n77 commented Nov 16, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Restore older-history paging after catalog changes and make “重新同步记录” recover from a failed read. The retry button accepts pointer input, reserves its presentation commit before the host snapshot changes the rendered boundary, and resumes paging with the refreshed catalog.

Fixes #3928

Type and Areas

Type: Bug fix

Areas: Web UI / FlowChat history paging, reader restoration, tests and documentation

Motivation / Impact

A catalog refresh can retire the store's active range while the reader still displays it. Reacquire that range before extending it, including when an adjacent read adopts a new catalog.

Explicit synchronization could also invalidate its own pager ticket when the returned snapshot moved the rendered boundary, leaving the loading indicator active after cancellation. Reserve the commit before synchronization and settle only the loading state owned by that request, surface, session and presentation. Late cancelled reads cannot clear a newer retry.

For explicit recovery, accept a changed host catalog revision even when its previews are incomplete. An obsolete complete catalog must not override fresh host positions. Preserve complete previews for the same revision and retain the ordinary Peer snapshot merge policy.

Verification

  • pnpm --dir src/web-ui exec vitest run src/flow_chat/store/FlowChatStore.test.ts src/flow_chat/components/modern/flowChatHistoryPager.test.ts src/flow_chat/components/modern/VirtualMessageList.history-paging.test.ts src/flow_chat/components/modern/ModernFlowChatContainer.history-restore.test.tsx src/flow_chat/components/modern/VirtualMessageList.resize.test.tsx — 432 tests passed across five files.
  • pnpm run check:web — passed.
  • OPENBITFUN_WEB_FONT_PROFILE=apple-system pnpm run build:web — passed, including production asset and WebKit compatibility checks.
  • git diff --check — passed.
  • macOS native WKWebView with the production frontend and Rust host, using an isolated synthetic 80-turn session: temporarily move 75 unread turn files, trigger a history read error, restore all files, then click retry through native hit-tested pointer actions. One click restores older turns, clears the error/loading state, and subsequent scrolling loads further pages.
  • Make the isolated session storage unavailable during another retry: the existing content and retryable error remain visible. Restore storage and retry again: paging recovers. All 80 turn files remain valid and present.

Reviewer Notes

The supplied-geometry resize fixture shares measurements only within a read-only snapshot and uses direct attribute reads to avoid repeated jsdom dataset enumeration. It retains fresh measurements across gestures, DOM changes and observer callbacks, with the same assertions, scroll coverage and test timeout. The 18-case fixture took about 2.5 seconds locally after this change, versus about 5 seconds before.

Native evidence covers local macOS with deliberately injected filesystem failures; it does not establish spontaneous failure in ordinary sessions. SSH workspace and Peer Device paths have controlled component/store fixture coverage only. Live remote workspace, remote control, Peer Device and Detached Dispatch scenarios were not exercised. Detached history synchronization continues to reject controller-storage fallback.

The change is in the shared frontend; it adds no persisted schema or remote protocol fields.

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.

@kev1n77
kev1n77 merged commit 61188d6 into openBitFun:main Nov 16, 2026
9 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

1 participant