fix(sessions): stabilize durable history reconciliation - #2372
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
1f29e82a1ande666b6e62from1.0.0-exploreonto the latestmain.Type and Areas
Type: regression fix / performance fix
Areas: Rust core, event contracts, desktop/Tauri, Remote Connect, Web UI, Mobile Web, Peer Device Mode, architecture docs
Motivation / Impact
Terminal stream chunks can be missed while a window is suspended, a remote controller reconnects, or persistence races the frontend completion finalizer. A client could therefore keep a completed assistant response prefix, or a late history fence could erase the projection of a newer running Turn. Large snapshot indexes also made the repair path hold session coordination for seconds.
This change makes the persisted terminal Turn the repair authority, adds a backward-compatible settled-Turn fence, preserves newer live projections, and avoids repeatedly loading snapshot metadata.
Verification
cargo check -p bitfun-events— passedcargo check -p bitfun-desktop— passedcargo test -p bitfun-core --no-default-features --features agent-runtime --lib stale_projected_turn_saves_cannot_overwrite_runtime_recovery_state— passedcargo test -p bitfun-core --no-default-features --features agent-runtime --lib completion_replaces_a_projected_text_prefix_with_runtime_generation_content— passedcargo test -p bitfun-core --no-default-features --features agent-runtime --lib completed_persisted_turn_emits_a_durable_history_fence— passedcargo test -p bitfun-core --no-default-features --features agent-runtime --lib view_manager_is_cached_and_superseded_by_a_later_writer— passedcargo test -p bitfun-services-integrations --no-default-features --features remote-connect --lib remote_connect::tests::— 9 passedcargo test -p bitfun-services-integrations --no-default-features --features remote-connect --test remote_connect_contracts— 55 passedpnpm --dir src/web-ui run gen:types && pnpm run type-check:web— passedpnpm --dir src/web-ui run test:run src/flow_chat/services/flow-chat-manager/EventHandlerModule.test.ts src/flow_chat/store/FlowChatStore.test.ts— 172 passedpnpm --dir src/mobile-web run type-check && pnpm run build:mobile-web— passedgit diff --check upstream/main...HEAD— passedRemote scenario coverage:
No manual browser/device run was performed.
Reviewer Notes
settled_turn_idis optional and omitted when absent, so older event payloads continue to deserialize.message_snapshotis optional; the additive delta remains populated for older Mobile Web clients.Checklist