Skip to content

chat: allow collapsing queued chat requests - #335208

Open
lakshaykhattar (LakshayKhattar) wants to merge 2 commits into
microsoft:mainfrom
LakshayKhattar:fix/collapse-queued-chat-request
Open

chat: allow collapsing queued chat requests#335208
lakshaykhattar (LakshayKhattar) wants to merge 2 commits into
microsoft:mainfrom
LakshayKhattar:fix/collapse-queued-chat-request

Conversation

@LakshayKhattar

@LakshayKhattar lakshaykhattar (LakshayKhattar) commented Sep 9, 2026

Copy link
Copy Markdown

Long queued prompts take up chat space without a way to collapse them. Add a keyboard-accessible chevron that collapses each queued or steering message into a single-line preview. Each message keeps its own expansion state across rendering updates, queue reordering, and the transition into the transcript. Collapsed messages are excluded from sticky-scroll headers.

The local queue processor preserves request identity. When steering messages merge, the combined prompt inherits an explicit collapse choice from any source message; users can then expand or collapse the combined prompt normally. The collapsed hover exposes the full preview, and Chat Accessibility Help documents the keyboard controls.

Fixes #326123.

Validation:

  • Browser renderer suite: 70 passing, 1 pre-existing skipped test, including 13 collapse regressions covering independent state, keyboard interaction, both chat layouts, merged steering, attachment visibility, and full-preview hover text.
  • ChatService suite: 101 passing, covering real queue/dequeue paths, merged steering identities, slash-command retries, and blocked troubleshoot requests.
  • Client transpilation, scoped ESLint, hygiene, and git diff --check passed.

To test:

  1. Start a chat request that keeps streaming, then add two long follow-up messages using Add to Queue.
  2. Collapse the first queued message with its Message chevron. It should become a single-line preview while the second stays expanded.
  3. Use Enter and Space on the toggle, then leave the first message collapsed. Scroll and resize the chat while the response streams; its state should remain unchanged.
  4. Let the first queued message begin processing. It should stay collapsed, and expanding it should restore the complete prompt.

Runtime evidence:

Watch the contributor's recording (MP4, 64 seconds). At approximately 0:48, one queued prompt is collapsed while the other remains expanded; at 0:55, both are collapsed independently while the current response continues streaming. The original recording is hosted as an evidence asset on the contributor's fork.

The recording shows the disclosure UI at commit 53e4074. The dequeue and merged-steering fixes in 49af945 are covered by the automated tests above.

Copilot AI balanced review requested due to automatic review settings September 9, 2026 06:52

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.

🟡 Changes recommended

The dequeue path loses collapsed state, with additional accessibility, URI comparison, hover, and CSS issues unresolved.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Adds keyboard-accessible collapsing for queued and steering chat requests with per-message state preservation.

Changes:

  • Adds collapse controls and single-line previews.
  • Excludes collapsed messages from sticky-scroll headers.
  • Adds renderer regression tests.

Review findings:

  • Critical: The real dequeue path does not preserve request IDs, so collapsed state is lost when processing begins. Preserve/transfer state and test the actual path, including merged steering.
  • Moderate: Compare session URIs using isEqual, not serialized strings.
  • Moderate: Include the full truncated preview in the collapsed hover.
  • Moderate: Remove the new prohibited !important styling.
  • Nit: Document keyboard interaction in Chat Accessibility Help.
File summaries
File Description
src/vs/workbench/contrib/chat/test/browser/widget/chatListRenderer.test.ts Tests collapse state, layouts, keyboard use, and transitions.
src/vs/workbench/contrib/chat/browser/widget/media/chat.css Styles collapsed request previews.
src/vs/workbench/contrib/chat/browser/widget/chatListRenderer.ts Implements collapse state, controls, and sticky-scroll handling.
Review details
  • Files reviewed: 3/3 changed files
  • Comments generated: 5
  • Review effort level: Balanced

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +2412 to +2414
// Pending view models are recreated on updates. Keep the choice by request ID,
// including when the same request moves into the transcript.
this.requestExpansionState.set(element.id, expanded);

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Fixed in 49af945. The real dequeue path now preserves the pending request ID. Merged steering requests also carry their source IDs into the model/view model, so a collapse choice from any source transfers to the combined prompt; later expansion survives rerenders.

Added service regressions using the public queue/dequeue APIs, including automatic queued/steering dispatch, merged steering, slash commands and retries, and blocked troubleshoot requests. The renderer tests now complement those service tests instead of being the only evidence for the transition. All 101 ChatService tests and 70 renderer tests pass (one existing renderer test remains skipped).

}

updateViewModel(viewModel: IChatViewModel | undefined): void {
if (this.viewModel?.sessionResource.toString() !== viewModel?.sessionResource.toString()) {

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Fixed in 49af945: updateViewModel now uses the existing isEqual helper for session resources. The session-switch regression still passes as part of the renderer suite.

Comment on lines +2405 to +2407
templateData.elementDisposables.add(this.hoverService.setupManagedHover(getDefaultHoverDelegate('element'), button.element, () => expanded
? localize('collapseRequest', "Collapse Message")
: localize('expandRequestTooltip', "Expand Message")));

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Fixed in 49af945: the collapsed managed hover now includes the full normalized preview, using the localized "Expand Message: {0}" text. Added a regression that verifies the expanded hover and complete collapsed hover content.

Comment on lines +4797 to +4798
.interactive-item-container.chat-request-collapsed .value > :not(.chat-request-collapse-control) {
display: none !important;

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Fixed in 49af945. Removed the new !important rule and moved visibility handling into the renderer. It saves each request child's original display value, hides it on collapse, and restores that value on expansion.

The regression uses a real file attachment and verifies flex -> none -> flex, while the existing height and template-recycling tests continue to pass.

Comment on lines +2391 to +2392
const button = templateData.elementDisposables.add(new ButtonWithIcon(control, {}));
button.iconElement.setAttribute('aria-hidden', 'true');

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Fixed in 49af945: added a localized paragraph to the existing Chat Accessibility Help explaining Tab/Shift+Tab navigation, Enter/Space activation, and independent queued-message collapse states. Scoped ESLint and hygiene checks pass.

@microsoft-github-policy-service

Copy link
Copy Markdown
Contributor

lakshaykhattar (@LakshayKhattar) please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.

@microsoft-github-policy-service agree [company="{your company}"]

Options:

  • (default - no company specified) I have sole ownership of intellectual property rights to my Submissions and I am not making Submissions in the course of work for my employer.
@microsoft-github-policy-service agree
  • (when company given) I am making Submissions in the course of work for my employer (or my employer has intellectual property rights in my Submissions by contract or applicable law). I have permission from my employer to make Submissions and enter into this Agreement on behalf of my employer. By signing below, the defined term “You” includes me and my employer.
@microsoft-github-policy-service agree company="Microsoft"
Contributor License Agreement

Contribution License Agreement

This Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”),
and conveys certain license rights to Microsoft Corporation and its affiliates (“Microsoft”) for Your
contributions to Microsoft open source projects. This Agreement is effective as of the latest signature
date below.

  1. Definitions.
    “Code” means the computer software code, whether in human-readable or machine-executable form,
    that is delivered by You to Microsoft under this Agreement.
    “Project” means any of the projects owned or managed by Microsoft and offered under a license
    approved by the Open Source Initiative (www.opensource.org).
    “Submit” is the act of uploading, submitting, transmitting, or distributing code or other content to any
    Project, including but not limited to communication on electronic mailing lists, source code control
    systems, and issue tracking systems that are managed by, or on behalf of, the Project for the purpose of
    discussing and improving that Project, but excluding communication that is conspicuously marked or
    otherwise designated in writing by You as “Not a Submission.”
    “Submission” means the Code and any other copyrightable material Submitted by You, including any
    associated comments and documentation.
  2. Your Submission. You must agree to the terms of this Agreement before making a Submission to any
    Project. This Agreement covers any and all Submissions that You, now or in the future (except as
    described in Section 4 below), Submit to any Project.
  3. Originality of Work. You represent that each of Your Submissions is entirely Your original work.
    Should You wish to Submit materials that are not Your original work, You may Submit them separately
    to the Project if You (a) retain all copyright and license information that was in the materials as You
    received them, (b) in the description accompanying Your Submission, include the phrase “Submission
    containing materials of a third party:” followed by the names of the third party and any licenses or other
    restrictions of which You are aware, and (c) follow any other instructions in the Project’s written
    guidelines concerning Submissions.
  4. Your Employer. References to “employer” in this Agreement include Your employer or anyone else
    for whom You are acting in making Your Submission, e.g. as a contractor, vendor, or agent. If Your
    Submission is made in the course of Your work for an employer or Your employer has intellectual
    property rights in Your Submission by contract or applicable law, You must secure permission from Your
    employer to make the Submission before signing this Agreement. In that case, the term “You” in this
    Agreement will refer to You and the employer collectively. If You change employers in the future and
    desire to Submit additional Submissions for the new employer, then You agree to sign a new Agreement
    and secure permission from the new employer before Submitting those Submissions.
  5. Licenses.
  • Copyright License. You grant Microsoft, and those who receive the Submission directly or
    indirectly from Microsoft, a perpetual, worldwide, non-exclusive, royalty-free, irrevocable license in the
    Submission to reproduce, prepare derivative works of, publicly display, publicly perform, and distribute
    the Submission and such derivative works, and to sublicense any or all of the foregoing rights to third
    parties.
  • Patent License. You grant Microsoft, and those who receive the Submission directly or
    indirectly from Microsoft, a perpetual, worldwide, non-exclusive, royalty-free, irrevocable license under
    Your patent claims that are necessarily infringed by the Submission or the combination of the
    Submission with the Project to which it was Submitted to make, have made, use, offer to sell, sell and
    import or otherwise dispose of the Submission alone or with the Project.
  • Other Rights Reserved. Each party reserves all rights not expressly granted in this Agreement.
    No additional licenses or rights whatsoever (including, without limitation, any implied licenses) are
    granted by implication, exhaustion, estoppel or otherwise.
  1. Representations and Warranties. You represent that You are legally entitled to grant the above
    licenses. You represent that each of Your Submissions is entirely Your original work (except as You may
    have disclosed under Section 3). You represent that You have secured permission from Your employer to
    make the Submission in cases where Your Submission is made in the course of Your work for Your
    employer or Your employer has intellectual property rights in Your Submission by contract or applicable
    law. If You are signing this Agreement on behalf of Your employer, You represent and warrant that You
    have the necessary authority to bind the listed employer to the obligations contained in this Agreement.
    You are not expected to provide support for Your Submission, unless You choose to do so. UNLESS
    REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING, AND EXCEPT FOR THE WARRANTIES
    EXPRESSLY STATED IN SECTIONS 3, 4, AND 6, THE SUBMISSION PROVIDED UNDER THIS AGREEMENT IS
    PROVIDED WITHOUT WARRANTY OF ANY KIND, INCLUDING, BUT NOT LIMITED TO, ANY WARRANTY OF
    NONINFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
  2. Notice to Microsoft. You agree to notify Microsoft in writing of any facts or circumstances of which
    You later become aware that would make Your representations in this Agreement inaccurate in any
    respect.
  3. Information about Submissions. You agree that contributions to Projects and information about
    contributions may be maintained indefinitely and disclosed publicly, including Your name and other
    information that You submit with Your Submission.
  4. Governing Law/Jurisdiction. This Agreement is governed by the laws of the State of Washington, and
    the parties consent to exclusive jurisdiction and venue in the federal courts sitting in King County,
    Washington, unless no federal subject matter jurisdiction exists, in which case the parties consent to
    exclusive jurisdiction and venue in the Superior Court of King County, Washington. The parties waive all
    defenses of lack of personal jurisdiction and forum non-conveniens.
  5. Entire Agreement/Assignment. This Agreement is the entire agreement between the parties, and
    supersedes any and all prior agreements, understandings or communications, written or oral, between
    the parties relating to the subject matter hereof. This Agreement may be assigned by Microsoft.

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.

Feature Request: Add option to collapse/expand queued messages in Copilot Chat

3 participants