Skip to content

sessions: keep sticky approval rows from growing the session row - #342391

Merged
Alexandru Dima (alexdima) merged 4 commits into
mainfrom
alexdima/sessions-sticky-approval-row-height
Oct 18, 2026
Merged

Alexandru Dima (alexdima) merged 4 commits into
mainfrom
alexdima/sessions-sticky-approval-row-height

Conversation

@alexdima

@alexdima Alexandru Dima (alexdima) commented Oct 18, 2026 •

Copy link
Copy Markdown
Member

Fixes #338189
Supersedes #338210 (includes its commits)

Important

Please merge with "Create a merge commit", not squash or rebase. This branch merges RKS (@rksharma-owg)'s #338210 head (8c82d12f42), so their original commits land and GitHub marks #338210 as merged. Squashing or rebasing would drop those commit IDs.

Problem

In the Agents window, an expanded session with a pending approval (for example "Write file? [Allow]") can grow to hundreds of pixels once it scrolls into the sticky header. The title moves into a mostly empty grey block and the rest of the list is pushed down. I hit this on Insiders a0c6520313624aceb3f3a80eff7932be6a00405a (2026-10-17). The row was 363px tall when 64px was enough.

Root cause

Three behaviors combine so that the row height keeps growing:

  1. ListView and the sticky scroll widget set each row's line-height to the full row height (setRowLineHeight). .session-approval-row did not override it, so the approval label inherits it. The sibling .session-ci-row and .session-input-needed-row already reset theirs to 18px for this reason.
  2. The approval label is a markdown code block. EditorMarkdownCodeBlockRenderer fills it in asynchronously, so a freshly rendered row briefly holds plain inline text, and that text's line box is as tall as the inherited line-height.
  3. The sticky scroll widget renders a new copy of the session row, measures it (StickyScrollWidget.probeDynamicHeights) while the label is still a placeholder, and, because a sticky row "never shrinks the source row", pushes the larger height back to the real row through onDidChangeHeight. The next sticky render starts from that larger line-height, so each cycle adds about one more line.

SessionsTreeDelegate.getHeight and SessionItemRenderer.getApprovalRowHeight already assume an 18px approval line, so the fix pins the CSS to that value.

Evidence from a live Insiders window

I attached to the running Agents window with dbgjs and inspected the affected row:

  • Row style: top: 78px; height: 363px; line-height: 363px; (aria-label: "ExP triggered scorecards, …, State: Attention Needed").
  • The approval label's computed line-height matched the row height (363px). Its intrinsic content needs only 64px.

I then measured the row the same way probeDynamicHeight does, by clearing style.height and reading offsetHeight while varying the inherited line-height. I ran it with the label tokenized and as a placeholder, with and without .session-approval-row { line-height: 18px } injected:

Inherited line-height Tokenized label Placeholder label (as just after render) Placeholder + this fix Tokenized + this fix
64px 64 107 64 64
100px 64 143 64 64
200px 64 243 64 64
363px 64 406 64 64

The placeholder measurement is always the previous height plus about 43px, which is the ratchet. With the fix, every measurement is 64px.

History

This is not a regression in the latest Insiders. Nothing that affects it changed between 0b37947e9c38 and a0c65203136. The ingredients arrived with:

#338210 by RKS (@rksharma-owg) proposed the same CSS change and regression tests on Sep 27, but it no longer merged cleanly with main. This PR merges their head commit and resolves the conflicts against current main, so their work lands with their authorship. It adds the live diagnosis above.

Changes

  • sessionsList.css: set line-height: 18px on .session-approval-row (from sessions: Stabilize approval row height during sticky scrolling #338210), with a comment explaining why.
  • sessionsList.test.ts: the four regression tests from sessions: Stabilize approval row height during sticky scrolling #338210 (compact and normal layout, 1-line and 3-line approvals). They use the real EditorMarkdownCodeBlockRenderer, so the code block fills asynchronously as in the product, and scroll the expanded session through the sticky header three times while checking that the row height stays constant.
  • Merge resolution (2906c3046c0): keeps one line-height declaration with the longer comment, keeps main's listService import, and drops my earlier single-case test, which their tests cover.

Validation

Run on the merged branch, rebased on main e7789ad24ce, on macOS Electron:

  • ./scripts/test.sh --run src/vs/sessions/contrib/sessions/test/browser/sessionsList.test.ts --grep "approval height bounded": all 4 fail without the CSS line (compact 1-line row 62px → 224px, 3-line row 98px → 312px), all 4 pass with it.
  • ./scripts/test.sh --run src/vs/sessions/contrib/sessions/test/browser/sessionsList.test.ts: passed (247 passing).
  • npm run typecheck-client: passed.
  • npm run eslint -- src/vs/sessions/contrib/sessions/test/browser/sessionsList.test.ts: passed.
  • npm run stylelint: passed (no findings on changed lines).
  • Pre-commit hygiene: passed.

How to test

  1. In the Agents window (compact sessions list, sticky scroll on), have a session with several chats and a pending approval on its main chat, and expand it.
  2. Scroll the list so the session row becomes the sticky header, then scroll back up a few times.
  3. The session row keeps its normal height (title plus one approval line) instead of growing into a large empty block.

RKS (rksharma-owg) and others added 3 commits September 27, 2026 12:28
The approval row inherited the list row's line-height, which ListView sets to the full row height. Its code-block label is filled in asynchronously, so a freshly rendered sticky copy measured the placeholder text with that line-height. Sticky scroll never shrinks the source row, so each re-render grew the session row by roughly one more line.

Pin the approval row's line-height to the 18px that getApprovalRowHeight already assumes, matching the CI and input-needed rows, and add a regression test.

Fixes #338189

Co-authored-by: Copilot <[email protected]>
Copilot AI balanced review requested due to automatic review settings October 18, 2026 13:04

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.

🟢 Approval recommended

The focused fix matches existing sizing assumptions, includes regression coverage, and has no unresolved findings.

No open issues 🎉

What changed in this PR

Prevents pending approvals from inflating sticky session rows in the Agents window, addressing #338189.

Changes:

  • Sets approval line-height to 18px to prevent inherited row-height feedback.
  • Adds a regression test using asynchronous code-block rendering and sticky scrolling.
File Description
src/​vs/​sessions/​contrib/​sessions/​test/​browser/​sessionsList.test.ts Tests that sticky approvals preserve session row height.
src/​vs/​sessions/​contrib/​sessions/​browser/​media/​sessionsList.css Resets approval line-height and explains the measurement issue.

Review effort: Balanced

…scrolling)

Merge rksharma-owg's head 8c82d12 so their commits land with this fix.

Conflict resolution: keep a single line-height declaration on .session-approval-row with the more detailed comment, keep main's listService import, and use their four sticky-scroll regression tests in place of the narrower single-case test, which they cover.

Co-authored-by: rksharma-owg <[email protected]>
Co-authored-by: Copilot <[email protected]>
@alexdima
Alexandru Dima (alexdima) marked this pull request as ready for review October 18, 2026 13:23
@alexdima
Alexandru Dima (alexdima) merged commit 2de8dcf into main Oct 18, 2026
49 checks passed
@alexdima
Alexandru Dima (alexdima) deleted the alexdima/sessions-sticky-approval-row-height branch October 18, 2026 13:32
@vs-code-engineering vs-code-engineering Bot added this to the 1.143.0 milestone Oct 18, 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.

Agents: multiline approval row grows to thousands of pixels during sticky scrolling

4 participants