Skip to content

fix(vscode): speed up subagent transcript loading - #11104

Merged
marius-kilocode merged 1 commit into
mainfrom
flicker-hockey
Jun 12, 2026
Merged

fix(vscode): speed up subagent transcript loading#11104
marius-kilocode merged 1 commit into
mainfrom
flicker-hockey

Conversation

@marius-kilocode

Copy link
Copy Markdown
Collaborator

Subagent tabs waited for session metadata and the entire transcript before navigating, so long-running child sessions felt slow to open. The initial snapshot also discarded buffered SSE updates received during the fetch, which could leave a reasoning part empty when reasoning completed in that window.

Track child sessions before panel initialization, navigate as soon as the webview is ready, and load metadata concurrently. Subagent transcripts now use the same paginated loading path and row virtualizer as normal sessions, while buffered live updates are applied after the initial snapshot so completed reasoning remains visible.

Benchmark

Cold editor-tab opens of the same real 253-message Explore subagent, comparing the pre-fix commit with this branch using matched debug bundles and a warmed backend:

Metric Before After Change
Transcript ready 1,365 ms 1,298 ms 4.9% faster
Trace duration 1,541 ms 1,478 ms 4.1% faster
Long tasks 4 2 50% fewer
Long-task time 596 ms 482 ms 19.1% lower
Script time 2,713 ms 2,570 ms 5.2% lower
Layout time 72.7 ms 61.5 ms 15.5% lower
Paint time 63.3 ms 54.0 ms 14.8% lower

The previous path loaded all 253 messages immediately. The new path loaded the bounded latest page and exposed older history through normal pagination; both settled with one mounted transcript row at the measured viewport.

Paginate child histories and preserve reasoning updates that arrive while their initial transcript loads.
@kilo-code-bot

kilo-code-bot Bot commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

The changes are well-structured and the logic is sound. Key design decisions reviewed:

  • preserveStream flag (KiloProvider.ts:1538): Correctly skips streams.drop() for the sub-agent viewer so buffered SSE updates (reasoning completions arriving during the snapshot fetch) are not discarded.
  • streams.flush() ordering (KiloProvider.ts:1549): Flushing buffered updates after messagesLoaded preserves correct delivery order — snapshot first, then live deltas. This is exactly right.
  • trackSession before resolveWebviewPanel (SubAgentViewerProvider.ts:47): Starting SSE event accumulation before the panel subscribes closes the race where reasoning deltas arrived before the viewer was ready.
  • try/catch in SubAgentViewerProvider.ts:59-69: The outer try legitimately guards the synchronous getClient() throw (which occurs when not connected); async rejections from the .get() promise are covered by the .catch() chain. Both legs log the same message, which is intentional.
  • registerSession side-effects: stopCurrentSessionProcesses inside registerSession is a no-op for a freshly created KiloProvider instance (no prior contextSessionID/currentSession), so the async metadata fetch racing with the initial load is safe.
  • Pagination trade-off: Switching from limit: 0 to paginated loading for sub-agent transcripts is an intentional change well-justified by the benchmark. Long histories now use normal pagination rather than a single unbounded fetch.
Files Reviewed (5 files)
  • .changeset/quick-subagent-transcripts.md
  • packages/kilo-vscode/src/KiloProvider.ts
  • packages/kilo-vscode/src/SubAgentViewerProvider.ts
  • packages/kilo-vscode/src/kilo-provider/message-page.ts
  • packages/kilo-vscode/tests/unit/kilo-provider-load-messages.test.ts

Reviewed by claude-sonnet-4.6 · 1,112,151 tokens

Review guidance: REVIEW.md from base branch main

@marius-kilocode
marius-kilocode merged commit 0d026ef into main Jun 12, 2026
21 checks passed
@marius-kilocode
marius-kilocode deleted the flicker-hockey branch June 12, 2026 09:52
t7tran pushed a commit to t7tran/kilocode that referenced this pull request Aug 14, 2026
fix(vscode): speed up subagent transcript loading
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.

2 participants