Skip to content

Conversation

@bpasero
Copy link
Member

@bpasero bpasero commented Jan 16, 2026

No description provided.

Copilot AI review requested due to automatic review settings January 16, 2026 13:51
@bpasero bpasero enabled auto-merge (squash) January 16, 2026 13:51
@bpasero bpasero self-assigned this Jan 16, 2026
@vs-code-engineering vs-code-engineering bot added this to the January 2026 milestone Jan 16, 2026
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

This PR fixes a rendering bug in the agent sessions view where the stacked sessions list doesn't properly adjust its height when context is added to the chat input.

Changes:

  • Added event listener to re-layout when chat widget content height changes in stacked mode
  • Introduced re-entrancy guard to prevent infinite layout loops
  • Updated calculation to account for actual input content height instead of just minimum height

Comment on lines +655 to +659
this._register(chatWidget.onDidChangeContentHeight(() => {
if (this.sessionsViewerOrientation === AgentSessionsViewerOrientation.Stacked && this.lastDimensions) {
this.layoutBody(this.lastDimensions.height, this.lastDimensions.width);
}
}));
Copy link

Copilot AI Jan 16, 2026

Choose a reason for hiding this comment

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

The onDidChangeContentHeight event fires frequently during content updates. This listener triggers a full layoutBody call every time, which could cause performance issues. Consider debouncing this event or checking if the height actually changed meaningfully before triggering a re-layout. You could use a RunOnceScheduler or check if the height delta exceeds a threshold before re-layouting.

Copilot uses AI. Check for mistakes.
let availableSessionsHeight = height - this.sessionsTitleContainer.offsetHeight - this.sessionsLinkContainer.offsetHeight;
if (this.sessionsViewerOrientation === AgentSessionsViewerOrientation.Stacked) {
availableSessionsHeight -= ChatViewPane.MIN_CHAT_WIDGET_HEIGHT; // always reserve some space for chat input
availableSessionsHeight -= Math.max(ChatViewPane.MIN_CHAT_WIDGET_HEIGHT, this._widget?.input?.contentHeight ?? 0);
Copy link

Copilot AI Jan 16, 2026

Choose a reason for hiding this comment

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

The fallback to 0 when this._widget?.input?.contentHeight is undefined means the calculation would use only MIN_CHAT_WIDGET_HEIGHT. However, if the widget or input doesn't exist, this should probably use MIN_CHAT_WIDGET_HEIGHT explicitly rather than relying on Math.max to select it. Consider making this logic more explicit: this._widget?.input?.contentHeight ?? ChatViewPane.MIN_CHAT_WIDGET_HEIGHT.

Suggested change
availableSessionsHeight -= Math.max(ChatViewPane.MIN_CHAT_WIDGET_HEIGHT, this._widget?.input?.contentHeight ?? 0);
availableSessionsHeight -= Math.max(ChatViewPane.MIN_CHAT_WIDGET_HEIGHT, this._widget?.input?.contentHeight ?? ChatViewPane.MIN_CHAT_WIDGET_HEIGHT);

Copilot uses AI. Check for mistakes.
@bpasero bpasero merged commit 5591cd2 into main Jan 16, 2026
27 of 28 checks passed
@bpasero bpasero deleted the ben/exotic-halibut branch January 16, 2026 14:09
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.

4 participants