Expand description
Native validation harness: the agentβs reward function.
Builds the scheduler, attaches it on the host (as root), drives a workload,
extracts a single metric, always tears the scheduler down (verifying the
kernel returns to disabled), and returns a Verdict. Runs in-process;
the equivalent logic previously lived in a separate run_validation.py.
Stages mirror the old harness: spec / build / preflight / attach /
metric / complete. A non-complete verdict means the candidate did not
build, attach, or produce a measurable result this round.
StructsΒ§
- Measurement π
- One scheduler+workload run.
- Scheduler π
- Launch/teardown of the scheduler with hard safety guarantees.
- Trace
Recorder π - Trace
Stats π - Verdict
ConstantsΒ§
- SCX_
STATE_ πPATH
FunctionsΒ§
- binary_
help π - Capture the scheduler binaryβs
--helptext (stdout+stderr) so we can probe which optional flags it supports before launching it. Passing an unknown argument makes the scheduler exit before attaching, so flags that are not universal must be gated on this. Empty string on any failure. - binary_
path π - cargo maps release/dev to target/{release,debug}; named profiles land in
target/
. - cargo_
build π - cargo build the candidate. Returns (ok, combined stdout+stderr).
- cpu_
event_ πrate_ summary - event_
counts_ πjson - event_
rates_ πjson - exec_
scheduler_ foreground - Replace this process with the scheduler in the current terminal.
- extract_
metric π - Parse the workload command output as the single numeric metric value. Any extraction or aggregation belongs in the command itself.
- fail π
- Build a non-complete verdict (build/preflight/attach/metric/spec stages).
- measure_
once π - median π
- perf_
available π - perf_
mmap_ πpages_ per_ cpu - Per-CPU mmap pages for
perf record -m, derived from a total byte budget split across the online CPUs. This controls perfβs live mmap buffer; the output file is separately capped withperf record --max-size. - pstdev π
- Population standard deviation (matches Python statistics.pstdev).
- rate_
value π - read_
lossy π - round_
trace_ πfloat - rounded_
option π - run_
capture π - Run a shell command to completion or until
timeout, capturing combined stdout+stderr toout_path. A fixed-duration workload is expected to be cut off at the timeout; its partial output is still returned. - run_
validation - Build the candidate, attach it, drive the workload, and return a verdict.
- scx_
is_ πenabled - scx_
state π - Return the sched_ext root state (βdisabledβ/βenabledβ/β¦) or None.
- sleep_
interruptible π - Sleep up to
duration, returning true if interrupted before the deadline. - sorted_
counts π - summarize_
trace π - tail π
- trace_
cpu π - trace_
event π - trace_
stats_ πjson - trace_
window_ πsec - update_
trace_ πstats - wait_
for_ πstate - Poll the sched_ext state until it equals
wantor the timeout elapses.