Repository navigation
fix(chat): unblock history presentation after rollback and empty projection - #3773
Merged
Merged
Conversation
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
Fix FlowChat remaining behind the history loading overlay after a Turn rollback or when a completed internal Turn deliberately has no visible rows. Retire expired reader bookmarks, clear restore status when presentation ownership changes, and retain history search/navigation for empty projections. Preserve viewport readiness and explicit retry for actual read failures.
Type and Areas
Type: bug fix
Areas: Web UI / FlowChat history presentation, localized empty-window copy, focused tests and existing viewport documentation.
Motivation / Impact
A rollback can shorten an eight-Turn session while its saved reading range still ends at Turn eight. Hydration starts restoring that expired range in a layout effect; range invalidation then advances the owner generation in a passive effect. The old reply is discarded correctly, but its loading state previously had no remaining owner to clear it. A new history navigation taking over a cold restore had the same failure.
The surviving tail or empty session now becomes presentable, expired bookmarks/snapshots do not return on another refresh, and late successes/failures cannot overwrite the new presentation. Valid reader restoration and the settled-viewport reveal gate remain active.
GenUI internal Turns can also intentionally omit their input and produce no model output. The modern store publishes the Session and rows atomically, so treating ready-with-zero-rows as unfinished hydration caused a second permanent loading state. The container now follows explicit load state, keeps the header/Turn Rail/list controller available for earlier-history navigation, and shows localized empty-window copy. A truly empty session still shows the welcome view.
This changes frontend presentation only; it requires no persisted-data or remote-protocol migration.
Verification
pnpm run check:web— passed.pnpm run i18n:audit— passed, zero warnings.pnpm --dir src/web-ui exec tsc --noEmit— passed.--no-ignorefor fixtures) — passed.pnpm --dir src/web-ui run test:run src/flow_chat/components/modern/ModernFlowChatContainer.history-restore.test.tsx src/flow_chat/components/modern/ModernFlowChatContainer.history-state.test.tsx src/flow_chat/components/modern/HistorySessionLoadingBoundary.test.tsx src/flow_chat/components/modern/VirtualMessageList.timeline-prepend.test.tsx— 73 passed, including 16 container restoration cases and real virtual-list navigation from an empty projection.pnpm --dir src/web-ui run test:run src/flow_chat/store/FlowChatStore.test.ts -t 'rollback|rolled.back|retir|reader|expired.*range|bookmark|changed.*history|reload'— 15 passed.git diff --check— passed.Reviewer Notes
AI-assisted implementation, with focused automated verification. Container tests control history IO and viewport readiness on local and simulated Peer surfaces; virtual-list tests supply DOM geometry. They do not establish native WebView layout or live remote transport behavior. Native and two-device interaction checks remain manual under the owning directory's AGENTS.md. Remote-workspace and Detached Dispatch rollback restrictions remain in their existing owners. No mobile/bot UI or host mutation behavior changes.
Checklist