Skip to content

Fix multiple askQuestions in Agent Host#323943

Draft
jruales wants to merge 1 commit into
mainfrom
jruales/s2026.07-browser-multiple-ask-questions
Draft

Fix multiple askQuestions in Agent Host#323943
jruales wants to merge 1 commit into
mainfrom
jruales/s2026.07-browser-multiple-ask-questions

Conversation

Copilot AI review requested due to automatic review settings July 1, 2026 21:11

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

This PR addresses an Agent Host lifecycle bug where client tool invocations (notably askQuestions-driven UI) could remain running after the protocol tool call was already in a terminal state, leading to multiple stacked question prompts (per #323777).

Changes:

  • Treat ToolCallStatus.Completed as a terminal protocol state (in addition to Cancelled) for driving local cancellation of an in-flight invokeTool.
  • Avoid forcing the local invocation into Cancelled when the protocol state is Completed, while still cancelling the local CTS to ensure cleanup can happen.
Show a summary per file
File Description
src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostSessionHandler.ts Cancels local client-tool execution when the protocol tool call reaches a terminal state to prevent orphaned UI (e.g. stacked askQuestions).

Review details

  • Files reviewed: 1/1 changed files
  • Comments generated: 1
  • Review effort level: Low
Comment on lines +2352 to +2360
// The protocol tool call reached a terminal state. If this was
// driven by the server (e.g. the client-tool bridge abandoned the
// call because the client was considered disconnected, the turn was
// superseded, or a reconnect occurred) while our local `invokeTool`
// is still running, cancel it so the tool cleans up (e.g. dismisses a
// pending question carousel) instead of blocking forever on an answer
// nobody will consume. In the normal path we complete the call
// ourselves first, so `invokeTool` has already settled and this
// cancellation is a harmless no-op.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants