perf(ui): defer diff parsing until tool cards expand - #14011
Merged
Conversation
Contributor
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Files Reviewed (3 files)
Reviewed by grok-4.6 · Input: 192.5K · Output: 14.5K · Cached: 383.4K Review guidance: REVIEW.md from base branch |
marius-kilocode
enabled auto-merge
September 10, 2026 12:44
WebReflection
approved these changes
Sep 10, 2026
This was referenced Sep 11, 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
Expanding an
edit,write, orapply_patchtool card is the most expensive tool-card render in the transcript: each card parses its patch with Pierre and renders a shadow-DOM diff. These cards also did work while collapsed, so a transcript with many of them paid parse cost before the user opened anything.Why This Change Was Made
Two causes:
editandwritebuilt their diff view withcreateMemo. Solid evaluates a memo eagerly on render, and the always-rendered trigger read it to decide whether to show "Open in Diff Viewer". The patch was therefore parsed even when the card stayed collapsed. Theapply_patchtrigger parsed every file the same way. These are now cheap presence and@@checks, and the view is only parsed when the body mounts or the viewer opens.finallyso a throwing body cannot stall later mounts.User Impact
edit,write, andapply_patchcards no longer parse patches, so a transcript with many collapsed diff cards does less work.edit,write, andapply_patch.Evidence
Storybook harness (20-card transcript, 420x720, Chromium, 7 loads per arm, paired before/after):
editwriteapply_patchCollapsed Pierre parses in the same harness:
edit1 to 0,write1 to 0,apply_patch2 to 0.Real VS Code (isolated Extension Development Host, Agent Manager, 20-card sessions, instrumented
normalize):diffs-containerin both arms.ScriptDuration0.1556s to 0.1436s (-7.7%), transientNodes1052 to 314 (-70%).edit,write, andapply_patchrender identically, and "Open in Diff Viewer" opens the preview.Checks:
bun run typecheckandbun run lintinpackages/kilo-vscode; the opencode annotation checker passes.Limitations