fix(server): stop Windows terminal polling from spiking CPU - #211
Merged
Conversation
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.
Greptile SummaryThis 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/5No 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
psfallback on the same cadence when the sidecar was down.Changes
Add a
processTablecommand to the resource-monitor sidecar (protocol v3) and reuse one shared snapshot per polling tick across every terminal. If the sidecar snapshot fails, the existingps/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 runon Manager, NativeTelemetryClient, ResourceTelemetry, Model, ResourceTelemetryHistory, and ProcessDiagnostics: 98 passed, including sidecar snapshots, fallback backoff, and protocol version 3 fixtures.vp linton the changed TypeScript files: clean.vp run --filter @t3tools/contracts typecheckandvp run --filter akeru-bot typecheck: no new errors.Native
cargo testfornative/resource-monitordid not run here. Local rustc is 1.94;sysinfo@0.39.3requires 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.