Repository navigation
Conversation
There was a problem hiding this comment.
ℹ️ No critical issues — both fixes look correct. One documentation follow-up worth folding in.
Reviewed changes
- Windows CPU reporting —
readWindowsProcessesnow selectsUserModeTimeandKernelModeTimefromWin32_Processand derivescpuTimeSecondsfrom their sum (÷ 10,000,000). This feeds the sampler's existing delta path, which previously always produced 0 on Windows because bothcpuTimeSecondswasnullandpercentCpuwas hardcoded0. Thenullfallback is preserved when a host omits the fields. - Build invocation —
buildAppIfNeedednow spawnsconfig/scripts/run-electron-vite-build.mjsviaprocess.execPathinstead ofnpx electron-vite build, removing the WindowsspawnSync npx ENOENT(npx.cmdis not executable byexecFileSync) and reusing the repo's single build path, which also runs the renderer boot-graph check.
I verified the unit conversion (100 ns ticks → seconds), that the wrapper accepts --mode e2e and forwards VITE_EXPOSE_STORE, that the Unix reader is untouched, and that run still propagates cwd/env/stdio.
ℹ️ Nitpicks
docs/reference/renderer-agent-status-performance.md:203-206still states "Windows process CPU collection currently cannot support this comparison." This PR is exactly what makes Windows produce CPU numbers, so that caveat is now stale and should be updated (or narrowed to the remaining--mode e2e/ PowerShell caveats).
deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📥 CommitsReviewing files that changed from the base of the PR and between 31fef6a4eadfb7eff5578157fbae0390606706b9 and 517ff72. 📒 Files selected for processing (2)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review. 📝 WalkthroughWalkthroughThe idle CPU benchmark now runs the Electron Vite build through the Node-run wrapper. The Windows process query requests user-mode and kernel-mode CPU times. The sampler maps their valid sum to seconds and uses Priority: ➖ Normal Severity of issue fixed: Medium Merge Risk: ⚪ Minimal · up to The Windows idle-CPU benchmark build and CPU-reporting changes appear mergeable after normal checks. Architecture SummaryArchitecture risk: 🟡 Medium · up to The change affects 1 system. Changed systems: Architecture concerns Review detailsSystems and components
Before / after behavior
Reliability and maintainability
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
Full details: Linked Issues checkExplanation [
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
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
f9492146-3745-4c1e-8fc1-84c53db9bbcb
📥 Commits
Reviewing files that changed from the base of the PR and between 87bc51d and 77bc6f9100d919334b6b858b4f3cd257a39363b7.
📒 Files selected for processing (2)
config/scripts/idle-cpu-process-sampling.mjsconfig/scripts/run-idle-cpu-benchmark.mjs
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
Incremental delta since the prior pullfrog review (77bc6f9 → 31fef6a). The new commit tightens the Windows CIM time handling raised in prior feedback:
- Rejects a non-numeric
Win32_Processtime instead of coercing it —readWindowsProcessesnow readsUserModeTime/KernelModeTimethrough a newcimTimeSecondshelper that returnsnullunless the CIM payload delivered a finite number. This replacesNumber(entry.UserModeTime), whoseNumber(null) === 0coercion could have produced a kernel-only delta rather than thepercentCpufallback. Thenullfallback is preserved fornull, a missing field, and strings.
I verified the helper's contract, that both fields must be numeric before the delta is used, that 0 remains a valid counter value, and that the Unix reader and the build-invocation fix are untouched by this commit.
deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
🧹 Nitpick comments (1)
config/scripts/idle-cpu-process-sampling.mjs (1)
82-98: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd a focused test for Windows CIM time mapping.
idle-cpu-process-sampling.test.mjssupplies syntheticreadRows, so its tests bypassreadWindowsProcesses()andcimTimeSeconds(). Mocknode:child_processand setprocess.platformtowin32. Assert the converted CPU-time sum and that a missing or non-finite time field maps tonull, preserving the sampler’spercentCpufallback.
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
3830789a-0784-47da-8b5b-1db493cb8310
📥 Commits
Reviewing files that changed from the base of the PR and between 77bc6f9100d919334b6b858b4f3cd257a39363b7 and 31fef6a4eadfb7eff5578157fbae0390606706b9.
📒 Files selected for processing (1)
config/scripts/idle-cpu-process-sampling.mjs
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
|
Both findings on this PR are addressed. The sentinel one was correct, and I verified the fix against real data before tightening the check. Analysis. What changed — Verified before tightening, because an over-strict check would have reverted the CPU reporting this PR restores: Results (Windows,
RSS is unchanged within run-to-run variation, so the change affects CPU reporting only. The build fix is verified separately: a full run including the build step now exits 0 and writes its report, where it previously died with Not addressed in this PR: the intermittent |
Three independent Windows defects in the idle-CPU benchmark (its report is what Windows performance work would cite): - `buildAppIfNeeded` spawned `npx`, which is `npx.cmd` on Windows, so execFileSync failed with ENOENT before any sampling. Build through `config/scripts/run-electron-vite-build.mjs` instead — the repo's own Windows-safe wrapper, which also runs the boot-graph verification. - `readWindowsProcesses` returned `cpuTimeSeconds: null`, so the sampler's per-process CPU delta (idle-cpu-process-sampling.mjs:198) fell back to the hardcoded `percentCpu: 0` and every CPU KPI in the report was zero. Read `UserModeTime`/`KernelModeTime` from `Win32_Process` (100 ns units) and keep `null` when a host does not return them. Measured on Windows, same options before and after the CPU fix: | class | mean CPU before | mean CPU after | | --- | ---: | ---: | | renderer | 0 | 2.20 | | gpu | 0 | 2.08 | | utility | 0 | 0.11 | | agent-or-node | 0 | 0.06 | | total | 0 | 4.51 (p95 8.40) | RSS is unchanged (934 MiB -> 937 MiB), so only the CPU reporting changed. Refs stablyai#25235
… as zero Review follow-up (CodeRabbit). `Number(null)` is `0`, which is also a real counter value, so an absent `UserModeTime`/`KernelModeTime` passed the finite check and the sampler would report a kernel-only delta instead of taking the fallback. Require an actual number from the CIM payload. Verified on Windows that the real payload still reports CPU once the check is tight: total mean 4.40%, p95 14.48%, renderer 3.51%.
The mapping was only reachable through Get-CimInstance, so no test ran it. Lift it into cimCpuSeconds and assert the 100ns-to-seconds sum plus the missing / string / non-finite cases that must stay null.
31fef6a to
517ff72
Compare
|
Addressed the CodeRabbit finding.
|
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
Incremental delta since the prior pullfrog review (31fef6a → 517ff72). The branch was rebased onto 2b0ce17; aaafe3a is a rebase of the previously reviewed 31fef6a, so the only new content is 517ff72:
- Extracted the Windows CPU-time mapping into an exported pure helper —
cimCpuSeconds(entry)now holds theUserModeTime/KernelModeTimehandling that previously lived inline inreadWindowsProcesses. Thenull-unless-both-finite contract is unchanged, so the sampler'spercentCpufallback and the real delta path behave exactly as before. - Covered the mapping with direct tests —
idle-cpu-process-sampling.test.mjsasserts the 100 ns sum (10_000_000+25_000_000→3.5) and that missing, string,NaN, andInfinityinputs map tonull. The non-numeric case fails if the oldNumber(...)coercion were reintroduced, so the test is real coverage rather than a tautology.
I verified the extraction is behavior-preserving and ran the test file and linter locally: vitest run config/scripts/idle-cpu-process-sampling.test.mjs → 4 passed; oxlint on both changed files → 0 warnings.
deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏
|
Closing this rather than letting it age, for the same reason as the other Windows-benchmark PR: it repairs the harness, not a user-visible path, and seven small PRs at once is a worse trade for you than four fewer. #25235 stays open with what was measured — the |

Author: @paolovalletta_
ELI5
On Windows the idle-CPU benchmark could not build the app (it asked for
npx, which Windows cannot run that way), and — worse — once it did run, it reported 0% CPU for everything. The app's real CPU use was invisible in the report. Both are fixed: the build goes through the repo's own build helper, and the benchmark now reads the per-process CPU time Windows exposes.What Changed
Before, on Windows:
$ node config/scripts/run-idle-cpu-benchmark.mjs [idle-cpu] building Electron app with electron-vite --mode e2e Error: spawnSync npx ENOENT at run (config/scripts/run-idle-cpu-benchmark.mjs:150:3) at buildAppIfNeeded (config/scripts/run-idle-cpu-benchmark.mjs:162:3)and with
--skip-build(so the sampling loop is reached), the report hadmeanCpuPercent: 0,p95CpuPercent: 0,maxCpuPercent: 0for every process class while RSS was reported normally.After,
bench:idle-cpucompletes on Windows and reports real CPU.Fix 1 — build through the repo's own helper
buildAppIfNeededranrun('npx', ['electron-vite', 'build', '--mode', 'e2e'])viaexecFileSync, which cannot startnpx.cmdon Windows (ENOENT). It now spawnsconfig/scripts/run-electron-vite-build.mjswithprocess.execPath— the repo's existing Windows-safe wrapper for exactly this build, which also runs the renderer boot-graph verification, so there is still one build path.Fix 2 — report CPU instead of a hardcoded zero
The sampler derives CPU from the per-process time delta and only falls back to
ps-stylepercentCpuwhen that is unavailable (idle-cpu-process-sampling.mjs:198).readWindowsProcessesreturnedcpuTimeSeconds: null, and itspercentCpuwas hardcoded0, so on Windows both sides were empty and the delta was always zero.Win32_Processdoes exposeUserModeTimeandKernelModeTime(100 ns units); they were simply not requested. They are now selected and summed, and the field staysnullif a host does not return them, which keeps the previous fallback.Measured before/after
Same command, same machine, same
--mode e2ebuild, one empty worktree, 15 s sample, only the CPU-reading change applied between the two runs:Total mean RSS is unchanged across the two runs (934 MiB → 937 MiB), so only CPU reporting changed. A full run including the build step (no
--skip-build) also exits 0 and writes its JSON report.ORCA_BACKGROUND_LAUNCH=1is set so the measured window is never shown, per the launch policy inAGENTS.md.Why
#25235 tracks this: Windows performance work is tracked in #9300, and it cannot cite numbers the platform cannot produce. An all-zero CPU column is worse than a crash, because it looks like a successful measurement of an idle app — I only caught it by sampling the same app independently over CDP and
Get-Process, which showed non-zero idle CPU.Alternatives considered:
npxby spawning through a shell. Rejected: it changes quoting/argument handling and duplicates whatrun-electron-vite-build.mjsalready does correctly, including the boot-graph check.Win32_PerfFormattedDataforpercentCpu. Rejected as unnecessary: the delta path already exists and is what the other classes use; it only needed a real timestamp source. This keeps one code path instead of two.JSON.parsefailure ([Perf] bench:idle-cpu on Windows: intermittent JSON.parse failure while reading the process table #25236) and is deliberately not mixed into this PR, because I could not reproduce that failure on demand and did not want to change the reader without a verifiable result.Linked Issue
Fixes #25235
(The other PR from this issue makes three benchmark scripts run on Windows at all; the intermittent
JSON.parsefailure this issue also mentions is #25236.)Visual Proof
N/ANo UI or user-facing behaviour change: build tooling and a benchmark's JSON report.
Testing
No new test file for the benchmark itself: the benchmark is the test. Before the change the build step fails and the report contains zeros; after it, the same invocation exits 0 and contains the numbers above. The Windows time mapping that replaced the all-zero report is now covered directly: it lives in
cimCpuSeconds(), a pure helper the test can assert without mockingGet-CimInstance(added after review, following the CodeRabbit finding).ORCA_BACKGROUND_LAUNCH=1 node config/scripts/run-idle-cpu-benchmark.mjs --warmup-ms 5000 --sample-ms 10000 --output idle.jsonspawnSync npx ENOENT; after: exit 0, 77 KB report written--skip-build --sample-ms 15000node node_modules/oxlint/bin/oxlint <2 files>node config/scripts/check-changed-code-quality.mjsPlatforms tested: Windows only, the platform that was broken. The Unix reader is untouched, and the Windows reader keeps its previous
nullfallback, so macOS/Linux behaviour is unchanged; I did not run them.AI Disclosure
Written with an AI coding agent, session model
deepseek-v4.1-flash(provideropencode-go). Every command and number above was produced on this machine.Review
readUnixProcessesunchanged). The new Windows fields are additive and guarded withNumber.isFinite, falling back to the previous behaviour, so a host that does not return them behaves exactly as before. The build change removes a POSIX-only assumption rather than adding a platform branch.-NoProfile, same parsing), no new subprocess, network or filesystem access, andAGENTS.md's rule about process enumeration applies to Orca's own code rather than this diagnostic harness.readProcessRows's contract ({pid, ppid, percentCpu, cpuTimeSeconds, rssBytes, command}) is unchanged;percentCpu: 0is kept because the delta path takes precedence and is what the other platforms use.Agent skill upstream boundary
docs/reference/agent-skill-sharing-upstream-boundary.mdand copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.Notes
--mode e2ebuild with no terminal panes and no agents, from a single machine, so they are not a production baseline and not a performance claim about the app — they are evidence that the instrument now reports CPU at all. And the intermittentJSON.parsefailure in the same reader ([Perf] bench:idle-cpu on Windows: intermittent JSON.parse failure while reading the process table #25236) is still present; if it hits, the run fails loudly in the sampling loop rather than reporting zeros.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass — lint on changed files and the changed-code gate pass; the full suite could not run here (no MSVC,ensure-native-runtimegatespnpm test); CI will cover