fix(desktop): reset voice state on session switch#61448
Open
konsisumer wants to merge 1 commit into
Open
Conversation
5 tasks
tonydwb
reviewed
Jul 9, 2026
tonydwb
left a comment
There was a problem hiding this comment.
Code Review Summary
Verdict: LGTM
What the PR Does
Reset voice state on session switch to prevent stale voice state leaking between sessions.
Assessment
- Small, well-scoped fix.
Reviewed by Hermes Agent
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?
Resets Desktop composer voice state at the same session boundary that scopes the foreground transcript, so session switches cannot carry listening/read-aloud status into the newly selected chat.
Shared root cause
useSessionStateCache, but composer voice state still lived in component/module state and survived warm switches or cold unmount/remount paths.useComposerVoice: warm switches disable the active voice conversation and call the conversation teardown, while cold unmounts stop the module-level voice playback singleton.useComposerVoicestructure.How this fixes each issue
Preparing audioorSpeakingfrom remaining visible after switching to a different selected session; transcript isolation remains covered by the existing active-session cache guard.Supersedes
Supersedes #46279
Related Issue
Type of Change
Changes Made
useEndVoiceOnSessionSwitchanduseStopVoicePlaybackOnUnmountfor Desktop composer voice session-boundary cleanup.useComposerVoiceso warm switches call the current conversation teardown and cold unmounts stop global playback.How to Test
Preparing audio, orSpeaking.Local checks:
npx prettier --write apps/desktop/src/app/chat/composer/hooks/use-composer-voice.ts apps/desktop/src/app/chat/composer/hooks/use-voice-session-reset.ts apps/desktop/src/app/chat/composer/hooks/use-voice-session-reset.test.tspassed.git diff --checkpassed.python scripts/check-windows-footguns.py apps/desktop/src/app/chat/composer/hooks/use-composer-voice.ts apps/desktop/src/app/chat/composer/hooks/use-voice-session-reset.ts apps/desktop/src/app/chat/composer/hooks/use-voice-session-reset.test.tspassed with no Python files scanned./opt/homebrew/bin/timeout -k 30 480 sh -c 'pytest tests/ -q -x --timeout=60 "$@"' shwas run and aborted during collection because this sandbox lacksfastapi/uvicorn; the lazy installer is blocked by Homebrew's externally managed Python.npm --workspace apps/desktop run test:ui -- --run apps/desktop/src/app/chat/composer/hooks/use-voice-session-reset.test.tscould not start becausevitestis missing. A boundednpm ci --ignore-scripts --workspace apps/desktop --include-workspace-root=falseattempt failed ongetaddrinfo ENOTFOUND registry.npmjs.org, and changed-file ESLint failed for the same network-restricted dependency resolution reason.What platforms tested on
Checklist
Code
pytest tests/ -qand all tests pass (attempted; blocked by missing local Python dashboard deps)Documentation & Housekeeping
cli-config.yaml.exampleN/ACONTRIBUTING.md/AGENTS.mdN/AScreenshots / Logs
N/A
This coordinated PR bundles a fix that spans several issues. Happy to split it back into focused per-issue PRs if you'd prefer to review them separately.
Refs #45738
Refs #46194