Skip to content

fix(server): stop Windows terminal polling from spiking CPU - #211

Merged
leoisadev1 merged 2 commits into
mainfrom
fix/windows-terminal-poll-cpu
Sep 10, 2026
Merged

fix(server): stop Windows terminal polling from spiking CPU#211
leoisadev1 merged 2 commits into
mainfrom
fix/windows-terminal-poll-cpu

Conversation

@leoisadev1

Copy link
Copy Markdown
Member

Problem

While terminals are active, the environment server spawned a PowerShell CIM query every second on Windows. Those calls could take about a second, time out, and keep CPUs busy. POSIX still used a spawned ps fallback on the same cadence when the sidecar was down.

Changes

Add a processTable command to the resource-monitor sidecar (protocol v3) and reuse one shared snapshot per polling tick across every terminal. If the sidecar snapshot fails, the existing ps/PowerShell fallback still supplies data, but polling backs off exponentially up to 60 seconds.

Process activity labels and process registration stay the same. This is a reviewed adaptation of pingdotgg#9476.

Scope

This PR is terminal process polling only.

Covered here:

Server history bounds and Windows process-tree close are in separate PRs.

Still assigned to this handoff, in later PRs:

Verification

  • vp test run on Manager, NativeTelemetryClient, ResourceTelemetry, Model, ResourceTelemetryHistory, and ProcessDiagnostics: 98 passed, including sidecar snapshots, fallback backoff, and protocol version 3 fixtures.
  • vp lint on the changed TypeScript files: clean.
  • vp run --filter @t3tools/contracts typecheck and vp run --filter akeru-bot typecheck: no new errors.

Native cargo test for native/resource-monitor did not run here. Local rustc is 1.94; sysinfo@0.39.3 requires 1.95. CI owns that check.

No Windows host in this environment, so PowerShell CIM was not exercised on a real Windows machine. The sidecar snapshot path and POSIX fallback backoff are covered by tests.

Implemented and verified by Grok 4.6 High in Grok Build via Orca.

Read one shared process snapshot per tick from the resource-monitor
sidecar. Failed snapshots back off exponentially instead of spawning
PowerShell or ps every second.

Adapted from pingdotgg#9476.
@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:L labels Sep 10, 2026
@greptile-apps

greptile-apps Bot commented Sep 10, 2026

Copy link
Copy Markdown

Greptile Summary

This change moves terminal process discovery to the native resource-monitor protocol, shares snapshots across active terminal sessions, and retains bounded fallback polling when native telemetry is unavailable.

Confidence Score: 5/5

No outstanding issues require changes before merging.

No accepted new findings or outstanding previous findings remain.

Reviews (2): Last reviewed commit: "Merge branch 'main' into fix/windows-ter..." | Re-trigger Greptile

@leoisadev1
leoisadev1 merged commit acd2b6e into main Sep 10, 2026
11 checks passed
@leoisadev1
leoisadev1 deleted the fix/windows-terminal-poll-cpu branch September 10, 2026 20:02
@github-actions github-actions Bot mentioned this pull request Sep 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant