Skip to content

sessions: Show pending approvals on their own chat rows - #332795

Merged
Sandeep Somavarapu (sandy081) merged 3 commits into
mainfrom
agents/vscode-sessions-chat-approval-ui
Aug 26, 2026
Merged

Sandeep Somavarapu (sandy081) merged 3 commits into
mainfrom
agents/vscode-sessions-chat-approval-ui

Conversation

@sandy081

Copy link
Copy Markdown
Member

Overview

Follow-up to #332739 (nested chats shown as child rows under each session). Now that a session's nested chats render as their own rows, this surfaces each chat's pending tool approval on that chat's row instead of aggregating every chat's approval onto the parent session row.

What changed

  • Per-chat approval rows: SessionChatItemRenderer now renders a chat's pending approval (command label + Allow button) on the chat's own row, keyed on that chat's resource. The row layout became a flex column: a fixed-height title row with the approval stacked beneath it.
  • Session row shows only its main chat's approval: the parent session row uses getMainChatApproval (main chat only) instead of aggregating across all chats. Nested/side chats surface their approvals on their own rows.
  • Flat, chat-less lists unchanged: the blocked-sessions dropdown and automations view render no nested chat rows, so their session rows still aggregate an approval from any of a session's chats. This is gated by a new aggregateChatApprovals flag on the shared renderer/delegate.
  • Shared rendering: the approval-row markup + "Allow" behavior are extracted into a shared renderApprovalRowContent helper, and the CSS is hoisted to a top-level .session-approval-row rule so the session row and chat rows render identically.
  • Virtualization: the tree delegate reserves the extra row height for a chat with a pending approval (plus a small bottom slack for code-block line-height rounding) and updates it reactively via onDidChangeItemHeight as approvals appear and clear.

Why

With multiple chats per session, aggregating all approvals onto the parent row made it ambiguous which chat needed input and only surfaced one approval at a time. Rendering each approval on its owning chat row makes the pending action unambiguous and lets multiple sibling chats show their approvals simultaneously.

Notes for reviewers

  • Behavior preserved for: the main chat represented by the parent session row, nested/ordinary/side chats, the Allow action, accessibility labels, virtualization/disposal, phone layout, and the flat blocked-sessions/automations lists.
  • mainChat.resource is guarded so a session with an unresolved main chat simply shows no approval.

Testing

  • Added 4 focused regression tests (owning-chat-only rendering, main-chat-on-session-row, per-chat height reservation, Allow-click confirms) — all sessions tests pass (187 in the contrib/sessions browser suite).
  • Added component fixtures SessionsList_NestedChatApprovals (+ _Phone), verified visually in dark/light/phone; all sessionsList/blockedSessionsList fixtures render error-free.
  • typecheck-client and valid-layers-check pass.

Now that a session's nested chats are rendered as child rows, surface each
chat's pending tool approval on that chat's row instead of aggregating every
chat's approval onto the parent session row. The session row keeps showing only
its main chat's approval; nested/side chats show theirs on their own rows.

Flat, chat-less lists (blocked-sessions dropdown, automations) still aggregate
an approval from any of a session's chats onto the session row, since they don't
render chat rows — gated by a new `aggregateChatApprovals` flag on the shared
renderer/delegate.

The approval-row markup and styling are extracted into a shared helper and a
top-level CSS rule so both the session row and chat rows render identically. The
tree delegate reserves the extra row height (with a small bottom slack) for a
chat that has a pending approval, and updates it reactively as approvals appear
and clear. Adds focused regression tests and component-fixture coverage
(desktop and phone).

Co-authored-by: Copilot <[email protected]>
Copilot AI balanced review requested due to automatic review settings August 26, 2026 17:44
@sandy081 Sandeep Somavarapu (sandy081) added this to the 1.136.0 milestone Aug 26, 2026

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

Surfaces pending approvals on their owning chat rows while preserving session-row behavior for main chats and flat lists.

Changes:

  • Adds per-chat approval rendering and reactive row sizing.
  • Preserves aggregated approvals in flat session lists.
  • Adds regression tests and visual fixtures.
Show a summary per file
File Description
sessionsList.fixture.ts Adds desktop and phone approval fixtures.
sessionsList.test.ts Tests chat approval rendering, sizing, and confirmation.
sessionsList.ts Implements approval routing, rendering, and virtualization.
sessionsList.css Adds chat approval layout and styling.
vscode-known-variables.json Registers the chat-height CSS variable.

Review details

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

  • Files reviewed: 5/5 changed files
  • Comments generated: 4
  • Review effort level: Balanced

@github-actions

github-actions Bot commented Aug 26, 2026 •

Copy link
Copy Markdown
Contributor

Base: 5a40e6e2 Current: f5b576c8

No screenshot changes.

- Refresh a row's virtualized height on any approval height change, not just
  when an approval appears/clears — the model can swap one pending approval for
  another whose label spans a different number of lines. Track the previously
  reserved approval height and fire when it changes.
- Replace the prohibited `:has()` selector with a `margin-bottom` on the visible
  `.session-approval-row` flex item, reserving the same slack without ancestor
  selector invalidation.
- Give each "Allow" button an explicit ariaLabel naming the command it approves,
  so simultaneously visible buttons are distinguishable to screen readers.
- Add regression tests: flat-list (SessionsFlatList) aggregation of a non-main
  chat's approval onto the session row with height reservation, and a chat row
  growing its height when its approval is replaced by a taller one.

Co-authored-by: Copilot <[email protected]>
…s-chat-approval-ui

# Conflicts:
#	src/vs/sessions/contrib/sessions/browser/media/sessionsList.css
@sandy081
Sandeep Somavarapu (sandy081) merged commit 0f38037 into main Aug 26, 2026
71 of 73 checks passed
@sandy081
Sandeep Somavarapu (sandy081) deleted the agents/vscode-sessions-chat-approval-ui branch August 26, 2026 19:50
@vs-code-engineering vs-code-engineering Bot locked and limited conversation to collaborators Oct 10, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants