Files
kilocode/.changeset/git-stats-polling.md
T
Aaravandmarius-kilocode e67ed3f17a perf: reduce git process load via adaptive polling and caching (#8703)
* perf: reduce git process load via adaptive polling and caching

Optimize GitStatsPoller and GitOps to mitigate heavy system load caused
by frequent git process spawns (~200+ processes/min).

- Implement adaptive backoff in GitStatsPoller: The polling interval
  now scales (5s -> 10s -> 30s -> 60s) based on consecutive polls with
  no detected changes.
- Add visibility awareness: The poller now switches to a 60s interval
  immediately when the Agent Manager or Kilo sidebar is hidden.
- Introduce resolution caching in GitOps: Added a 60s TTL cache for
  expensive operations (resolveRemote, resolveTrackingBranch,
  resolveDefaultBranch) to prevent redundant sub-process execution
  within a single polling cycle.
- Reset activity counters: Polling frequency returns to 5s immediately
  upon detecting local changes or when the UI becomes visible.

These changes significantly reduce the baseline CPU footprint of the
extension while maintaining responsiveness during active development.

* fix: resolve review issues for PR #8703 - adaptive polling

- Centralize consecutiveNoChanges tracking in fetch() to fix double increment
- Add onChanged callback to reset backoff when worktree stats change
- Restore stop() call in setEnabled(false) to reset cached state on disable

* perf(agent-manager): remove adaptive backoff, keep visibility + cache

Drop the consecutiveNoChanges-based interval scaling that degraded
stats freshness to 10-60s during normal agent use. The visibility
check (5s visible, 60s hidden) and resolution cache already provide
the bulk of the optimization (192 → 156/min visible, 13/min hidden)
without any UX regression in stats update latency.

* chore: add changeset for git stats polling optimization

---------

Co-authored-by: marius-kilocode <marius@kilocode.ai>
2026-04-14 12:31:36 +02:00

122 B

kilo-code
kilo-code
patch

Reduce git process load via visibility-aware polling and resolution caching in GitStatsPoller