Skip to content

fix(agent-manager): improve inspector resize performance - #12948

Merged
marius-kilocode merged 1 commit into
mainfrom
improve-agent-manager-resize-performance
Aug 6, 2026
Merged

fix(agent-manager): improve inspector resize performance#12948
marius-kilocode merged 1 commit into
mainfrom
improve-agent-manager-resize-performance

Conversation

@marius-kilocode

Copy link
Copy Markdown
Collaborator

Problem

Resizing the Agent Manager inspector repeatedly committed layout changes while the diff viewer and mounted xterm instances reflowed. Large diffs and terminal scrollback could produce visible stalls during a drag.

Change

  • Limit inspector width commits to approximately 30 FPS while preserving the latest width for a trailing update.
  • Skip ResizeObserver-driven xterm refits for hidden terminal tabs. Hidden terminals refit when activated at their current dimensions.
  • Add regression coverage for both resize invariants.

Measured Improvement

Measured with the VS Code self-test profiler using the same 1.46-second divider drag, 90 synthetic pointer updates, and the same Agent Manager webview scenario. Diff and terminal runs were captured separately. The terminal scenario used 5,000 lines of scrollback.

Inline Diff Resize

Metric Before After Change
Total RunTask time 583.72 ms 395.38 ms -32.3%
Longest task 69.74 ms 14.60 ms -79.1%
Tasks over 16 ms 2 0 -100%
Tasks over 50 ms 1 0 -100%
UpdateLayoutTree 124.33 ms 77.60 ms -37.6%
Layout 40.86 ms 31.88 ms -22.0%
Paint 46.57 ms 32.40 ms -30.4%

Inline Terminal Resize

Metric Before After Change
Total RunTask time 480.59 ms 288.42 ms -40.0%
Longest task 7.65 ms 9.96 ms +30.3%
Tasks over 16 ms 0 0 unchanged
Tasks over 50 ms 0 0 unchanged
UpdateLayoutTree 53.99 ms 23.20 ms -57.0%
Layout 37.70 ms 22.80 ms -39.5%
Paint 27.16 ms 17.11 ms -37.0%
FunctionCall 103.13 ms 47.10 ms -54.3%

The terminal after-run longest task remained below 10 ms. The one-time post-build capture was discarded from the comparison because it included an unrelated outer VS Code terminal-panel height transition.

User-visible Result

  • Diff resizing no longer produces the measured long main-thread stalls.
  • Terminal scrollback remains responsive while the inspector is dragged.
  • Inactive terminal tabs avoid unnecessary scrollback reflow and still fit correctly when selected.

@kilo-code-bot

kilo-code-bot Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

lgtm. The resize throttle in resizeSide guarantees a trailing commit (the flush loop only exits after applying the latest pendingSideWidth), and the debounced persistLocalTabs effect observes the throttled signal, so the final width always persists. The hidden-terminal ResizeObserver skip is safely paired with the existing activation repaint path (createEffectscheduleRepaintrunRepaintfit.fit() + syncSize()), which refits at current dimensions on tab activation. No new listeners, timers, or unbounded rAF chains — no memory-leak concerns introduced. Regression tests follow the established source-invariant convention of the test file, and a user-facing changeset is included.

Files Reviewed (4 files)
  • .changeset/sync-inspector-width.md
  • packages/kilo-vscode/tests/unit/agent-manager-terminal-layout.test.ts
  • packages/kilo-vscode/webview-ui/agent-manager/AgentManagerApp.tsx
  • packages/kilo-vscode/webview-ui/agent-manager/terminal/TerminalTab.tsx

Reviewed by kimi-k3 · Input: 57.8K · Output: 11.4K · Cached: 405.5K

Review guidance: REVIEW.md from base branch main

@marius-kilocode
marius-kilocode merged commit 4d33f63 into main Aug 6, 2026
24 checks passed
@marius-kilocode
marius-kilocode deleted the improve-agent-manager-resize-performance branch August 6, 2026 12:29
t7tran pushed a commit to t7tran/kilocode that referenced this pull request Aug 14, 2026
…-resize-performance

fix(agent-manager): improve inspector resize performance
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