Fix handoff widget visibility: derive from response mode, persist modeInfo#298867
Open
digitarald wants to merge 5 commits intomainfrom
Open
Fix handoff widget visibility: derive from response mode, persist modeInfo#298867digitarald wants to merge 5 commits intomainfrom
digitarald wants to merge 5 commits intomainfrom
Conversation
…eInfo, fix lifecycle
Contributor
There was a problem hiding this comment.
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
modeInfoon 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
modeInforoundtripping 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. |
…eById does, bypassing the getCustomModes() gate
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes three bugs with the handoff suggest-next widget in chat:
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.Handoffs based on wrong mode — Widget now derives the mode from the last response's
modeInfo(viafindModeByName/findModeById) instead of reading the current mode picker selection. Removed the mode-change listener trigger.Handoffs missing on session restore —
modeInfois now persisted through serialization (ISerializableChatRequestData,toExport(),_deserializeRequest()), andrenderChatSuggestNextWidget()is called at the end ofsetModel().Note: Pre-existing sessions without persisted
modeInfowon't show handoffs (graceful degradation — no crash).Test
Added
modeInfo roundtrips through serializationtest verifying the ser/deser roundtrip.