fix(desktop): drop stale inflight-journal folds that duplicate answers - #84021
Closed
Nicolas-Formenton wants to merge 1 commit into
Closed
Conversation
The inflight-turn journal can outlive the turn it recorded (reclaim, reconnect or restart races skip the settle that clears it). On session resume the fold then re-appends journaled assistant rows to a transcript that already holds the committed replies, so the conversation ends with duplicate answers in scrambled order. The fold also carried the stale entry's streamId onto the resumed state on an idle resume, which kept the journal entry alive (persistInFlightTurnState only clears when streamId is null) and re-folded the same tail on every open. Detect text-level staleness before the append path: when every recoverable journaled assistant row already exists as committed text in the base transcript, treat the entry as caught up and clear it. Only keep a stream target when the resumed session is genuinely running (keepPending), so an idle resume self-heals instead of re-folding.
Nicolas-Formenton
force-pushed
the
fix/desktop-stale-inflight-journal-fold
branch
from
August 13, 2026 13:08
416f965 to
40c948d
Compare
Contributor
|
Thank you for this fix! It was salvaged into #86590 (cherry-picked onto current main with your authorship preserved in the commit history) and is now merged. Closing this PR since the work has landed. |
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.
What does this PR do?
A stale inflight-journal fold can re-emit answers already present in the transcript, duplicating messages. Skip folds whose journal state is stale relative to the transcript.
Related Issue
Fixes #85308
Type of Change
Changes Made
apps/desktop/src/lib/inflight-turn-journal.ts)apps/desktop/src/lib/inflight-turn-journal.test.tscontributors/emails/nformenton@Nicolass-MacBook-Air.local— attribution mappingHow to Test
Checklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/ -qand all tests passDocumentation & Housekeeping
docs/, docstrings) — or N/Acli-config.yaml.exampleif I added/changed config keys — or N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows — or N/AVerification
npm run test:ui -- src/lib/inflight-turn-journal.test.ts: 22 passed.