Skip to content

Fix handoff widget visibility: derive from response mode, persist modeInfo#298867

Open
digitarald wants to merge 5 commits intomainfrom
digitarald/fix-handoff-widget-visibility
Open

Fix handoff widget visibility: derive from response mode, persist modeInfo#298867
digitarald wants to merge 5 commits intomainfrom
digitarald/fix-handoff-widget-visibility

Conversation

@digitarald
Copy link
Contributor

Fixes three bugs with the handoff suggest-next widget in chat:

  1. Handoffs shown during streaming — Widget now only appears after the response completes (and not if cancelled). Added explicit hide() on new request and early return for incomplete/cancelled responses.

  2. Handoffs based on wrong mode — Widget now derives the mode from the last response's modeInfo (via findModeByName/findModeById) instead of reading the current mode picker selection. Removed the mode-change listener trigger.

  3. Handoffs missing on session restoremodeInfo is now persisted through serialization (ISerializableChatRequestData, toExport(), _deserializeRequest()), and renderChatSuggestNextWidget() is called at the end of setModel().

Note: Pre-existing sessions without persisted modeInfo won't show handoffs (graceful degradation — no crash).

Test

Added modeInfo roundtrips through serialization test verifying the ser/deser roundtrip.

Copilot AI review requested due to automatic review settings March 3, 2026 04:21
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

Fixes handoff “suggest next” widget correctness in the chat widget by basing visibility and contents on the completed response’s mode (rather than current picker state), and by persisting modeInfo through chat session serialization so restored sessions can still show handoffs.

Changes:

  • Persist modeInfo on requests through serialization/deserialization and export (ISerializableChatRequestData, _deserializeRequest, toExport()).
  • Update handoff widget logic to only show after a completed, non-cancelled response and to derive handoffs from the last response’s modeInfo.
  • Add a unit test covering modeInfo roundtripping through serialization/export.

Reviewed changes

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

File Description
src/vs/workbench/contrib/chat/test/common/model/chatModel.test.ts Adds a serialization roundtrip test for request modeInfo.
src/vs/workbench/contrib/chat/common/model/chatModel.ts Extends serialized request shape to include modeInfo and carries it through deser/export.
src/vs/workbench/contrib/chat/browser/widget/chatWidget.ts Adjusts suggest-next widget visibility timing and derives handoffs from the response mode.

@digitarald digitarald marked this pull request as ready for review March 3, 2026 15:10
@digitarald digitarald requested a review from aeschli March 3, 2026 15:10
@vs-code-engineering vs-code-engineering bot added this to the March 2026 milestone Mar 3, 2026
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.

2 participants