Skip to content

Fox job-started hook: break CPU-block ties by sampled load - #42

Merged
quolu merged 1 commit into
mainfrom
exia/fox-cpuset-least-loaded
Nov 14, 2026
Merged

quolu merged 1 commit into
mainfrom
exia/fox-cpuset-least-loaded

Conversation

@quolu

@quolu quolu commented Nov 14, 2026

Copy link
Copy Markdown
Collaborator

Chart bot-38094207 / ci-fox-concurrency f5 (Shiratsuru's design decision, Elegg's evidence elegg-aiterm/w2).

Problem. After #41 a lone Fox job always got block 0 (affinity 0xFF, CPUs 0-7). The Owner's Normal-priority desktop work keeps CPUs 0-3 at 78-94 % while CPUs 8-15 sit near 1 %, so the BelowNormal job got little CPU: Aiterm full suite 802 s vs 484 s, 8 PTY timing failures (job 132377918670, run 43566217391).

Change (block choice only; the Owner's 8-CPU block / maxRunning 4 rule stays). bin/windows-factory-runner-job-started.ps1:

  1. Fewest overlapping other Runner.Workers first (unchanged).
  2. Ties: least-loaded block from one per-CPU sample at job start, inside the existing mutex: CIM Win32_PerfFormattedData_PerfOS_Processor, PercentProcessorTime per numeric Name (not localized), summed per block.
  3. Sample failed or incomplete: highest index on ties.
  4. Any other error: warning, exit 0 (unchanged).
  5. Hook line adds load=N% (chosen block's sampled mean) or load=unknown.

Selection lives in Select-CpuBlock / Get-CpuLoad; dot-sourcing the hook defines them without running it (for tests). No config option.

Diagram first, same diff. docs/feature-map/runner-capacity.md: hook row (was "lowest index on ties"), Fox budget paragraph, test list.

Tests. New: overlap wins over load, tie → least loaded, no sample → highest index (also with the top block taken), incomplete sample → no sample. The fixture test now accepts any free block but block 0. On Fox from a TEMP copy: 8/8 pass; a real hook run printed affinity=0xFF00 load=3% with CPUs 0-3 at ~100 %.

Not in scope: Fox install (Trina, f6).

🤖 Generated with Claude Code

A lone Fox job always got block 0 (CPUs 0-7), where the Owner's desktop
keeps CPUs 0-3 at 78-94 %, so the BelowNormal job starved (Aiterm suite
802 s vs 484 s, 8 PTY timing failures; Elegg, elegg-aiterm/w2).
Fewest overlapping Runner.Workers still decides first. Ties now go to the
least-loaded block from one CIM Win32_PerfFormattedData_PerfOS_Processor
sample inside the existing mutex; no complete sample: highest index.
The hook line adds load=N% or load=unknown. Diagram row and the Fox budget
paragraph updated; selection tested with fake samples.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@quolu
quolu merged commit e344f3f 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