Skip to content

fix(vscode): speed up snapshot installs and isolate project state - #12871

Merged
marius-kilocode merged 4 commits into
mainfrom
optimize-snapshot-install-parallelism
Aug 6, 2026
Merged

fix(vscode): speed up snapshot installs and isolate project state#12871
marius-kilocode merged 4 commits into
mainfrom
optimize-snapshot-install-parallelism

Conversation

@marius-kilocode

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

Copy link
Copy Markdown
Collaborator

Problem

Local bun run snapshot:install runs a full SDK generation and CLI build on every invocation, serializes extension validation, compresses a large local-install VSIX, and clears the cached CLI binary. This makes the normal edit-install-test loop dominated by work that is unchanged between runs. Agent Manager project switching also allowed session events, session listings, and Git status to cross project boundaries or become stale after asynchronous refreshes.

Changes

  • Reuse the existing fingerprinted SDK preparation path for snapshot builds.
  • Add content-based CLI freshness detection derived from the workspace dependency graph, patches, untracked files, build environment, target platform, and compiled/wrapper artifact kind.
  • Preserve and reuse a validated compiled CLI for unchanged snapshot inputs while refusing wrapper or wrong-target artifacts for snapshots.
  • Keep extension typechecks, webview typechecks, lint, and production bundling on the parallel build-check path.
  • Use stored ZIP entries only for local snapshot installation, while keeping shareable snapshot:build VSIX files normally compressed.
  • Preserve CLI and helper caches across snapshots under excluded node_modules cache files, with target-specific FFmpeg reuse.
  • Scope Agent Manager event handling, session refreshes, and Git status to the active project and nested repository; ignore stale asynchronous refresh results and ambiguous raw session IDs.
  • Reset Git polling state when the active repository changes.
  • Keep CLI source hashing graceful when Git metadata is unavailable and gate Git refreshes on completed tool parts.

Performance

The baseline was captured before the snapshot changes on the same worktree and machine. The cache-invalidating run rebuilds the CLI; the warm run reuses the compiled CLI and SDK outputs.

Scenario Result Comparison
Baseline bun run snapshot:install 59.22s Original implementation
Final cache-invalidating bun run snapshot:install 24.37s 58.8% faster, 2.4x faster
Final warm bun run snapshot:install 10.77s 81.8% faster, 5.5x faster
Final local-install VSIX 361.89 MB, all entries Stored No compression for faster packaging/extraction
Final shareable bun run snapshot:build Passed, 117.92 MB VSIX Normal compression retained

The warm path is sensitive to host load because production bundling and VSIX packaging are CPU and I/O heavy. Earlier warm samples ranged from approximately 11.9s to 29.2s under contention; the final committed-code warm run above completed successfully.

Validation

Check Result
bun run test:unit Passed, 3,716 tests, 0 failures, 16,087 assertions
Focused provider tests after review fixes Passed, 12 tests, 0 failures
bun run typecheck Passed, extension and webview typechecks
bun run lint Passed
bun run knip Passed
bun run check-kilocode-change Passed
Prettier check on all changed TypeScript files Passed
Cache-invalidating bun run snapshot:install Passed, CLI rebuilt, VSIX packaged, installed into VS Code
Warm bun run snapshot:install Passed, cached CLI reused, VSIX packaged, installed into VS Code
bun run snapshot:build Passed, normally compressed shareable VSIX produced
VSIX unzip -t integrity check Passed
VSIX compression inspection with unzip -v Passed, local install entries reported Stored
Cache marker inspection Passed, markers absent from VSIX and restored under node_modules
Installed extension version check Passed, snapshot version matched the generated VSIX
CLI smoke tests during rebuild Passed, version, models snapshot, and sandbox worker checks

The review fixes address global lifecycle/config event delivery, stale session payloads, cross-project session directories, repository-switch Git polling, ambiguous session IDs, target-specific FFmpeg cache reuse, completion-gated Git refreshes, no-Git source hashing, and reliable local VSIX storage mode.

Comment thread packages/kilo-vscode/src/KiloProvider.ts Outdated
Comment thread packages/kilo-vscode/script/dev-snapshot.ts Outdated
Comment thread packages/kilo-vscode/src/KiloProvider.ts
Comment thread packages/kilo-vscode/script/local-bin.ts Outdated
@kilo-code-bot

kilo-code-bot Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

All 4 previous findings were addressed in the latest commits: the project-directory guard now exempts "global" events (KiloProvider.ts:4319), the VSIX no-compression path now patches yazl's addFile/addBuffer directly instead of the no-op zlib.DeflateRaw export, Git refreshes are gated on completed tool parts (KiloProvider.ts:4776), and CLI source hashing degrades gracefully when Git metadata is unavailable. Incremental review of the 6 changed files found no new issues.

Files Reviewed (6 files)
  • packages/kilo-vscode/.vscodeignore
  • packages/kilo-vscode/script/dev-snapshot.ts
  • packages/kilo-vscode/script/ffmpeg-helper.ts
  • packages/kilo-vscode/script/local-bin.ts
  • packages/kilo-vscode/src/KiloProvider.ts
  • packages/kilo-vscode/tests/unit/kilo-provider-followup.test.ts
Previous Review Summary (commit 5a95577)

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

Previous review (commit 5a95577)

Status: 4 Issues Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 2
SUGGESTION 2
Issue Details (click to expand)

WARNING

File Line Issue
packages/kilo-vscode/src/KiloProvider.ts 4319 New directory guard drops directory === "global" events (global.disposed / global.config.updated) for project-scoped panels, so auth-change reload and config refresh never run there
packages/kilo-vscode/script/dev-snapshot.ts 53 DeflateRaw monkey-patch likely doesn't engage — vsce/yazl compress via createDeflateRaw/deflateRaw, which bypass the patched export; verify VSIX entries are actually stored uncompressed

SUGGESTION

File Line Issue
packages/kilo-vscode/src/KiloProvider.ts 4381 refreshGitStatusFromPart fires on every tool part update (including pre-completion states), issuing an HTTP call + git subprocess each time; consider gating on completed state or skipping dirs already inside the cached git root
packages/kilo-vscode/script/local-bin.ts 111 Git failures (no .git, unborn HEAD) now abort the script; the old hash path degraded gracefully — consider catching and treating input as unknown
Files Reviewed (15 files)
  • .changeset/fix-multi-project-session-scope.md - no issues
  • packages/kilo-vscode/.vscodeignore - no issues
  • packages/kilo-vscode/script/dev-snapshot.ts - 1 issue
  • packages/kilo-vscode/script/ffmpeg-helper.ts - no issues
  • packages/kilo-vscode/script/local-bin.ts - 1 issue
  • packages/kilo-vscode/src/KiloProvider.ts - 2 issues
  • packages/kilo-vscode/src/agent-manager/AgentManagerProvider.ts - no issues
  • packages/kilo-vscode/src/agent-manager/GitOps.ts - no issues
  • packages/kilo-vscode/src/agent-manager/host.ts - no issues
  • packages/kilo-vscode/src/agent-manager/vscode-host.ts - no issues
  • packages/kilo-vscode/src/kilo-provider-utils.ts - no issues
  • packages/kilo-vscode/src/kilo-provider/git-status.ts - no issues
  • packages/kilo-vscode/tests/unit/git-ops.test.ts - no issues
  • packages/kilo-vscode/tests/unit/kilo-provider-followup.test.ts - no issues
  • packages/kilo-vscode/tests/unit/kilo-provider-session-refresh.test.ts - no issues

Fix these issues in Kilo Cloud


Reviewed by kimi-k3 · Input: 216K · Output: 18.4K · Cached: 913.1K

Review guidance: REVIEW.md from base branch main

…tall-parallelism

# Conflicts:
#	.changeset/fix-multi-project-session-scope.md
#	packages/kilo-vscode/src/KiloProvider.ts
#	packages/kilo-vscode/tests/unit/kilo-provider-followup.test.ts
@marius-kilocode
marius-kilocode merged commit bc8d9c9 into main Aug 6, 2026
23 checks passed
@marius-kilocode
marius-kilocode deleted the optimize-snapshot-install-parallelism branch August 6, 2026 07:59
t7tran pushed a commit to t7tran/kilocode that referenced this pull request Aug 14, 2026
…tall-parallelism

fix(vscode): speed up snapshot installs and isolate project state
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