Repository navigation
voice: honor the new_session flag on send_to_chat - #330682
Closed
Arthur Cnops (accnops) wants to merge 1 commit into
Closed
Arthur Cnops (accnops) wants to merge 1 commit into
Arthur Cnops (accnops) wants to merge 1 commit into
Conversation
The voice backend advertises a `new_session` boolean on `send_to_chat` and sets it when the user explicitly asks for a fresh session, but the controller never read it, so those requests landed in the current session. Read the flag in the `send_to_chat` branch: clear any pinned submit session (an explicit "new session" outranks a pin left by a focus change), then create and target a new session. An empty `text` creates and focuses without sending, which is what the backend emits for a bare "start a new session". Also drop the `new_sessions` dispatch handler and its action label. It is not in the controller's allowedTools list, so it is unreachable, and it bypassed the target session, stop-phrase stripping and send suppression that `send_to_chat` goes through. Co-authored-by: Copilot App <[email protected]> Copilot-Session: c568e3e0-eabb-48db-84a4-a7976df7c474
Contributor
There was a problem hiding this comment.
Pull request overview
Honors voice send_to_chat.new_session requests and removes the unreachable legacy handler.
Changes:
- Creates and targets a fresh session when requested.
- Removes obsolete
new_sessionsdispatch logic. - Adds coverage for new, empty, and default session routing.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
voiceSessionController.ts |
Handles new_session routing. |
voiceToolDispatchService.ts |
Removes legacy handler and label. |
voiceSessionController.test.ts |
Tests session-routing behavior. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| // outranks a pin left by a focus change, which would | ||
| // otherwise win in _sendTranscriptionToChat. | ||
| this._consumePinnedSubmitSession(); | ||
| this.newSessionAsTarget(); |
| // Clear the pin first: an explicit "start a new session" | ||
| // outranks a pin left by a focus change, which would | ||
| // otherwise win in _sendTranscriptionToChat. | ||
| this._consumePinnedSubmitSession(); |
Collaborator
|
Superseded by #330859, which preserves the original authorship and includes the session-lifecycle, focused-Omni routing, URI comparison, and cleanup fixes from review. |
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.
Problem
The voice backend advertises a
new_sessionboolean on thesend_to_chattool and sets it when the user explicitly asks for a fresh session ("start a new session and refactor the upload service"). The controller'ssend_to_chatbranch never read the flag, so those requests were submitted into the current session instead.Separately,
voiceToolDispatchServicestill carried anew_sessionshandler. It is not in the controller'sallowedToolslist, so the backend can never reach it.Solution
Read
new_sessionin the controller'ssend_to_chatbranch. When set, clear any pinned submit session and then create and target a new one. Pin clearing has to come first:_sendTranscriptionToChatresolves its target as_consumePinnedSubmitSession() ?? _targetSession, so a pin left by an earlier focus change would otherwise outrank the session just created.Empty
textwithnew_session: truecreates and focuses a session without sending, which is what the backend emits for a bare "start a new session". The existingtext.trim() ? … : Promise.resolve()guard already handles that, so no extra branch is needed.This lives in the controller rather than the dispatch service on purpose:
send_to_chatis routed through the controller so it honors_targetSession, the workbench chat commands, stop-phrase stripping and send suppression. The oldnew_sessionshandler bypassed all of them, which is the second half of this change - it and its action label are removed.Test plan
Three tests added to
voiceSessionController.test.ts, coveringnew_sessionwith text,new_sessionwith empty text, and the unchanged default path:ESLint clean on the three touched files.
tsc --noEmit -p src/tsconfig.jsonreports no errors in voice files.Risks
newSessionAsTarget()is existing code; this change only calls it from a new place. The defaultsend_to_chatpath is unchanged and covered by the third test.Removing
new_sessionsis a behavior change only if something outsideallowedToolswas dispatching it. Nothing in the tree references the name after this change.Non-goals
Model selection and file attachment are out of scope.
focus_sessionalready returns a structured result and retargets onmain; no change needed there.