Skip to content

Prevent back-to-back live starts from leaking stale transcript data#4493

Merged
yujonglee merged 1 commit intomainfrom
fix/back-to-back-transcript-leak
Mar 11, 2026
Merged

Prevent back-to-back live starts from leaking stale transcript data#4493
yujonglee merged 1 commit intomainfrom
fix/back-to-back-transcript-leak

Conversation

@yujonglee
Copy link
Contributor

  • 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.

Signed-off-by: Yujong Lee <yujonglee.dev@gmail.com>
@netlify
Copy link

netlify bot commented Mar 10, 2026

Deploy Preview for hyprnote-storybook canceled.

Name Link
🔨 Latest commit 781a144
🔍 Latest deploy log https://app.netlify.com/projects/hyprnote-storybook/deploys/69b01a5160c8610008746e3f

@netlify
Copy link

netlify bot commented Mar 10, 2026

Deploy Preview for hyprnote canceled.

Name Link
🔨 Latest commit 781a144
🔍 Latest deploy log https://app.netlify.com/projects/hyprnote/deploys/69b01a51e80ff900081390fb

@yujonglee yujonglee merged commit 66b5cdb into main Mar 11, 2026
14 checks passed
@yujonglee yujonglee deleted the fix/back-to-back-transcript-leak branch March 11, 2026 07:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Stale transcript fragment from previous session leaks into next session's transcript.json

1 participant