Skip to content

Fox job-started hook: sample CPU load without perf-counter rights - #43

Merged
quolu merged 2 commits into
mainfrom
exia/fox-cpuload-runner-context
Nov 14, 2026
Merged

quolu merged 2 commits into
mainfrom
exia/fox-cpuload-runner-context

Conversation

@quolu

@quolu quolu commented Nov 14, 2026

Copy link
Copy Markdown
Collaborator

Shiratsuru f8 (chart bot-38094207 / ci-fox-concurrency).

Symptom. After Trina installed the PR #42 hook (e4d719a6…d953), the first natural job (kitepon/Caveat run 43579266104, job 132400306799, factory-windows-fox-u2) printed affinity=0xFF000000 load=unknown: the tie-break came from the highest-index fallback, not from a sample.

Cause. Fox runners run as fox\factory-runner from scheduled task dotagents-factory-runner-dedicated (LogonType Password = batch logon, RunLevel Limited, session 0). That account is not an admin and not in Performance Monitor Users / Performance Log Users. The Perflib key ACL admits only INTERACTIVE, LOCAL/NETWORK SERVICE, SYSTEM, Administrators and those two groups, so CIM Win32_PerfFormattedData_PerfOS_Processor returns zero rows, no error. Interactive runs as kite_ (admin) worked, which is why the PR #42 check passed. Confirmed in the runner context: diagnostic run 43582300359 (old code, new live test) failed with {"load":null,"who":"factory-runner","diag":"CIM=0"}.

Fix. Get-CpuLoad reads per-CPU idle/kernel/user times twice, 250 ms apart, via NtQuerySystemInformation(SystemProcessorPerformanceInformation) (Add-Type), which needs no rights. Selection rules are unchanged (overlap first, then least loaded, sample failure → highest index). Fox interactive: 32 numeric values in ~0.7 s including the type compile.

Same diff. docs/feature-map/runner-capacity.md hook row (sample source) and test list; new live test in windows-runner-job-started-hook.test.mjs asserting 8 numeric loads (prints the sample as a test diagnostic, so the CI log of the Windows job is the runner-context evidence). The no-wait guard now allows only the bounded sample sleep.

No Fox install here; Trina installs after merge.

🤖 Generated with Claude Code

quolu and others added 2 commits November 14, 2026 09:48
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The runner account (fox\factory-runner, scheduled task with a password
logon, non-admin, not in Performance Monitor Users) gets zero rows from
CIM Win32_PerfFormattedData_PerfOS_Processor: the Perflib ACL admits only
INTERACTIVE, services, admins and the perf groups. Every real job therefore
printed load=unknown and fell back to the highest block.

Get-CpuLoad now reads per-CPU idle/kernel/user times twice, 250 ms apart,
with NtQuerySystemInformation(SystemProcessorPerformanceInformation), which
needs no rights. A live test asserts 8 numeric loads; in CI it runs as the
runner account (diagnostic run 43582300359 failed there with the CIM code:
CIM=0, who=factory-runner).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@quolu
quolu merged commit db3f9bf into main Nov 14, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant