fix(agent-manager): remove unsafe WebGL terminal renderer - #13413
Merged
Conversation
Contributor
Code Review SummaryStatus: 1 Issue Found | Recommendation: Address before merge Overview
Issue Details (click to expand)WARNING
Files Reviewed (6 files)
Fix these issues in Kilo Cloud Previous Review Summary (commit db40b6d)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit db40b6d)Status: 3 Issues Found | Recommendation: Address before merge Overview
Issue Details (click to expand)WARNING
SUGGESTION
Files Reviewed (13 files)
Reviewed by grok-4.6 · Input: 170K · Output: 17.4K · Cached: 710.1K Review guidance: REVIEW.md from base branch |
marius-kilocode
enabled auto-merge
August 25, 2026 11:40
WebReflection
approved these changes
Aug 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What Problem This Solves
Agent Manager mounted one WebGL renderer for every terminal, including terminals hidden in inactive tabs. Chromium limits the number of live WebGL contexts in a document. The pinned xterm WebGL addon also has known context-disposal and shared glyph-atlas reliability problems. With enough concurrent terminals, or after repeated terminal creation and disposal, a visible terminal could lose its renderer or display stale and corrupted glyphs.
This is especially risky in Agent Manager because terminal instances remain mounted so they can continue receiving PTY output while users switch tabs.
Why This Change Was Made
Agent Manager terminals now use xterm’s DOM renderer instead of allocating one scarce WebGL context per mounted terminal. This removes the browser-level context exhaustion and xterm WebGL atlas risks while preserving the other performance improvements from the original change:
The scope was intentionally reduced after review. No shared PTY, server, CLI, transport-protocol, or bun-pty changes are included. No new
kilocode_changemarkers are required.User Impact
Users can run many Agent Manager terminals concurrently without consuming one WebGL context per terminal. Switching between terminals continues to preserve each terminal’s output and buffer. Opening and closing History does not recreate the existing terminal instances. The tradeoff is that terminal rendering uses the DOM path rather than WebGL; this favors predictable behavior and correctness over the unsafe GPU optimization.
Review Follow-up
Automated review identified three issues. The hidden History stack originally covered the tab bar and could change the terminal height; its bounds now start below the 36px tab bar. Replay overflow could leave buffered keystrokes available to a later reconnect; failed replay now clears the input buffer and closes the connection. The changeset now describes the user-facing WebGL stability fix rather than only the batching change.
There are no unresolved review threads. The bot summary is a non-thread issue comment, so GitHub does not expose a resolve action for it. No reply was posted.
Evidence
Local validation passed for the extension typecheck, lint, Knip, compile, focused terminal tests, conflict-marker check, and formatting checks. GitHub CI passed, including TypeScript analysis, unit tests, source-link validation, visual regression tests, and Kilo Code Review.
The isolated VS Code stress test created 20 simultaneously mounted terminals, streamed 10,000 verified output lines through each terminal, and cycled through the terminal tabs. All 200,000 lines were received without xterm discard errors or terminal-specific console errors. The same test opened and closed History while the terminals were alive and confirmed that the terminal DOM instances were preserved. The final renderer inventory showed 20 DOM renderers and zero WebGL canvases.
The implementation is limited to Agent Manager and dependency metadata. It does not change PTY transport behavior for other clients.