Skip to content

fix(vscode): bound sync filter state - #13417

Merged
marius-kilocode merged 2 commits into
mainfrom
fix-vscode-sync-filter-lifecycle
Aug 25, 2026
Merged

fix(vscode): bound sync filter state#13417
marius-kilocode merged 2 commits into
mainfrom
fix-vscode-sync-filter-lifecycle

Conversation

@marius-kilocode

@marius-kilocode marius-kilocode commented Aug 25, 2026

Copy link
Copy Markdown
Collaborator

What Problem This Solves

The shared VS Code connection receives both normal live events and compatibility sync envelopes for several session, message, and message-part events. PR #13410 suppresses a matching sync envelope after the same live event has been delivered.

The first follow-up implementation introduced two edge cases in that tracking state:

  • It could stop recording new live event IDs after the tracking set reached its cap, so duplicate suppression stopped during sustained event bursts.
  • The tracking state needed to be scoped to one SSE connection so IDs from a previous connection could not affect a reconnect.

Why This Change Was Made

Use a bounded sliding window for recently delivered live event IDs. When the 1,024-entry cap is reached, the oldest ID is evicted and the new live ID is tracked. Promptly arriving compatibility envelopes continue to be deduplicated. If an envelope arrives after its live ID has left the bounded window, it is forwarded instead of being incorrectly suppressed.

Create the filter inside doConnect() so each SdkSSEAdapter connection has independent state. Reconnects and server restarts cannot reuse stale IDs.

User Impact

The duplicate-event optimization continues to reduce downstream processing across the VS Code sidebar, editor tabs, and Agent Manager. Delayed or replay-only compatibility events remain deliverable, and reconnects do not carry stale deduplication state.

Event scenario Behavior
Matching live event and prompt sync envelope Suppress the duplicate envelope
Matching envelope after the 1,024-entry window Forward the envelope
Replay-only sync event Forward the event
Event ID from an earlier SSE connection Do not reuse the ID
session.updated reconciliation envelope Preserve the envelope

Evidence

Validation Result
Focused event regression tests 88 passed
Sliding-window overflow behavior Covered
Delayed envelope behavior Covered
Connection lifecycle isolation Covered
VS Code typecheck Passed
VS Code lint Passed
CI Green

@kilo-code-bot

kilo-code-bot Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (4 files)
  • .changeset/fix-sync-filter-lifecycle.md
  • packages/kilo-vscode/src/services/cli-backend/connection-service.ts
  • packages/kilo-vscode/src/services/cli-backend/connection-utils.ts
  • packages/kilo-vscode/tests/unit/connection-utils.test.ts
Previous Review Summary (commit 45695e6)

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

Previous review (commit 45695e6)

Status: No Issues Found | Recommendation: Merge

Files Reviewed (4 files)
  • .changeset/fix-sync-filter-lifecycle.md
  • packages/kilo-vscode/src/services/cli-backend/connection-service.ts
  • packages/kilo-vscode/src/services/cli-backend/connection-utils.ts
  • packages/kilo-vscode/tests/unit/connection-utils.test.ts

Reviewed by grok-4.6 · Input: 106.4K · Output: 8.4K · Cached: 154.9K

Review guidance: REVIEW.md from base branch main

@iscekic iscekic left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved, ignorable bot remarks below

Comment thread packages/kilo-vscode/src/services/cli-backend/connection-utils.ts Outdated
@marius-kilocode
marius-kilocode merged commit 526acce into main Aug 25, 2026
24 checks passed
@marius-kilocode
marius-kilocode deleted the fix-vscode-sync-filter-lifecycle branch August 25, 2026 14:34
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