The rarity-greedy comparator acted on every evaluated window, so it spent each hour's budget on the first ~15 windows and scored 0 hits in every cell. Criteria 2 and 3 of the Stage 4 gate were void against it. rarity_calibrated keeps the same rarity value, chooser, costs and budget, and adds a per-node threshold frozen before the evaluated span: the m-th largest value over the trailing 24 h of label-free history between the warm-up and the --eval-after bound, with m set so expected spend matches the hourly budget. Without that history the comparator is uncalibrated and the gate fails by name; it never falls back to another rule. rarity_greedy (the old first-come rule) and rarity_hindsight (per-hour ordering, not causal) are reported as diagnostics and never judged. fleet gate pools counts, keeps thresholds per node, and fails a pooled cell when any node is uncalibrated or lacks the comparator. Contract change: in `fleet gate --json`, rarity_hits and rarity_cpu_seconds now describe the calibrated comparator; the old numbers are rarity_greedy_hits and rarity_greedy_cpu_seconds. Pre-registration: docs/evaluation/stage4-rarity-baseline-preregistration.md, sha256 4916c95cd2581e3749acfe46c3ccf827aa5ce98c06150b49b978fc70da013f95, indexed in YAMS at 2026-11-20T18:55:48Z, before the code. This commit is dated after the registration time in that document (2026-11-21T00:00Z); the YAMS record is what predates it. Checked: meson suite 58/58, scripts/fleet_e2e.sh, clang-tidy and the strict analyzer on the changed TUs. Not run: fold on the changed TUs, make fuzz, the live Docker tests and the perf KPI. The comparator has not been run on validation-range data. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
6.1 KiB
Stage 4 execution-policy gate (2026-10-27)
This is a method amendment to the original promotion gate, written before evaluating the new execution path. It does not change that gate's numeric thresholds. Previous promotion results must be rerun with this method.
Deployed action set
The daemon can execute memory_scan and deep_rescan, or do nothing. It does
not implement watch_subtree; rule-change rescanning remains the independent
retro-hunt service. Both model and rarity-greedy replay policies are restricted
to the executable action set through executable_policy(). Promoted decisions
are greedy, as in replay; epsilon exploration remains shadow-only.
model promote and replay --policy-eval use the configured scan profile's
10 / 30 / 120 estimated inspection seconds per hour (efficient / balanced /
aggressive). Expected costs and reach are still the pre-registered constants.
These are allocation estimates, not measured CPU consumption or a hard CPU-time
quota. Real durations appear in inspection_outcome and timings.model_inspection;
ResourceGovernor admission, bounded queues, paced reads, byte limits and scanner
timeouts remain the runtime resource controls. Calibrating cost estimates and
proving an actual inspection CPU budget remain required before claiming the full
Stage 4 resource milestone.
Acceptance and compatibility
The original thresholds still apply: at least 10 extra positives, model hits per estimated inspection second at least 1.5 times rarity-greedy, and model recall no lower. (Amended 2026-11-20: the comparator is the calibrated rarity policy of stage4-rarity-baseline-preregistration.md; the thresholds are unchanged.) The operator must still record three disjoint replay periods and three training seeds before relying on a promoted model. One CLI run does not establish that evidence, nor does this implementation claim it.
After a passing gate, model promote appends an integrity-covered
inspection-execution-v1 budget=<seconds> suffix to the promoted model's note.
The daemon refuses old promoted files and files evaluated for a different scan
profile, reporting model.promoted_error. This prevents an upgrade from silently
activating a model evaluated over unsupported actions. Re-promote explicitly;
do not edit the note to bypass evaluation. No model is promoted by a daemon,
MCP tool, or by this implementation work.
Runtime contract
model_shadow=falseortelemetry=falsedisables both shadow and acting model processing. A shadow file alone never authorizes execution.- At startup and approximately once a minute, the daemon loads
shadow.sbmandpromoted.sbmfrommodel_dir. Missing, corrupt, symlinked, wrong-owner, group-writable or world-writable model files are not used. Removal/replacement revokes queued work when observed; an already running scanner is not forcibly interrupted. The directory must remain operator-controlled. - A decision is synced to telemetry before dispatch. Failure to record it means no execution. Queues are bounded, and refusals/drop counters are visible.
- Acting jobs must identify a stable process node (PID, boot prefix, start time) and the same executable. Protected processes are refused. Memory jobs retain this identity through the queue and recheck it around the scan. Rule/operator jobs have priority over queued model jobs; a scan already in progress can still occupy the shared scanner until its timeout.
- Deep rescans open the current image, read a bounded paced private copy, drop
page cache and recheck image/rules identity before storing any new YARA hits.
On Linux this uses
/proc/<pid>/exe. macOS has no equivalent descriptor; its path-based image check is weaker and requires separate live validation. - Model output is never itself a finding or a response instruction. A real YARA match can enter the existing evidence/correlation path and remains subject to allowlisting and the existing independent response policy.
- Outcomes are root-only telemetry, not an MCP mutation surface. Shadow and
acting records remain distinct; replay's
shadow_loggedtally excludes acting decisions.
This increment does not implement online retraining, learned inspection costs, subtree watching, or Stage 5 advisory detections. Live model-triggered inspection and constrained-lane evidence must be reported separately from unit coverage.
Validation status (2026-10-27)
This implementation passed 48 local tests, 46 tests in a clean-object Linux Docker build, and the privileged exec-guard, behavior, file-watch, YARA and daemon-runtime checks. Three seeded sweeps cover inspection/replay/I/O properties. Source invariants pass; selected Fold/clang-tidy checks were reviewed with their bounded coverage retained. The final sanitizer refresh ran all 20 fuzz targets for 10 seconds each with fail-fast UBSan, plus a 60-second health parser follow-up. An earlier recovered UBSan error was fixed with a regression; that earlier run is not counted as clean.
Three quiet, alternating baseline/changed KPI pairs used the same rule snapshot, 2 CPUs and 2 GiB per container. All six runs passed the existing thresholds:
| Pair | Baseline idle CPU | Changed idle CPU | Exec-decision p95, both | Dropped events, both |
|---|---|---|---|---|
| 1 | 1.23% | 0.22% | 0.031 ms | 0 |
| 2 | 0.13% | 0.23% | 0.031 ms | 0 |
| 3 | 0.12% | 0.20% | 0.031 ms | 0 |
These are default-lane measurements: every run had no active model, and the
changed runs submitted zero model inspections. They do not satisfy an acting-model
resource or efficacy gate. Peak container memory varied (baseline 305.5–342.8 MB,
changed 316.9–378.8 MB), so passing these thresholds is not a blanket claim of
resource improvement. Earlier noisy runs, including an idle-CPU failure, are
retained in the evidence rather than discarded. No model was promoted and no
host service was changed during this validation. Evidence summaries, artifact
references and triage are recorded in YAMS under task strawberry-stage4-execution;
local run artifacts use
batch 20261027-173147 under build/perf/ and build/audit/stage4/.