Prevent back-to-back live starts from leaking stale transcript data#4493
Merged
Prevent back-to-back live starts from leaking stale transcript data#4493
Conversation
Contributor
yujonglee
commented
Mar 10, 2026
- Root cause:
- The desktop listener flow installed the new transcript persist callback too early during a back-to-back start.
- Session B’s transcript row and persist handler could be provisioned before session A had fully finished finalizing.
- If A still had buffered transcript data, A’s final flush/reset could write into B’s transcript target.
- The listener plugin also swallowed start_session rejection, so the frontend could proceed as though the new session had started.
- What changed:
- Reject any new live start while another live session is still active or finalizing.
- Keep the frontend start path aligned with Rust by returning a real error when start_session is rejected.
- Remove the provisional transcript row when that start attempt fails.
- Replace raw rejection-string matching with a typed StartSessionError.
- Why this fixes it:
- The transcript persist callback is no longer handed off to a new session while the previous session is still finalizing.
- A stale finalize/reset from session A cannot land in session B’s persisted transcript row.
- Rejected starts no longer leave behind transcript artifacts that could be mistaken for valid session output.
- Validation:
- Added a listener store test covering rejected start while another session is finalizing.
- Ran desktop tests and typecheck.
- Ran Rust cargo check for listener-core and tauri-plugin-listener.
- Follow-ups:
- Add a user-facing message when a start is rejected because the previous session is still finalizing.
- Consider queuing a back-to-back start automatically after finalization if we want smoother handoff UX.
- If we want stronger long-term isolation, consider session-owned transcript runtime state in the desktop store.
✅ Deploy Preview for hyprnote-storybook canceled.
|
✅ Deploy Preview for hyprnote canceled.
|
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.