fix(vscode): deduplicate sync event delivery - #13410
Merged
Merged
Conversation
Contributor
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Files Reviewed (4 files)
Reviewed by grok-4.6 · Input: 78.8K · Output: 13.3K · Cached: 588.4K Review guidance: REVIEW.md from base branch |
marius-kilocode
enabled auto-merge
August 25, 2026 10:23
iscekic
approved these changes
Aug 25, 2026
iscekic
left a comment
Collaborator
There was a problem hiding this comment.
Approved, bot remarks below, feel free to ignore
Collaborator
Author
|
Following up in 12417 @iscekic |
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
When multiple sessions stream concurrently, the shared VS Code connection receives two representations of several events: the normal live event and a compatibility
syncenvelope with the same event ID. Both representations currently reach every registered provider. This duplicates session resolution, event mapping, stream scheduling, and webview update work across the Kilo sidebar, editor tabs, and Agent Manager.The duplication is especially costly during high-rate
message.part.updatedstreaming. It increases extension-host and webview work even though the second representation carries no new information for those event types.Why This Change Was Made
The connection now records the IDs of recently delivered live events and drops only a matching compatibility envelope that follows the live event. The filter is bounded to 1,024 IDs. It does not use time-based cleanup or scan the set on every event.
The filter intentionally preserves compatibility events that may contain information not present in the normal event path:
message.updated,message.removedsyncenvelopemessage.part.updated,message.part.removedsyncenvelopesession.created,session.deletedsyncenvelopesession.updatedsyncenvelope for reconciliation sequence metadatasynceventsThis is a VS Code client optimization only. It does not change the CLI server, database persistence, network delivery, or replay APIs.
User Impact
Users running multiple concurrent sessions should see less duplicate processing in the VS Code extension. Normal live updates, replay-only events, session reconciliation, and existing UI behavior remain available. The change applies to all VS Code clients using the shared connection service, including the sidebar, editor tabs, and Agent Manager.
Evidence
The same synthetic workload was run through the real
SdkSSEAdapterpath with 5,000,000 wire events, 11 sessions, and 8 downstream listeners.The full SSE path is dominated by parsing and heartbeat timer work, so the end-to-end CPU reduction is smaller than the downstream reduction. The measurement proves that duplicate downstream dispatch is removed; it does not claim a reduction in CLI server CPU or total device CPU.
session.updatedreconciliation behavior