Skip to content

fix(vscode): reduce Agent Manager Git polling load - #12924

Merged
marius-kilocode merged 3 commits into
mainfrom
past-eustoma
Aug 6, 2026
Merged

fix(vscode): reduce Agent Manager Git polling load#12924
marius-kilocode merged 3 commits into
mainfrom
past-eustoma

Conversation

@marius-kilocode

Copy link
Copy Markdown
Collaborator

Agent Manager recomputed complete diff and ahead/behind statistics for every managed worktree on each visible poll. With many worktrees, this created repeated Git processes, filesystem scans, and endpoint-security work even when repositories were unchanged.

This change introduces status-based fingerprints, cached exact aggregate results, one shared ref snapshot per project poll, and priority timer polling. Dirty, selected, busy, and new worktrees retain five-second freshness, while clean dormant worktrees rotate within 30 seconds. Forced refreshes remain immediate and unsharded. The implementation keeps exact aggregate semantics and leaves review/detail diff behavior separate.

Comment thread packages/kilo-vscode/src/agent-manager/git-stats-snapshot.ts Outdated
Comment thread packages/kilo-vscode/src/agent-manager/project/pollers.ts Outdated
Comment thread packages/kilo-vscode/src/agent-manager/AgentManagerProvider.ts
Comment thread plans/agent-manager-git-poller-remaining.md Outdated
@kilo-code-bot

kilo-code-bot Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (5 files, incremental)
  • packages/kilo-vscode/src/agent-manager/AgentManagerProvider.ts
  • packages/kilo-vscode/src/agent-manager/git-stats-snapshot.ts
  • packages/kilo-vscode/src/agent-manager/project/pollers.ts
  • packages/kilo-vscode/tests/unit/git-stats-snapshot.test.ts
  • plans/agent-manager-git-poller-remaining.md

Notes: incremental review of b521829..26ce2af. All 4 previous findings are addressed: unmerged (u) records now tolerate absent paths (with a regression test; present conflicted files are still stat-fingerprinted, so conflict-resolution edits still invalidate the cache), the provider's full hot set is threaded into background-project pollers and busy sessions resolve through their owning context, session.error now clears stale busySessions entries (idle/delete/error/panel-close/project-switch cleanup paths all verified), and the handoff doc now reads merge-ready with external follow-ups explicitly tracked. No new issues found; no memory-leak concerns in the changed code (no new subscriptions/timers, busy set only shrinks).

Previous Review Summary (commit b521829)

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

Previous review (commit b521829)

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/agent-manager/git-stats-snapshot.ts 87 Unmerged (u) porcelain records hardcode missing: false; conflicted paths absent from the worktree (e.g. delete/delete conflicts) make status() throw every poll, permanently freezing that worktree's stats at last-known values with misleading log spam
packages/kilo-vscode/src/agent-manager/project/pollers.ts 62 Expanded background-project pollers only treat the active target as hot — running/busy sessions in those projects are not included, so clean worktrees there fall to the 30s dormant rotation, contradicting the PR's "busy worktrees retain five-second freshness" claim

SUGGESTION

File Line Issue
packages/kilo-vscode/src/agent-manager/AgentManagerProvider.ts 334 busySessions lifecycle has no test; sessions that die without a final idle event leave stale hot entries (the PR's own remaining-work doc lists this as pre-merge work)
plans/agent-manager-git-poller-remaining.md 5 Committed handoff doc states "not ready to merge yet" with open blockers (product approval for 30s dormant freshness, CrowdStrike measurement) — update or confirm tracked before merge
Files Reviewed (10 files)
  • .changeset/calm-agent-manager-git-polling.md - 0 issues
  • packages/kilo-vscode/src/KiloProvider.ts - 0 issues
  • packages/kilo-vscode/src/agent-manager/AgentManagerProvider.ts - 1 issue
  • packages/kilo-vscode/src/agent-manager/GitStatsPoller.ts - 0 issues
  • packages/kilo-vscode/src/agent-manager/git-stats-snapshot.ts - 1 issue
  • packages/kilo-vscode/src/agent-manager/project/pollers.ts - 1 issue
  • packages/kilo-vscode/tests/unit/git-stats-poller.test.ts - 0 issues
  • packages/kilo-vscode/tests/unit/git-stats-snapshot.test.ts - 0 issues
  • plans/agent-manager-git-poller-optimization.md - 0 issues
  • plans/agent-manager-git-poller-remaining.md - 1 issue

Notes: cache lifecycle was reviewed for memory leaks — cache/localCache are bounded by active worktrees, evicted on missing-worktree reconciliation, and cleared on stop(); no leak found. Aggregate diff parity against the legacy diffSummary path is covered by real-repo tests. Changeset is present and user-facing. No webview/UI changes, so no Storybook story needed.

Fix these issues in Kilo Cloud


Reviewed by kimi-k3 · Input: 66.1K · Output: 14.6K · Cached: 865.8K

Review guidance: REVIEW.md from base branch main

# Conflicts:
#	packages/kilo-vscode/src/agent-manager/GitStatsPoller.ts
@marius-kilocode
marius-kilocode merged commit 28c9c93 into main Aug 6, 2026
30 checks passed
@marius-kilocode
marius-kilocode deleted the past-eustoma branch August 6, 2026 08:01
LudwigSolutionsAI pushed a commit to LudwigSolutionsAI/kilocode that referenced this pull request Aug 6, 2026
…er to ensure that input window has enough room to compact (Kilo-Org#12924)

Co-authored-by: James Lal <james@littlebearlabs.io>
t7tran pushed a commit to t7tran/kilocode that referenced this pull request Aug 14, 2026
…er to ensure that input window has enough room to compact (Kilo-Org#12924)

Co-authored-by: James Lal <james@littlebearlabs.io>
t7tran pushed a commit to t7tran/kilocode that referenced this pull request Aug 14, 2026
fix(vscode): reduce Agent Manager Git polling load
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.

3 participants