Repository navigation
voice: NACK + client revalidation for dropped narration - #325966
Merged
Megan Rogge (meganrogge) merged 50 commits intoJul 17, 2026
Merged
Megan Rogge (meganrogge) merged 50 commits into
Megan Rogge (meganrogge) merged 50 commits into
Conversation
Deferral keyed off `_getActiveSessionId()`, which prioritizes the sticky
input `_targetSession` over the session the user is actually viewing. In the
floating voice window, browsing a session via `openSession` changes what is
shown but not `_targetSession`, so with target=A while viewing B:
- A's background narration played live over the unrelated shown session B
("a different session's response plays in an unrelated session"); and
- B's own reply was deferred with no focus change to ever flush it, leaving
the controller idle/listening ("listening mode when a pending reply should
have been read out on focus").
Add `_shownSessionId()` (the viewed session, ignoring `_targetSession`) and
key `_shouldDeferResponse` off it plus `_awaitingReplyForSession` (so the
awaited answer to the user's own utterance still plays live even if they
glanced away). No behavior change in the agents/sessions window: external
mode never sets `_targetSession`, so the resolved shown session is unchanged.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Address review: the 5s safety-net flush in _checkSessionStateChanges still used _getActiveSessionId() (target-priority), so a background session's reply could be flushed and played over the shown session on the next poll. Flush _shownSessionId() instead. Also trim the _shownSessionId / _shouldDeferResponse JSDoc and inline comment to the VS Code one/two-line convention and correct the "targeted or focused" wording to the new shown-session contract. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
A new response from a session whose previous response is still playing was fast-pathed straight into playback. The TTS service holds a single playback turn, and once the prior response's final chunk scheduled node.stop() at that response's boundary, the new response's audio was appended into the same buffer past the stop point and never heard. Track whether the current response has been finalized and serialize a subsequent same-session response through the audio queue so it gets a fresh turn. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The backend narrates one thing at a time and drops a session's completion narration when another is in flight, so a reply that completes while its session is in the background is never sent as audio - nothing to buffer, and returning to the session finds it silent in listening mode. Track background completions and, on focus, re-elicit narration via a forced thinking->idle transition (mirroring the confirmation two-phase). Cleared when the reply's audio actually arrives (played or deferred), on a new turn, or once re-elicited, so a reply is never read twice. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Responses now re-assert once if their re-narration is preempted by another session's narration, matching the bulletproof two-mechanism approach used for confirmations (two-phase transition + preemption recovery). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The on-focus re-narration of a backend-dropped reply was gated to non-external mode, so it never ran in the embedder-driven agents window where the bug was actually reported. Confirmations run their two-phase unconditionally in both modes; do the same for responses. The unheard marker is already populated in both modes and is cleared on audio receipt, so a genuinely heard reply is never re-narrated. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The unheard-reply marker was only set for completions of sessions NOT shown at debounced-emit time. On a fast switch, a background session's completion could arrive after the user already switched to it, so it was treated as 'narrates live', never marked, and — when the backend dropped its narration — silently lost (no pending indicator, no re-narration). Now mark every idle+summary completion as a candidate unheard reply and clear the marker the moment its audio is actually heard (tagged, or the active session's untagged live audio). A reply that narrates live is never re-read; only a dropped one survives. Add a response re-narrate watchdog (mirroring the confirmation flush watchdog) so a reply completing on the on-screen session is re-checked and re-narrated if still unheard, covering the focus/emit ordering race. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…drop Fix several voice-mode narration reliability bugs on fast session switches, address Copilot review feedback, and stop a passive backend query from killing a just-started auto-listen. - Hold a background completion as `thinking` (summary withheld) until its session is viewed, so the backend's first `->idle` sighting happens on focus and reliably narrates, instead of being deduped. Applied across all three `_buildSessionContext` branches (resident/no-model agent sessions and regular chat sessions), so both the agents window and the main window are covered. - Decide "already narrated?" by summary identity (`_narratedSummaryById`, recorded when audio is actually heard) rather than the racy recently-read timing, so an eager-reload context push that leaks a raw idle+summary can no longer drop the on-focus re-narration. - Route re-narration by the SHOWN session, not the sticky input target: add `_narrationActiveOverride` so `_buildSessionContext` marks the viewed session active during its two-phase, and gate phase-2 / preemption recovery / watchdog on `_shownSessionId()`. - Serialize same-session responses: queue entries carry a `finalized` flag; every first chunk starts a fresh entry and continuation chunks attach only to an unfinished entry, so a later response can't be merged past a scheduled node.stop() and dropped. - Share unheard-reply bookkeeping (`_recordCompletionForRenarration`) between the coalesced autorun path and `_checkSessionStateChanges`, so completions surfaced only by the direct path (remote/unloaded sessions) are recoverable. - Don't finish PTT / churn voice state for passive backend queries (`get_session_info`/`get_session_changes`/`get_session_thread`); dispatching them like an action tool was ending auto-listen the instant the backend probed the session on connect. Also clear toggle mode in `_finishPtt` so no turn-end path leaves a stale toggle that self-kills the next listen. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Replace the client-side machinery that tricked the backend into
narrating (two-phase re-narration, reconcilers, renarrate watchdogs,
background-idle holding, and summary-identity dedup) with a single
explicit requestNarration(codingSessionId, kind, text) call. The
client now decides when a reply or confirmation is spoken: live when
an item lands on the shown session, and on focus for an item that
arrived in the background. A per-session last-narrated-text guard makes
both paths idempotent, replacing the removed dedup/holding logic.
Backend contract: on receiving {type:'request_narration',
coding_session_id, kind, text} the backend speaks the given text and
echoes audio tagged with coding_session_id; it must stop auto-narrating
idle / waiting_for_confirmation transitions.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…clear, doc fixes - requestNarration returns whether it sent; _narrate records the dedup entry only on a successful send and retries the shown item on session_init, so a narration dropped while the socket was down is no longer permanently suppressed. - Clear the per-session dedup on a real thinking transition before coalescing (skipping eager-reload wobble), so a fast idle->thinking->idle burst that collapses to net-zero still lets an identical next-turn reply narrate. - Update stale comments that described backend auto-narration via session_context; context is now state-tracking only. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…d-narrate-api # Conflicts: # src/vs/workbench/contrib/chat/browser/voiceClient/voiceSessionController.ts
…soft#325799) voice: opt out of backend auto-narration (auto_narrate: false) This client drives narration itself via `requestNarration`, but the voice backend still auto-narrates session-context state transitions by default (the opt-out is per-session and defaults on for backward compatibility). Without opting out, replies would be narrated twice. Send `auto_narrate: false` on start_session and resume_session so the backend suppresses its inferred auto-narration and speaks only on explicit `request_narration`. The flag is sticky per session on the backend, so it does not need to be repeated on every session_context delta. Copilot-Session: 803dc35b-1aee-4354-85c7-df6076293a49 Co-authored-by: Arthur Cnops <arthurcnops@microsoft.com> Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
On focus, _activateShownSession both flushed a session's buffered reply AND requested a fresh narration of the same reply, relying on dedup to suppress the double. When the buffered transcript and the response summary differed, dedup missed and the reply was read twice / for the wrong session. Now the on-focus flush reports whether it replayed a reply; when it did, the redundant response narrate is skipped (and recorded as narrated so a later idle-transition narrate de-dupes too). Confirmations are distinct items and still narrate. Also attribute untagged live audio to the awaited/viewed session rather than the sticky _getActiveSessionId(), which could point at a not-currently-viewed session and poison another session's dedup. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Three focus/deferred-playback fixes: 1. setActiveSessionShown(undefined) now restores focus-based detection per its interface contract, instead of leaving _externalActiveSessionMode on while blanking _activeSessionShown. The old state wedged narration: _shownSessionId() returned undefined, so no session was ever 'shown', every tagged reply deferred forever, and both focus activation paths stayed gated off - so a confirmation was never read and the controller stayed in listening. The agents bridge passes undefined for draft/ uncreated sessions, so this was hit routinely. 2. Deferred-reply dedup used a chunk-joined transcript. Each chunk's transcript is cumulative and the final chunk is the complete text, so joining produced a repeated/garbled string that failed to match the backend re-narration and let a reply play twice. Use the final (last non-empty) transcript. 3. Terminal disconnect() now also clears _activeSessionShown and _externalActiveSessionMode so a reconnect starts from focus-based detection until the embedder re-asserts, rather than pinning a stale session and ignoring focus events. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Follow-up to the focus/deferral fixes: - Replace the single global _liveReplyKey with a per-session Set (_liveReplyKeys). A live reply for session B no longer clears the live route of an in-flight reply for session A, so A's continuation chunks keep playing live instead of falling through to focus-based routing (the 'wrong response read for the other session' class). Two concurrent responses for the SAME session still need a backend response/turn id to disambiguate - documented as a known limitation. - Log the real routing identities on audio_response (shown/focused/ external/awaiting) instead of only the stale cached focus id, so the next repro is actually diagnosable (this investigation has been bottlenecked by missing traces). - Remove the write-only _focusedSessionId cache; _getFocusedSessionId() already reads live state, so the field only risked stale/misleading reads. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Replaces the single global live-reply key with per-response routing keyed by a client-generated narration_id echoed back by the backend on each audio_response chunk. A response's live-vs-deferred fate is decided once on its first chunk and every later chunk follows it, so interleaved responses for different sessions never steal each other's routing and a response is never split between playback and the deferred buffer. - Add responseId to IVoiceAudioResponse; requestNarration now generates and returns a narration_id, sent on request_narration and read back as msg.narration_id ?? msg.turn_id. - _shouldDeferResponseStream decides once per responseId (stored in _responseRoutes); flush promotes a still-streaming response's route deferred->live so post-flush chunks play; final chunk retires the route. - Superseding a stale buffer with a genuinely different response also clears its leaked route; a same-id live chunk is treated as a promotion. - Falls back to the legacy session-keyed path when no responseId is echoed. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Fixes a confirmation on an unfocused session never being read when the user focuses it: the listening/auto-listen exit that lets echoed audio play lived only inside _flushDeferredResponse's buffered-audio path. A confirmation carries no buffered audio (its pending indicator comes from _confirmationPendingSessions, not _deferredResponses), so flush returned early without exiting listening; the requested narration then arrived while still listening and was suppressed, leaving the session focused but silent. - Extract the listening-exit + playback-slot reset into _prepareForPlayback() and call it before narrating a freshly-shown session's pending item, not only when flushing buffered audio. - Stop clearing _audioQueue in that reset: audio can be validly queued while isPlaying is false during the ~500ms post-playback re-process gap, so wiping it dropped pending responses (audio-loss race). Only reset the playback slot when idle; leave the FIFO intact. - Move _responseRoutes cleanup to the end of the audio_response handler so the route stays inspectable for the whole handler. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…nses (FIFO) Two behavior changes per product decision: 1. Defer awaited replies when the user has switched away. Previously an unfocused session the user was awaiting a reply from played live over whatever session they had switched to. Now _shouldDeferForSession plays live only for the currently-shown session; an awaited reply for a session the user left is deferred and flushed when they return. 2. Store all deferred responses per session in FIFO order instead of keeping only the latest. A background session that produces several updates before the user returns now keeps every one and plays them in arrival order on focus. _deferredResponses is now Map<session, IDeferredResponse[]> where each response groups its own chunks with a finalized flag; _deferResponse appends a new response per first chunk and attaches continuations to the open one; _flushDeferredResponse plays them all in order. A fresh live reply for a session with buffered responses now flushes those first (FIFO) rather than dropping them. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Make the deferred-response indicator/flush path robust to the two session id spaces (bare backend id vs UI resource): - _flushDeferredResponse now resolves the buffered key via a shared _matchDeferredKey helper: exact string, then alias-canonical (bare backend id -> UI resource), then structural URI equality. Previously a buffer keyed by a not-yet-aliased bare id could be stranded on focus. - _flushDeferredResponse returns IDeferredFlushResult (flushed + finalTranscripts) so _activateShownSession only marks a summary as narrated when it was actually one of the responses just played (never a newer, unplayed summary advanced in between). - _shouldDeferForSession uses the same _isSameSession identity check, so a response for the currently shown session isn't spuriously deferred when ids differ only by space/serialization. - _activateShownSession records the backend->UI alias up front so a buffer/indicator keyed by the bare id resolves to this session. - setActiveSessionShown re-pin (unchanged key) now re-flushes a stranded buffered response instead of early-returning. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…s confirmations Responses lacked the sessions-list pending indicator and only read out intermittently for unfocused sessions, while confirmations worked. Two root causes: 1. _shownSessionId() preferred the sticky _lastShownSessionId, which is updated by ANY tracked chat widget's view-model swap. While the backend worked a background session it could point there, so that session looked 'shown': its response never deferred, no indicator, and it played live. Confirmations use live _getFocusedSessionId() and were unaffected. Align _shownSessionId() to live focus in focus-based mode (opening a session still flushes its buffer via _onSessionShown, so the sticky value isn't needed here). 2. No client-state-driven response indicator existed. Confirmations get theirs from _reconcileConfirmationIndicators; responses only got one from the audio-defer path, which never fires for background sessions in client-driven mode (the client only requests narration for the shown session). Add _pendingResponseSummaries: when a reply completes on an unfocused session, show the indicator and store the summary; on focus, narrate it (falling back to the stored summary when the model isn't resident) and clear the indicator. Guard with _lastNarratedText so a reconnect/poll doesn't re-indicate an already-read reply, and skip the stored-summary read when buffered audio was just flushed (no double-read). Add _maybeHideIndicator so the shared sessions-list indicator (owned by confirmation, deferred-audio, and completed-reply sources) is hidden only when all sources are resolved. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ettle A background session's completed reply could be lost when its on-focus narration coincided with the user holding PTT / mid-utterance: the backend drops request_narration while busy with the user's turn, and the pending summary was cleared immediately so it was never retried. Now, when the shown session has a pending response but the user is capturing speech (_isCapturingUserSpeech: PTT held / suppressing incoming audio / awaiting their own reply), hold the summary + keep the sessions-list indicator instead of narrating. _enterAutoListen reads it once the turn settles (nothing playing, PTT released) before entering listening, and only clears the pending state once the narration was actually requested. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Responses diverged from the confirmation model, causing the sessions-list speaker icon to linger and completed replies to go unread: - On focus, a response could be 'held' (not narrated) when the user was mid-utterance, with clearing gated on a later successful narrate that often never happened - so the indicator hung around and nothing was read. - The response indicator was only cleared via the fragile on-focus path, never by continuous reconciliation, unlike confirmations. Now responses behave identically to confirmations: - On focus, _activateShownSession narrates the pending reply unconditionally (like a confirmation) and clears the pending indicator unconditionally. - New _reconcileResponseIndicators() runs on every poll/autorun alongside _reconcileConfirmationIndicators() and clears the indicator for the session the user is now viewing, so it never lingers past focus even if the on-focus narration path is missed (reconnect/model-load races). Removes the PTT-hold + _enterAutoListen retry + _isCapturingUserSpeech machinery that caused the divergence. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
When a second OSS voice window opens, the backend evicts the first with a
fatal close (code 4008). The service correctly did not reconnect, but the
controller still ran _onConnectionLost (it was connected), setting
isReconnecting=true and 'Reconnecting...' - which never resolved because no
reconnect was coming, leaving a zombie window.
Add a dedicated onFatalDisconnect signal (codes 4001/4008/4029) distinct
from a transient drop. The controller now tears down capture/playback and
settles to a clean, restartable state ('Voice moved to another window. Tap
to start.'), and _fatalDisconnect short-circuits the reconnect display path
on the following connection-state change. The flag clears on the next
connect(), so tapping to start reconnects normally.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Clear the audio queue before closeContext() on fatal disconnect so a synchronous onPlaybackStopped doesn't reschedule stale playback. - Announce fatal disconnect via ARIA alert + localize the messages. - Centralize _prepareForPlayback in _narrate so every narration path (live/on-focus/on-reconnect) exits listening before echoed audio. - Track solicited narration ids and bypass the legacy re-narration content heuristic for them. - Never treat a first chunk as a continuation of the current playback. - Prune _pendingResponseSummaries in _pruneSessionCaches. - Trim requestNarration JSDoc. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 58e4568c-e63b-44c0-b6b2-502f388da15b
The centralized _prepareForPlayback() in _narrate tore down the just-entered listening on session_init, because the retry path narrated whatever _currentNarratable() returned (e.g. a stale prior reply). - _narrate now prepares playback only once a request is actually sent, so a closed-socket/no-op narrate never touches listening state. - Drive the reconnect retry from real dropped requests (_pendingNarrationRetries) instead of _currentNarratable, and replay them before entering listening; a normal first connect has none and enters listening as before. - Clear the new narration caches on terminal disconnect. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 58e4568c-e63b-44c0-b6b2-502f388da15b
The solicited-narration-id bypass disabled the content-based re-narration guard (_isRenarration) for every narration the client requested. Since _narrate re-fires whenever _lastNarratedText is cleared by a thinking wobble (eager model reload) or keyed under a different session id than the focus path recorded, the same reply's audio then played on every re-trigger instead of being dropped once. - Revert the _solicitedNarrationIds bypass so _isRenarration again drops a reply whose content was just read (audibly exactly-once). - Clear the pending-response summary/indicator after narrating the shown session's reply in _handleNarratableStateChange, mirroring the focus path, so a stored summary is never resurfaced and re-read. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 58e4568c-e63b-44c0-b6b2-502f388da15b
… handled - Re-add _solicitedNarrationIds so audio this client explicitly requested via requestNarration (responseId === the narration_id we sent) is never dropped by _isRenarration as an unsolicited duplicate, even when its transcript matches a reply recently read for the session. Fixes 'not read on first focus' where an on-focus narration's echoed audio matched _recentlyReadResponse and was dropped with no possible retry. Set is bounded and cleared on disconnect. - _activateShownSession now clears the pending response indicator/summary only when the reply was actually handled (flushed from buffer, or a narration request was really sent). If the model was still loading or the request could not be sent, the durable summary is retained so a later focus/state event can retry, instead of discarding the only record of the unread reply. - _onSessionShown no longer suppresses a duplicate 'shown' event for the same session when outstanding work remains (buffered audio, pending response summary, or pending confirmation), so an activation that ran before the model/deferred buffer was ready can be retried. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 58e4568c-e63b-44c0-b6b2-502f388da15b
Contributor
There was a problem hiding this comment.
Pull request overview
Adds client-side NACK handling and revalidation to recover dropped or interrupted voice narration. The stacked #325928 changes were treated as context only.
Changes:
- Handles narration acknowledgements, interruptions, and unblock signals.
- Defers busy/interrupted narration per session and revalidates before retrying.
- Reuses narration IDs to support backend deduplication.
Show a summary per file
| File | Description |
|---|---|
voiceClientService.ts (common) |
Defines narration protocol contracts. |
voiceSessionController.ts |
Implements deferred narration and retry logic. |
voiceClientService.ts (browser) |
Parses protocol events and sends reusable IDs. |
sessionsList.ts |
Stacked pending-narration activation change. |
voiceBridge.contribution.ts |
Stacked session activation command. |
Review details
- Files reviewed: 4/5 changed files
- Comments generated: 4
- Review effort level: Medium
Megan Rogge (meganrogge)
previously approved these changes
Jul 16, 2026
…switch, and fatal disconnect Addresses Copilot review on microsoft#325966: - Clear deferred narration in the immediate thinking path (coalescing can hide the transition from _handleNarratableStateChange). - A newly sent narration supersedes any older deferred entry (latest-wins). - _retryDeferredNarration drops a session that is no longer shown, honoring the background-sessions-wait-until-focused policy. - _handleFatalDisconnect clears deferred/in-flight narration state and timers, since a later connect() does not reset them. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 02c7340-e851-429b-a94b-e5bae931ca4b
Megan Rogge (meganrogge)
enabled auto-merge (squash)
July 16, 2026 14:32
Logan Ramos (lramos15)
previously approved these changes
Jul 16, 2026
Paul (pwang347)
previously approved these changes
Jul 16, 2026
A confirmation prompt was narrated fresh on every session refocus while it stayed pending: _activateShownSession level-triggers _narrate with a new narration id each focus, so the backend re-synthesized and spoke the same prompt again. Confirmations are (correctly) excluded from the _lastNarratedText response dedup, so nothing suppressed the repeat. Track a per-occurrence marker (_narratedConfirmation, canonical session key -> last-heard detail text): set only once a confirmation's audio finalizes (_markNarrationHeard), checked before the refocus _narrate, and cleared when the session leaves waiting_for_confirmation (autorun, both resident and no-model paths). A confirmation that was deferred/dropped and never heard leaves the marker unset, so refocus still retries it; a genuinely new confirmation - even identical text - narrates again because an intervening non-waiting state clears the marker. Rekeyed with the other per-session maps and cleared on disconnect()/_handleFatalDisconnect. Also trace narration_unblocked nudges that arrive with nothing deferred, to diagnose confirmations that are never narrated.
auto-merge was automatically disabled
July 16, 2026 16:13
Head branch was pushed to by a user without write access
Arthur Cnops (accnops)
dismissed stale reviews from Paul (pwang347) and Logan Ramos (lramos15)
via
July 16, 2026 16:13
cabdb9e
Megan Rogge (meganrogge)
enabled auto-merge (squash)
July 16, 2026 18:16
Connor Peet (connor4312)
previously approved these changes
Jul 16, 2026
_activateShownSession reads the shown session's _currentNarratable and narrates it, gated only by the same-run _lastNarratedText dedupe. A resident or eager-loaded model surfaced by focus - or by a list/filter change that reveals older sessions - carries whatever reply it last held, including one that completed before this voice session started tracking it. That old reply was then read out. Narrate a response on focus only when the session owns a pending-response summary, which is set on the idle transition observed this run (_handleNarratableStateChange) and is the same token that drives the unread-reply indicator. Focus now narrates exactly the replies shown as unread. Confirmations are unaffected: they keep their occurrence-based _narratedConfirmation dedupe.
auto-merge was automatically disabled
July 16, 2026 18:37
Head branch was pushed to by a user without write access
Collaborator
|
Copilot resolve the merge conflicts in this pull request |
Member
|
how about some tests? |
Paul (pwang347)
previously approved these changes
Jul 16, 2026
# Conflicts: # src/vs/workbench/contrib/chat/browser/voiceClient/voiceClientService.ts # src/vs/workbench/contrib/chat/browser/voiceClient/voiceSessionController.ts
Megan Rogge (meganrogge)
enabled auto-merge (squash)
July 16, 2026 22:00
Megan Rogge (meganrogge)
approved these changes
Jul 16, 2026
Contributor
Author
|
@microsoft-github-policy-service agree company="Microsoft" |
Paul (pwang347)
approved these changes
Jul 17, 2026
Contributor
Author
|
@microsoft-github-policy-service agree company="Microsoft" |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
fixes https://github.com/microsoft/vscode-internalbacklog/issues/8430
Stacked on #325928. Because the ordering branch lives only in the fork, this PR is opened against the same base as #325928, so it shows two commits: the ordering commit from #325928 and the NACK commit added here. Review only the top commit,
voice: NACK + client revalidation for dropped narration; it lands once #325928 merges.Problem
Client-driven narration (
request_narration) can be dropped by the backend and never recovered. When the backend cannot play a requested narration right now (the user is speaking, or a reply is in flight) it silently discards the request, so the confirmation prompt or reply summary is never read. The same silence happens when an in-flight narration is cut off by barge-in. The client had no way to learn about either case, so the only recovery was an unrelated later state change.Solution
Implement the client half of the NACK + revalidation protocol the backend now speaks:
narration_ack(accepted/busy/invalid).acceptedis a no-op;invalidis dropped;busydefers the narration.busyornarration_interrupted, remember the narration per session (latest-wins, one pending narration per session).narration_unblocked(a content-free server nudge sent once the playback guard clears), revalidate the deferred narration against the current session state via the existing_currentNarratableoracle and re-request only if it is still warranted. The same narration id is reused when the text is unchanged so the backend can dedup a lost ack and avoid double-speak.thinking) or on teardown.The
narration_unblockednudge is server-driven and mode-agnostic, so it recovers narration in both push-to-talk and hands-free without any client timer.Tests
Manual, against a GA voice-code backend carrying the matching server change (
infinity-microsoft/yolo#55139). Verified: busy -> unblock -> revalidate -> audio; barge-in -> interrupted -> revalidate; and a narration that is no longer warranted is dropped without speaking. The VS Code voice client has no unit-test harness for the controller, consistent with the prior PRs in this series.Risks
narration_unblockednudge is lost, the deferred narration is only recovered by the next session state change. This matches today's behavior for a lost narration and is strictly better than the current permanent silence._currentNarratablereflecting current state; a stale confirmation detail would drop rather than mis-speak (fail-safe).Non-goals
infinity-microsoft/yolo#55139).