Skip to content

chat: add requestNeedsInput on the chat model#278171

Merged
connor4312 merged 1 commit intomainfrom
connor4312/chatmodel-requestNeedsInput
Nov 18, 2025
Merged

chat: add requestNeedsInput on the chat model#278171
connor4312 merged 1 commit intomainfrom
connor4312/chatmodel-requestNeedsInput

Conversation

@connor4312
Copy link
Member

With a side quest that makes elicitations correctly trigger this, which
involved refactoring their state into an observable.

Also swap requestInProgress/Obs to a single requestInProgress observable.
Synchronous callers can just .get() it as needed.

Refs #277318

With a side quest that makes elicitations correctly trigger this, which
involved refactoring their state into an observable.

Also swap requestInProgress/Obs to a single requestInProgress observable.
Synchronous callers can just `.get()` it as needed.
Copilot AI review requested due to automatic review settings November 18, 2025 18:27
@connor4312 connor4312 enabled auto-merge (squash) November 18, 2025 18:28
@connor4312 connor4312 self-assigned this Nov 18, 2025
@vs-code-engineering
Copy link

📬 CODENOTIFY

The following users are being notified based on files changed in this PR:

@jrieken

Matched files:

  • src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorContextKeys.ts
  • src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorOverlay.ts
  • src/vs/workbench/contrib/inlineChat/browser/inlineChatController.ts
  • src/vs/workbench/contrib/inlineChat/browser/inlineChatSessionServiceImpl.ts
  • src/vs/workbench/contrib/inlineChat/browser/inlineChatWidget.ts
  • src/vs/workbench/contrib/inlineChat/test/browser/inlineChatController.test.ts

@roblourens

Matched files:

  • src/vs/workbench/contrib/chat/browser/chatListRenderer.ts

@bpasero

Matched files:

  • src/vs/workbench/contrib/chat/browser/chatSessions/chatSessionTracker.ts
  • src/vs/workbench/contrib/chat/browser/chatSessions/localChatSessionsProvider.ts
  • src/vs/workbench/contrib/chat/browser/chatWidget.ts

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR refactors chat elicitation state management from simple properties to observables and adds a new requestNeedsInput observable to track when user input is required. The changes improve reactivity and enable better UI state management.

Key Changes:

  • Refactored elicitation state from string property to IObservable<ElicitationState> for reactive updates
  • Consolidated requestInProgress from separate boolean property and observable into a single IObservable<boolean>
  • Added new requestNeedsInput observable to track pending confirmations and elicitations

Reviewed Changes

Copilot reviewed 23 out of 23 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/vs/workbench/contrib/chat/common/chatService.ts Added ElicitationState enum; updated IChatElicitationRequest interface to use observable state; added IChatElicitationRequestSerialized type for serialization
src/vs/workbench/contrib/chat/common/chatModel.ts Replaced requestInProgress property with observable; added requestNeedsInput observable; updated switch statements to handle both elicitation kinds
src/vs/workbench/contrib/chat/browser/chatElicitationRequestPart.ts Changed state to observable; renamed kind to 'elicitation2'; refactored accept/_accept to return ElicitationState; updated serialization to 'elicitationSerialized'
src/vs/workbench/contrib/chat/common/chatViewModel.ts Removed requestInProgress property delegation (now accessed from model)
src/vs/workbench/contrib/chat/common/chatServiceImpl.ts Updated to use model.requestInProgress.read() and optimized with Iterable.some()
src/vs/workbench/contrib/chat/browser/chatWidget.ts Updated to access requestInProgress via viewModel.model.requestInProgress.get()
src/vs/workbench/contrib/chat/browser/chatContentParts/chatElicitationContentPart.ts Added reactive handling for state changes via autorun; conditional setup for live vs serialized elicitations
src/vs/workbench/contrib/chat/browser/chatListRenderer.ts Added visibility check for hidden elicitations; handles both 'elicitation2' and 'elicitationSerialized' kinds
src/vs/workbench/contrib/mcp/browser/mcpElicitationService.ts Updated callbacks to return ElicitationState; added backward compatibility for pre-2025-11-25 params
src/vs/workbench/contrib/mcp/browser/mcpCommands.ts Updated kind check from 'elicitation' to 'elicitation2'
src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/monitoring/outputMonitor.ts Updated accept/reject callbacks to return ElicitationState instead of void
src/vs/workbench/contrib/inlineChat/browser/inlineChatController.ts Updated all requestInProgress accesses to use observable .get() or .read()
src/vs/workbench/contrib/inlineChat/browser/inlineChatWidget.ts Changed to read from viewModel.model.requestInProgress.get()
src/vs/workbench/contrib/inlineChat/browser/inlineChatSessionServiceImpl.ts Updated to use .read() on requestInProgress observable
src/vs/workbench/contrib/inlineChat/test/browser/inlineChatController.test.ts Updated test assertion to use .get() on requestInProgress observable
src/vs/workbench/contrib/chat/browser/chatSessions/localChatSessionsProvider.ts Updated to use observable pattern for requestInProgress
src/vs/workbench/contrib/chat/browser/chatSessions/chatSessionTracker.ts Updated to use .get() on requestInProgress observable
src/vs/workbench/contrib/chat/browser/chatResponseAccessibleView.ts Updated filter to handle both 'elicitation2' and 'elicitationSerialized' kinds
src/vs/workbench/contrib/chat/browser/chatAccessibilityService.ts Updated to use observable state comparison with ElicitationState.Pending
src/vs/workbench/contrib/chat/browser/chatAccessibilityProvider.ts Updated filter to handle both elicitation kinds
src/vs/workbench/contrib/chat/browser/actions/chatElicitationActions.ts Updated to check observable state and compare with ElicitationState.Pending
src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorOverlay.ts Changed property name from requestInProgressObs to requestInProgress
src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorContextKeys.ts Updated to use .read() on requestInProgress observable

this.state.set(state, undefined);
});
}

Copy link

Copilot AI Nov 18, 2025

Choose a reason for hiding this comment

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

The ChatElicitationRequestPart class is missing the reject() method implementation. While the interface IChatElicitationRequest declares reject as optional, the class has a _reject constructor parameter that should be wrapped in a public reject() method similar to how _accept is wrapped in accept().

Add the missing method:

reject(): Promise<void> {
    if (!this._reject) {
        return Promise.resolve();
    }
    return this._reject().then(state => {
        this.state.set(state, undefined);
    });
}
Suggested change
reject(): Promise<void> {
if (!this._reject) {
return Promise.resolve();
}
return this._reject().then(state => {
this.state.set(state, undefined);
});
}

Copilot uses AI. Check for mistakes.
return response?.isInProgress.read(r) ?? false;
});

this.requestNeedsInput = lastResponse.map((response, r) => {
Copy link
Member

Choose a reason for hiding this comment

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

How do you feel about two observables vs one state enum like Idle, Running, WaitingForConfirmation? The number of states might increase

Copy link
Member

Choose a reason for hiding this comment

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

I mean on second thought we should keep the basic requestInProgress regardless, and then could refactor if there are more things to track.

@connor4312 connor4312 merged commit ea4ccd5 into main Nov 18, 2025
33 of 34 checks passed
@connor4312 connor4312 deleted the connor4312/chatmodel-requestNeedsInput branch November 18, 2025 19:05
@vs-code-engineering vs-code-engineering bot locked and limited conversation to collaborators Jan 2, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants