Skip to content

Fix voice mode connecting spinner getting stuck indefinitely#326036

Merged
meganrogge merged 3 commits into
mainfrom
copilot/fix-voice-mode-button-behavior
Jul 16, 2026
Merged

Fix voice mode connecting spinner getting stuck indefinitely#326036
meganrogge merged 3 commits into
mainfrom
copilot/fix-voice-mode-button-behavior

Conversation

Copilot AI commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Description

Pressing the voice mode button while a chat session is in progress could leave the toolbar spinner (agentsVoice.connecting) spinning forever with no effect and no feedback.

Root cause: VoiceSessionController.connect() armed its timeout watchdog only after several awaits (getSessions('github'), transcript-store loads, voiceClientService.connect()). If any of that awaited work hung — plausible when the auth provider is busy servicing an in-progress request — the watchdog was never armed, so isConnecting stayed true indefinitely. Re-clicking did nothing since connect() early-returns while connecting, and no failure path surfaced feedback.

Changes (voiceSessionController.ts):

  • Connect watchdog armed up front — a _connectWatchdog (MutableDisposable, 10s) is armed before any awaited work, and re-armed immediately before the WebSocket handshake so the handshake gets a fresh window regardless of auth latency. Cleared on a successful handshake and in disconnect().
  • Feedback on timeout — on expiry the watchdog calls disconnect() and shows a warning notification ("Voice mode could not connect. Please try again.") instead of silently reverting.
  • Late-connection guard — after the awaited auth/transcript work, connect() bails if isConnecting was already reset (by the watchdog or an explicit disconnect), avoiding opening a connection the user no longer expects.
  • Replaces the previous post-await inline setTimeout, which only covered the handshake, with a watchdog spanning the whole connect lifecycle.
private _armConnectWatchdog(): void {
    this._connectWatchdog.value = disposableTimeout(() => {
        if (!this._isConnecting.get() || this._isConnected.get()) {
            return;
        }
        this.disconnect();
        this.notificationService.notify({
            severity: Severity.Warning,
            message: localize('voice.connectFailed', "Voice mode could not connect. Please try again."),
        });
    }, VoiceSessionController._CONNECT_TIMEOUT_MS);
}

Adds an INotificationService dependency to the controller (registered singleton; no direct instantiation sites affected).

Co-authored-by: meganrogge <29464607+meganrogge@users.noreply.github.com>
Copilot AI requested review from Copilot and removed request for Copilot July 15, 2026 19:28
Copilot AI changed the title [WIP] Fix voice mode button behavior during active sessions Fix voice mode connecting spinner getting stuck indefinitely Jul 15, 2026
Copilot AI requested a review from meganrogge July 15, 2026 19:29
@meganrogge meganrogge marked this pull request as ready for review July 15, 2026 20:12
Copilot AI review requested due to automatic review settings July 15, 2026 20:12
@meganrogge meganrogge added this to the 1.130.0 milestone Jul 15, 2026
@meganrogge meganrogge enabled auto-merge (squash) July 15, 2026 20:13

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Prevents voice mode’s connecting spinner from hanging indefinitely.

Changes:

  • Adds a 10-second connection watchdog with timeout feedback.
  • Cancels late connections after timeout or disconnect.
  • Clears the watchdog after successful connection or disconnection.
Show a summary per file
File Description
voiceSessionController.ts Adds watchdog lifecycle, timeout notification, and late-connection handling.

Review details

  • Files reviewed: 1/1 changed files
  • Comments generated: 2
  • Review effort level: Medium

Co-authored-by: meganrogge <29464607+meganrogge@users.noreply.github.com>
@meganrogge meganrogge merged commit b600553 into main Jul 16, 2026
29 checks passed
@meganrogge meganrogge deleted the copilot/fix-voice-mode-button-behavior branch July 16, 2026 20:16
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.

Voice mode: pressing voice mode button while a session is in progress does nothing (spins continuously)

5 participants