Repository navigation
Conversation
📝 WalkthroughWalkthroughWindows process enumeration now uses PowerShell CIM as the primary backend and Typeperf during CIM failure or cooldown periods. New parsers handle tab-delimited CIM output and Typeperf CSV counters, replacing WMIC parsing. The collector now attributes CPU from cumulative CIM samples and delegates Windows sweeps to the new module. Tests add separate process-execution mocks, backend fixtures, parser coverage, sweep-count assertions, fallback behavior, CPU and memory handling, concurrency, and enumeration failures. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/main/memory/collector.test.ts (1)
517-529: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winExercise both platform failure paths explicitly.
This test never stubs
os.platform(): Unix runs never invokeexecFileMock, while Windows runs never invokeexecMock. Split it into Unix andwin32cases so the Typeperf-then-CIM double failure is covered deterministically.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 670e33ec-f709-4eea-9d43-97e29d22f282
📒 Files selected for processing (2)
src/main/memory/collector.test.tssrc/main/memory/collector.ts
OrcaWin
left a comment
There was a problem hiding this comment.
Reviewed the final Windows sampling implementation through three review rounds and two fix rounds. The healthy path uses one bounded CIM process per poll, Typeperf is memory-only fallback with recovery, CPU deltas handle PID reuse and counter precision, and Unix/SSH behavior remains isolated. Verified 31 collector tests, 59 affected tests, typecheck, touched-file lint/reliability gates, staged diff checks, and the live Windows Electron golden path. The only full-lint failure is the documented unrelated pre-existing exhaustive-switch error. Approving b3729e3.
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 52056db3-2fe5-4a5a-9015-51af8a99f518
📒 Files selected for processing (3)
src/main/memory/collector.test.tssrc/main/memory/collector.tssrc/main/memory/windows-process-resource-collector.ts
🚧 Files skipped from review as they are similar to previous changes (1)
- src/main/memory/collector.test.ts
| /* eslint-disable max-lines -- Why: the collector's host-process index, | ||
| history ring buffer, Electron bucketing, and worktree attribution live | ||
| together to keep one snapshot's orchestration in one place. */ |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win
Remove the max-lines suppression now that Windows enumeration is extracted.
This PR extracts the ~200-line Windows CIM/Typeperf backend into windows-process-resource-collector.ts — exactly the fix previously requested to shrink this file — but the eslint-disable max-lines directive at the top of the file is still present. The coding guideline prohibits disabling max-lines unconditionally, with no carve-out for documented/justified suppressions.
Please recheck whether the file is now under the line limit and remove the disable; if it's still over, further splitting (e.g., history ring buffer, Electron bucketing) is needed instead of retaining the suppression.
As per coding guidelines, "Never disable ESLint or Oxlint max-lines, including line-specific disables; never add a per-file max-lines bump in mobile/.oxlintrc.json."
Source: Coding guidelines
Use a single CIM sample for Windows process memory and CPU attribution, with bounded Typeperf memory fallback and safe CPU delta recovery.
Summary
wmic.exeis unavailabletypeperf.exefor memory only after a failed CIM sample, retry CIM after a bounded 30-second cooldown, and warm a fresh CPU baseline on recoveryWindows 11 25H2 removes WMIC, so the previous collector could return an empty process index and local PTY subtrees would resolve to 0 KB. The Windows collector also hardcoded process CPU to zero, leaving every terminal at 0.0% even while busy.
Microsoft reference: WMIC removal in Windows 11 25H2.
Performance and resilience
Screenshots / live verification
No UI code or layout changed. Live Electron validation on Windows showed:
Testing
The full
pnpm lintcommand remains blocked by an unrelated pre-existing non-exhaustive switch insrc/renderer/src/components/skills/skill-freshness-group.tsx:101; touched files pass lint.Implementation notes
execFilelaunches only constant in-box executable names and arguments; no user-controlled shell command is constructed.bigint/strings because Windows tick values can exceed JavaScript's safe integer rangePR #9048 independently implements overlapping Windows resource sampling inside a broader lifecycle/status refactor. This PR remains the focused collector fix with targeted tests and live Windows verification.
AI review / security
Three review rounds and two fix rounds covered platform isolation, local versus remote behavior, process invocation, PID reuse, parser bounds, failure recovery, polling cost, and test portability. No auth, secrets, IPC contracts, dependencies, filesystem writes, or network access were added.
X: @thecalendre