Skip to content

perf(vscode): defer Agent Manager terminal addons - #12842

Merged
marius-kilocode merged 2 commits into
mainfrom
optimize-terminal-startup-speed
Aug 4, 2026
Merged

perf(vscode): defer Agent Manager terminal addons#12842
marius-kilocode merged 2 commits into
mainfrom
optimize-terminal-startup-speed

Conversation

@marius-kilocode

Copy link
Copy Markdown
Collaborator

The first Agent Manager terminal currently performs xterm addon initialization before the terminal can open its host or attach the shell WebSocket. This makes the first prompt wait on optional URL-link, OSC 52 clipboard, and Unicode grapheme setup.\n\nOpen and connect the xterm first, then defer those optional enhancements until after the first rendered frame. Deferred work is cancelled during terminal cleanup, and the enhancements remain enabled for normal terminal use after initialization.\n\nThis keeps the first prompt path focused on terminal creation and shell attachment while preserving the existing terminal features.

Comment thread packages/kilo-vscode/webview-ui/agent-manager/terminal/TerminalTab.tsx Outdated
@kilo-code-bot

kilo-code-bot Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

The previous suggestion (rename the shadowed next rAF handle) is resolved in 6bbbb5d — the handle is now deferred at all four sites (declaration, loadAddons reset, scheduling, and onCleanup cancellation), and the WebSocket local in open() is the only remaining next binding. The deferral logic is unchanged: both rAF handles are cancelled in onCleanup and the closed guard prevents loading addons into a disposed terminal, so no leak or use-after-dispose is introduced.

Files Reviewed (2 files)
  • .changeset/faster-agent-manager-terminal.md
  • packages/kilo-vscode/webview-ui/agent-manager/terminal/TerminalTab.tsx
Previous Review Summary (commit 2613ff9)

Current summary above is authoritative. Previous snapshots are kept for context only.

Previous review (commit 2613ff9)

Status: 1 Issue Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 0
SUGGESTION 1
Issue Details (click to expand)

SUGGESTION

File Line Issue
packages/kilo-vscode/webview-ui/agent-manager/terminal/TerminalTab.tsx 203 Outer let next rAF handle is shadowed by the WebSocket const next inside open() — rename for clarity

The deferral itself looks correct: the double requestAnimationFrame runs addon setup after the first painted frame, both handles are cancelled in onCleanup, and the closed guard prevents loading addons into a disposed terminal, so no leak or use-after-dispose is introduced. WebLinksAddon registers a hover-time link provider, so output written before the deferral still gets linkified. The changeset is present and user-facing.

Files Reviewed (2 files)
  • .changeset/faster-agent-manager-terminal.md - 0 issues
  • packages/kilo-vscode/webview-ui/agent-manager/terminal/TerminalTab.tsx - 1 issue

Fix these issues in Kilo Cloud


Reviewed by kimi-k3 · Input: 71.9K · Output: 4.4K · Cached: 234.4K

Review guidance: REVIEW.md from base branch main

@marius-kilocode
marius-kilocode merged commit ca6cf33 into main Aug 4, 2026
24 checks passed
@marius-kilocode
marius-kilocode deleted the optimize-terminal-startup-speed branch August 4, 2026 08:33
LudwigSolutionsAI pushed a commit to LudwigSolutionsAI/kilocode that referenced this pull request Aug 6, 2026
t7tran pushed a commit to t7tran/kilocode that referenced this pull request Aug 14, 2026
t7tran pushed a commit to t7tran/kilocode that referenced this pull request Aug 14, 2026
…rtup-speed

perf(vscode): defer Agent Manager terminal addons
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