fix(vscode): restore chat turn spacing broken by virtualizer (#9141)

The prior spacing fix (#9025) relied on flex `gap` on `.message-list-content`,
but #8911 introduced virtua's `Virtualizer` which positions items absolutely
based on measured box size — so `gap` no longer applies between turns. The
missing spacing was most visible when the last assistant part was a sub-agent's
expanded task tool (two bordered boxes with 0px between them). Bake the 12px
into each turn's own padding so virtua measures it as part of the item height.
This commit is contained in:
Marius
2026-04-20 10:29:50 +03:00
committed by GitHub
parent 42922b65d2
commit 61ec925c50
5 changed files with 120 additions and 3 deletions
+5
View File
@@ -0,0 +1,5 @@
---
"kilo-code": patch
---
Restore spacing between sub-agent output and the following user message in the VS Code chat.
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:54c85aa9565b91d2a1f848e02d2b21883dc05cb57df92fd359df83c207995455
size 10247
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:b57a543bd799f92b35d2c6037a4ffc932a37f59790213006a021bebef9e94b38
size 6897
oid sha256:4cb00b7e8e69e0e8d8c975b4ae119ebfcdea955247d0223dead873356044d1a2
size 6940
@@ -325,6 +325,110 @@ export const MessageListToolToQueuedUserSpacing: Story = {
},
}
// ---------------------------------------------------------------------------
// MessageList — sub-agent (task tool) to queued user spacing
// Verifies the same vertical gap applies when the last assistant part is a
// sub-agent's expanded task tool, not just a regular tool like bash.
// ---------------------------------------------------------------------------
const subUserID = "user-msg-subagent-spacing-001"
const subAssistantID = "asst-msg-subagent-spacing-001"
const subQueuedUserID = "user-msg-subagent-spacing-002"
const subChildSessionID = "story-session-child-subagent-001"
const subNow = 1_700_000_100_000
const subagentSpacingMessages = [
{
id: subUserID,
sessionID: SESSION_ID,
role: "user",
time: { created: subNow - 9000 },
},
{
id: subAssistantID,
sessionID: SESSION_ID,
role: "assistant",
parentID: subUserID,
time: { created: subNow - 8000 },
modelID: "claude-sonnet-4-20250514",
providerID: "anthropic",
mode: "default",
agent: "default",
path: { cwd: "/project", root: "/project" },
},
{
id: subQueuedUserID,
sessionID: SESSION_ID,
role: "user",
time: { created: subNow - 1000 },
},
]
const subagentSpacingParts = {
[subUserID]: [
{
id: "part-user-subagent-spacing-001",
sessionID: SESSION_ID,
messageID: subUserID,
type: "text",
text: "Delegate a search to a sub-agent so I can test the spacing.",
},
],
[subAssistantID]: [
{
id: "part-task-subagent-spacing-001",
sessionID: SESSION_ID,
messageID: subAssistantID,
type: "tool",
callID: "call-task-subagent-spacing-001",
tool: "task",
state: {
status: "completed",
input: { description: "Find auth usage", subagent_type: "explore" },
output: "done",
title: "Find auth usage",
metadata: { sessionId: subChildSessionID },
time: { start: subNow - 7000, end: subNow - 6500 },
},
},
],
[subQueuedUserID]: [
{
id: "part-user-subagent-spacing-002",
sessionID: SESSION_ID,
messageID: subQueuedUserID,
type: "text",
text: "continue",
},
],
}
const subagentSpacingData = {
...defaultMockData,
message: {
[SESSION_ID]: subagentSpacingMessages,
[subChildSessionID]: [],
},
part: subagentSpacingParts,
}
export const MessageListSubagentToQueuedUserSpacing: Story = {
name: "MessageList — sub-agent to queued user spacing",
render: () => {
const session = {
...mockSessionValue({ id: SESSION_ID, status: "idle" }),
messages: () => subagentSpacingMessages,
userMessages: () => subagentSpacingMessages.filter((msg) => msg.role === "user"),
}
return (
<StoryProviders data={subagentSpacingData} sessionID={SESSION_ID} status="idle" noPadding>
<SessionContext.Provider value={session as any}>
<div style={{ height: "420px", display: "flex", "flex-direction": "column" }}>
<MessageList />
</div>
</SessionContext.Provider>
</StoryProviders>
)
},
}
// ---------------------------------------------------------------------------
// TaskHeader with todos
// ---------------------------------------------------------------------------
@@ -178,13 +178,18 @@
VscodeSessionTurn layout
============================================ */
/* Virtua positions turns absolutely based on measured box size, so flex `gap`
on `.message-list-content` can't add spacing between turns. Bake the gap
into the turn's own padding — it's included in the measured height and so
shows up as spacing between turns (e.g. tool output to queued user message,
including sub-agent task tools which expand inline). */
.vscode-session-turn {
display: flex;
flex-direction: column;
gap: 12px;
width: 100%;
min-width: 0;
padding: 0 4px;
padding: 0 4px 12px;
}
.vscode-session-turn-user {