Skip to content

Allow editor/terminal dictation to take over an active Chat dictation session - #328830

Draft
meganrogge with Copilot wants to merge 2 commits into
mainfrom
copilot/fix-dictation-editor-terminal-issue
Draft

Allow editor/terminal dictation to take over an active Chat dictation session#328830
meganrogge with Copilot wants to merge 2 commits into
mainfrom
copilot/fix-dictation-editor-terminal-issue

Conversation

Copilot AI commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Description

Chat, editor, and terminal dictation share a single on-device speech engine, so only one can run at a time. While Chat dictation was active, "Start Dictation in Editor" and "Start Dictation in Terminal" silently did nothing: the editor path early-returned from startDictation (the shared _active session was owned by Chat), and the terminal path aborted when the engine was busy.

The fix lets a new surface take over: each surface already tears down its own UI when it observes the engine go Idle, so a new start just cancels the current session before attaching its own listeners.

  • dictationSession.ts (startDictation) — instead of no-op returning when a session is active, cancel the current session (Chat, another editor, or terminal) and take over; the previous surface cleans up via its own Idle listener and keeps whatever transcript it had inserted. Same-editor re-entry still returns early (toggle handled by callers).
  • editorDictation.ts (startBuiltin) — register the "self-teardown on Idle" listener after startDictation so the takeover's cancel of the previous surface can't tear down the just-started editor session.
  • terminalVoice.ts (_startBuiltin) — replace the "abort when busy" guard with a service.cancel() takeover (before subscribing), keeping a defensive bail-out if the engine somehow stays busy.
  • dictationSession.test.ts — added coverage for cross-surface takeover (first editor keeps its text, second becomes active); updated the mock cancel() to emit the real Idle transition.

Takeover is now symmetric across the reported directions (Chat → editor, Chat → terminal) as well as editor ↔ terminal, with no cross-contribution imports.

Copilot AI requested review from Copilot and removed request for Copilot August 3, 2026 20:15
Copilot AI linked an issue Aug 3, 2026 that may be closed by this pull request
Co-authored-by: meganrogge <29464607+meganrogge@users.noreply.github.com>
Copilot AI requested review from Copilot and removed request for Copilot August 3, 2026 20:30
Copilot AI changed the title [WIP] Fix issue where dictation does not start in editor or terminal Allow editor/terminal dictation to take over an active Chat dictation session Aug 3, 2026
Copilot AI requested a review from meganrogge August 3, 2026 20:31
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.

Can't start in editor or terminal once Chat dictation has started

2 participants