Repository navigation
Voice: queue concurrent question forms instead of swapping them - #328205
Merged
Megan Rogge (meganrogge) merged 4 commits intoJul 30, 2026
Merged
Megan Rogge (meganrogge) merged 4 commits into
Megan Rogge (meganrogge) merged 4 commits into
Conversation
Two forms can be pending on one request at once - askQuestions can open one while an MCP elicitation attaches another outside the agent loop. Voice is a serial channel, but both functions that decide which form is "current" picked the newest one independently, so a form arriving silently retargeted the answer the user was in the middle of giving, and dropped the first form's draft. Both now go through one selector that returns the oldest still-open actionable part, which is what the chat model itself does in _pendingInfo. Resolved parts are already skipped, so the oldest open part is by construction the one voice already published: the queue needs no stored state, and payload/detail disagreement becomes unrepresentable. Fixing only the payload would be worse than the bug: the detail would still flip to the new form, isDetailTransition would fire on the detail alone, and the narration path would read the OLD form aloud again. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 1c4672e9-182f-4a2f-8a79-bd8b770961a1
The backend renders [SESSIONS] for the model and its prompt says "Do NOT guess" when several sessions are waiting — but every entry we sent was anonymous, so two concurrent question forms arrived as two identical lines and there was nothing to disambiguate on. Send the label that already exists on both session kinds: `label` for agent sessions, `title` for plain chats. Drop `active_session` while here. It was declared on the wire type and diffed on every context send, but the only place that would have assigned it was an empty try/catch, so it has always been undefined: `activeChanged` was permanently false and the delta never carried the field. The per-entry `is_active` flag is what actually names the focused session. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 1c4672e9-182f-4a2f-8a79-bd8b770961a1
Contributor
There was a problem hiding this comment.
Pull request overview
Queues concurrent voice question forms oldest-first and adds session labels for backend routing.
Changes:
- Shares pending-part selection between narration and answer routing.
- Adds session labels to voice context.
- Removes unused
active_sessionhandling and adds queue regression tests.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
voiceSessionController.ts |
Implements queue selection and session labels. |
voiceClientService.ts (common) |
Updates the wire context type. |
voiceClientService.ts (browser) |
Removes unused active-session delta state. |
voiceSessionController.test.ts |
Tests concurrent pending-part behavior. |
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
Megan Rogge (meganrogge)
marked this pull request as ready for review
July 30, 2026 14:03
Megan Rogge (meganrogge)
enabled auto-merge (squash)
July 30, 2026 14:03
The label is the only human-readable handle the backend has for a session, so without it two waiting forms cannot be told apart by name. It was emitted from two branches with no test on either; a refactor could have made sessions anonymous again silently. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 1c4672e9-182f-4a2f-8a79-bd8b770961a1
auto-merge was automatically disabled
July 30, 2026 15:49
Head branch was pushed to by a user without write access
Megan Rogge (meganrogge)
approved these changes
Jul 30, 2026
Megan Rogge (meganrogge)
enabled auto-merge (squash)
July 30, 2026 18:18
Benjamin Christopher Simmonds (benibenj)
approved these changes
Jul 30, 2026
roblourens
approved these changes
Jul 30, 2026
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/8624
Follow-on to #327899, which made a spoken answer land on the right question form. That fix assumed one form at a time; with two pending in the same session it picks the wrong one.
The bug
Two functions independently decide which pending part voice is working on, and both took the last match:
_getAgentStateInfo(the spokenagent_state_detail) and_buildPendingPayload(the structuredpendingan answer is resolved against). A second form arriving silently stole focus, so the user mid-answer on form A had their next utterance resolved against form B.Fixing only the payload would be worse than the bug:
_getAgentStateInfowould still hold the newest, its changed detail alone satisfiesisDetailTransition, and the narration it triggers reads the payload and gets A. Questions aren't text-deduped, so form A would be re-read aloud every time B arrived. Both callers have to agree.The fix
One
_selectPendingPart, used by both, scanning oldest-first and returning the first still-open part. A form holds focus until it resolves; a second form waits its turn. This also matches the platform —chatModel._pendingInfoscans forward and its value already feeds the fallback_getAgentStateInfouses. Newest-first was the deviation.Split so the two callers can't drift again:
_selectPendingPart(which part),_isOpenPendingPart(still open, per kind),_describePendingPart(the prose, lifted verbatim).Also here
Send each session's
label. The backend renders[SESSIONS]for its routing model and refuses to guess between waiting sessions — but every entry we sent was anonymous, so two concurrent forms arrived as two identical lines.Drop
active_session. The only place that would assign it is an emptytry {} catch {}, so it has always been undefined and the delta never carried the field — removal is provably behaviour-preserving. The per-entryis_activeflag names the focused session.Verification
VoiceSessionController+VoiceClientService: 73 passing, 11 new — oldest-first selection, moving on once a form resolves, an executing tool not shadowing the form it opened, an older form surviving a newer arrival, payload and spoken detail agreeing, a newer form answered by mouse leaving focus untouched, and the session labels. Compile is clean incontrib/chat(the 90 total errors are pre-existing onmain, inplatform/agentHost,localTranscriptionandnative).Draft until the companion backend change lands and the two-form case has been driven end to end by voice.