Skip to content

P5 O2: the idle window's load rule voids sustained load and passes a burst (Rule B at 4.7) - #340

Merged
SSFSKIM merged 4 commits into
masterfrom
p5-o2-load-rule
Oct 29, 2026
Merged

SSFSKIM merged 4 commits into
masterfrom
p5-o2-load-rule

Conversation

@SSFSKIM

@SSFSKIM SSFSKIM commented Oct 29, 2026

Copy link
Copy Markdown
Owner

P5 O2: the idle window's load rule voids sustained load and passes a burst (the architect's Rule B at 4.7)

The measured daemon-idle scenes void a window on load only when the load was sustained. A short system-wide wakeup no longer voids a run whose readings it did not touch. Every line that prints a load now prints the rebuilt 30 s pair beside the peak, and each sample records two diagnostics of what the machine was doing.

The rule, and why

e2e/daemon-idle.spec.ts reads the 1-minute load (loadavg()[0]) every 30 s across the 600 s window, 21 samples. Until now invalidReasons voided the window if any sample reached 5. But the 1-minute average smears one ~5 s spike across about 90 s, so a single burst reads as two or three samples over 5, and runs whose footprint and CPU it never touched were voided.

The rule now (test/support/daemon-idle.ts, IDLE_RUN.pairLoad, intervalLoads, loadPair):

  • Each 30 s interval's own average load is rebuilt from the 1-minute series at the nominal spacing: u_t = (l_t − e^−0.5 · l_(t−1)) / (1 − e^−0.5), for t ≥ 1. The 1-minute load is an exponential average with a 60 s time constant, so this inverts it exactly for a constant load over the interval.
  • The window's 30 s pair is max over t of min(u_t, u_(t+1)): the highest load two adjacent intervals both held. A burst raises one interval alone; sustained load raises neighbours.
  • A window is void on load only if both hold: its peak sample is ≥ 5, as before, and its 30 s pair is ≥ 4.7.

The pair is a guard on the peak rule, so it can only exempt: every window valid before stays valid. A seeded spread of 4,003 series pins that (series under 5 with pairs of 4.7 and more stay valid, and no series is void unless its peak reached 5). A rule voiding on the pair alone fails the test.

The void reason names both numbers: the 1-minute load reached 9.5 and its 30 s pair 5.2 (a valid run stays under 5 throughout, or its 30 s pair under 4.7).

The boundary windows, as unit fixtures

Each fixture is the run's recorded 21-sample series, copied literally from its test-results/daemon-idle*.json with its run id, and run through the shipped invalidReasons.

Run Scene Peak 30 s pair Before Now
40789442114 baseline, sustained indexer 9.5 5.24 void void
40793346639 baseline, sustained indexer 5.4 5.30 void void
40647561480 baseline (O2's landing record) 11.0 7.48 void void
40805962574 daemon-idle, tonight's bursts 7.6 2.62 void valid
40809164967 daemon-idle, tonight's burst 6.4 2.67 void valid
40502284016 runtime floor 7.7 2.76 void valid
40634705341 daemon-idle 5.7 4.15 void valid

40634705341 is a seventh fixture beside the six named: of every exempted window it has the highest pair, so it sets the threshold's lower edge, and the test that 4.2 to 5.2 scores every fixture alike needs it.

Re-scored: every recorded window

Every recorded series (scratch/loadrule/rows3.json, 45 windows) run through the shipped invalidReasons and loadPair, in the analysis table's order (loadrule-table.txt). It agrees with the analysis on every window: no verdict and no pair differs. Rows marked peak-only kept only their peak, under 5, so they are valid under both rules by the guard. 16 windows were void on load; 9 are now. The 7 that change are in bold.

Groups: di e2e:daemon-idle, di-base -baseline, di-floor -floor, di-mawsd -mawsd, di-enrolled -enrolled (window enr or unenr), di-aba -aba.

run group window peak old new 30 s pair shape
40481254211 di 1 6.2 void void 5.79 sustained
40483272622 di 1 3.6 valid valid 2.86 clean
40485317066 di 1 2.9 valid valid 2.88 clean
40487334697 di 1 4.0 valid valid 3.25 clean
40490756731 di 1 3.3 valid valid 2.52 clean
40492851056 di 1 3.0 valid valid 2.71 clean
40495339208 di 1 2.7 valid valid 2.92 clean
40498387866 di-floor 1 2.9 valid valid 3.02 clean
40500435129 di-floor 1 4.3 valid valid 3.08 clean
40502284016 di-floor 1 7.7 void valid 2.76 burst
40504203813 di-floor 1 3.3 valid valid 3.17 clean
40533404486 di-mawsd 1 4.5 valid valid 4.99 clean
40535972777 di-mawsd 1 4.2 valid valid 2.69 clean
40539018795 di-mawsd 1 5.3 void valid 3.08 burst
40541942712 di-mawsd 1 5.3 void void 6.68 sustained
40549288255 di-mawsd 1 4.6 valid valid 3.55 clean
40606738519 di 1 2.9 valid valid 2.82 clean
40634705341 di 1 5.7 void valid 4.15 burst
40640136886 di 1 3.6 valid valid 3.02 clean
40643854607 di 1 3.8 valid valid 2.77 clean
40647561480 di-base 1 11.0 void void 7.48 sustained
40650181035 di-base 1 4.2 valid valid 3.84 clean
40652728419 di-base 1 14.8 void void 17.75 sustained
40657230165 di-base 1 25.8 void void 33.00 sustained
40669418019 di-base 1 3.4 valid valid 2.80 clean
40671838782 di 1 3.4 valid valid 2.91 clean
40673974571 di-base 1 4.6 valid valid 3.02 clean
40676048769 di 1 3.8 valid valid 2.92 clean
40678158535 di 1 7.6 void valid 2.64 burst
40721630909 di 1 12.8 void void 14.05 sustained
40733174443 di 1 3.1 valid valid 2.09 clean
40735795915 di-enrolled enr 3.4 valid valid 4.08 clean
40735795915 di-enrolled unenr 3.8 valid valid 2.80 clean
40745657584 di-enrolled enr 5.2 void valid 3.99 burst
40745657584 di-enrolled unenr 3.1 valid valid 2.91 clean
40750099007 di 1 2.5 valid valid 2.07 clean
40752997636 di 1 3.0 valid valid - clean(peak-only)
40755620670 di 1 3.1 valid valid 2.75 clean
40758022841 di 1 3.0 valid valid 2.51 clean
40760941646 di 1 2.9 valid valid 2.76 clean
40763593992 di 1 3.9 valid valid 2.67 clean
40766342839 di-base 1 7.2 void void 6.15 sustained
40778748076 di-aba A 4.5 valid valid - clean(peak-only)
40778748076 di-aba B 4.7 valid valid - clean(peak-only)
40778748076 di-aba A' 3.7 valid valid - clean(peak-only)
40789442114 di-base 1 9.5 void void 5.24 sustained
40791210494 di-base 1 2.4 valid valid - clean(peak-only)
40793346639 di-base 1 5.4 void void 5.30 sustained
40795119204 di-base 1 3.7 valid valid - clean(peak-only)
40804364622 di 1 2.7 valid valid - clean(peak-only)
40805962574 di 1 7.6 void valid 2.62 burst
40807583597 di 1 3.7 valid valid - clean(peak-only)
40809164967 di 1 6.4 void valid 2.67 burst

Two exempted windows read outside their limits at the time. No verdict changes retroactively, but a reader of the record should know:

  • 40634705341 (daemon-idle at d9419bb) read 103,683 KiB, over that day's bound of 96,721 KiB and over today's 99,145. Under this rule it would have been a valid miss rather than a void run.
  • 40745657584's enrolled window (at 2d4283e) read +9,184 KiB, over the 8,192 KiB enrolled budget. That case records only and asserts nothing.

40533404486 (daemon-idle-mawsd) shows the guard's other side: its pair was 4.99 at a peak of 4.5, and it stays valid.

40810725580's B window stays void

40810725580 is an A-B-A on 781b88c. CI-opt's 5 s sampler read the spike in its B window as one burst of about 10 s, from macOS's on-device intelligence stack. Through the shipped invalidReasons, from the run's own daemon-idle-aba.json:

Window Peak 30 s pair Last three intervals Verdict
A (detached) 4.65 2.94 1.63, 2.89, 3.01 valid (under 5)
B (daemon) 10.66 7.74 2.80, 7.74, 19.44 void
A' (detached) 3.29 3.39 3.39, 3.86, 1.71 valid (under 5)

The spike falls in B's last interval, and the interval before it already averaged 7.7. B's pair, 7.74, is above all three sustained windows' pairs, so no threshold of this rule separates it, and passing it would take a different rule. The architect kept it void, and #324's record carries it as void data (P5 Decision Log 133).

Applied before landing: #324's proof series

The architect ruled Rule B at 03:25Z on 2026-10-29. #324's landing (P5 Decision Log 133) was judged by it before it reached master, under three conditions that remove any choice:

  • every verdict comes from this branch's shipped invalidReasons and loadPair (at a2fc850), run on the run's recorded samples, never by hand;
  • the rule applies to every run in the series, not only the void ones;
  • every Rule B-valid run counts.

A run valid under the peak rule uploads no artifact, so it is replayed from its line's peak, under 5, and is valid by the guard.

Run Tree Group / window Peak 30 s pair Peak rule Rule B Cause of the load (CI-opt's 5 s sampler)
40804364622 781b88c daemon-idle 2.7 valid valid
40805962574 781b88c daemon-idle 7.6 2.62 void valid burst
40807583597 781b88c daemon-idle 3.7 valid valid
40809164967 781b88c daemon-idle 6.4 2.67 void valid silent thread wake, about 59 threads
40810725580 781b88c aba B 10.7 7.74 void void on-device intelligence burst (above)
40814726160 ad09678 daemon-idle 4.1 valid valid
40816219223 ad09678 aba A' 6.55 5.43 void void XProtect Remediator scans, sustained about 2 min
40820891730 ad09678 daemon-idle 7.51 3.20 void valid silent thread wake, about 75 threads
40820904200 ad09678 daemon-idle 8.07 2.83 void valid two silent thread wakes, about 99 and 76 threads
40822960789 ad09678 daemon-idle 3.1 valid valid
40826529043 ad09678 enrolled, enrolled window 5.5 3.67 void valid a git process at 195% CPU, about 15 s

The A-B-As' other windows (A and A' of 40810725580; A and B of 40816219223) and the enrolled run's unenrolled window were under 5, so they are valid under both rules.

In a silent thread wake, the 1-minute load jumps in one 5 s read and then only decays at the average's own rate, while no process shows real CPU and the process count stays flat. These wakes are exactly the case the peak rule voided for nothing: the measured processes' own records show no work at the wake. mawsd's CPU over each window was 0.00 s, the engine host's was the same in void and valid windows, and its footprint steps fall at other samples. The two sustained cases, the XProtect scan and the indexer windows above, stay void.

The reconstruction check

The rebuilt series reproduce what the kernel reported. The analysis rebuilt each window's 5-minute average from its rebuilt intervals and compared it with ci-kit's job-end 5-minute load; they matched within 0.1:

Run Rebuilt 5-min ci-kit job-end 5-min
40805962574 2.9 2.88
40809164967 2.9 2.83
40789442114 3.7 3.63
40793346639 3.3 3.36

Why 4.7

Any threshold from 4.2 to 5.2 gives the same verdicts on every recorded window: the exempted bursts' pairs reach 4.15 at most (40634705341), and the sustained windows' pairs are 5.24 at least (40789442114). 4.7 sits in the middle of that range. A unit test pins it: every void fixture's pair is at least 5.2, every burst's is under 4.2, and IDLE_RUN.pairLoad is their midpoint.

40502284016, reclassified as a burst

The runtime floor's fourth run was voided on its peak, 7.7. Its shape is a burst: 2.5, 7.7, 5.4, 3.7, 2.7 across samples 7 to 11, a 30 s pair of 2.76. It was a diagnostic run, so no record value changes retroactively: DAEMON_IDLE_RUNTIME_FLOOR stays the three runs it was recorded from, and its comment now says the run is valid under this rule.

The baselines and bounds in daemon-idle.ts are unchanged.

The lines

Each line form that prints a load prints the pair beside it, so a reader sees why a window that peaked still counted:

  • idleLine, floorLine, mawsdLine: … · load 7.6 (30 s pair 2.6)
  • enrolledLine: … · load 3.1 (30 s pair 2.0) enrolled, 2.9 (30 s pair 1.8) unenrolled
  • abaLine, per window: (maws-supervisor 66120 KiB 0.11 s; load 3.1, 30 s pair 2.3)

The JSON record carries loadPair beside load.

The diagnostics (recorded only, never in the verdict)

Each sample in the record now carries:

  • cpuTimesMs: the cores' cumulative os.cpus() times (user, nice, sys, idle, irq, summed over the cores, in ms), and busyShare, the interval's 1 − idle delta / total delta. Null at the first sample, which has no interval behind it.
  • topProcess: the process outside the measured set that used the most CPU over the interval, { pid, name, cpuS }. It comes from CPU-time deltas between two samples' process tables, so a burst between samples is caught even after it ends. A process started since the last table (or a reused pid, told apart by its start time) counts all its time. One that started and exited within the interval is in neither table.

The process table is one ps -axo pid=,lstart=,time=,comm= per sample. It replaces the per-process ps -o lstart= liveness check that opened each sample, and it serves that check too. So a sample spawns no more processes than before: the same count with one measured process, one fewer per measured process beyond the first. On the MacBook the full table costs about 60 ms of CPU (about 890 processes), once every 30 s. os.cpus() spawns nothing.

The local run (this MacBook, the recording end to end)

pnpm e2e:daemon-idle at 9293fb3, built and run on the MacBook (12.9 min). The load verdict means nothing here, because the Mac was loaded (1-minute load 18 to 59). The run shows that the recording and the line work end to end:

[daemon-idle] footprint 107634 KiB (median of 21) · rss 107456 KiB · cpu 0.12 s over 600 s · processes mawsd 34417 KiB, maws-supervisor 73217 KiB · over the bound 99145 KiB and 1.12 s: the footprint 107634 KiB is 8489 KiB over the bound 99145 KiB · electron 44.4.5, the runtime floor's · load 58.9 (30 s pair 70.9)
  • Its reason, as the record holds it: the 1-minute load reached 58.9 and its 30 s pair 70.9 (a valid run stays under 5 throughout, or its 30 s pair under 4.7).
  • test-results/daemon-idle.json carries loadPair beside load, run.pairLoad: 4.7, and on each of its 21 samples cpuTimesMs, busyShare and topProcess. The two diagnostics are null only at the first sample. The busy share read 0.49 to 0.99. The top process outside the measured set was another session's bfs in 9 of 20 intervals, at up to 94 CPU seconds in one 30 s interval.

Gates

  • The head, ef0c5b9 (a2fc850 with master merged in after P5 O2: a memory-reducing collection at each entry into idle (Decision Log 124, owed (2)) #324 landed): ci-gate --gates static,unit,probes --runner macos --class1a pool, run 40838998539, green, with no flaky line. An earlier run on the same head, 40833617184, failed twice in unit 3/4 on src/mawsd/cli-prompt.test.ts's ^C case (expected 'Enrollment code: CODE-PART…' not to contain 'CODE-PART'), once in its first attempt and once on --failed rerun. That is a known pty echo-off race, in a file this branch doesn't touch (friction entry MAWS/live/cli-prompt-ctrl-c-test-echoes-code-flake.md), and the same master passed it in P5: a machine key speaks for one ref whatever the route (409 key-held), and one member-email grammar #338's gate.
  • The head, a2fc850: ci-gate --gates static,unit,probes --runner macos --class1a pool, run 40814830096, green: plan, static, probes and unit 1/4 to 4/4. No flaky line. The same set on 9293fb3, whose tree differs only by the one comment line, was green too: run 40813596127.
  • Coverage advice named only e2e:default ("specs reach e2e/daemon-idle.spec.ts, test/support/daemon-idle.ts"). It is not a hosted group: it runs on the Mac lane, and the daemon-idle spec skips there without MAWS_DAEMON_IDLE_PERF=1. So it was not added. The local run above loads and runs the spec end to end. No measured group was run through CI.
  • Locally: npx vitest run --project node test/support/daemon-idle.test.ts, 39 passed. Against the old implementation 17 failed first: the old rule voided the bursts (40805962574: … reached 7.6), the lines lacked the pair, and the new functions were absent. One of the 17 was the exemption test's own spread count, which I retuned (784 series under 5, against a floor of 1,000). tsc --noEmit for tsconfig.node.json and tsconfig.e2e.json, and eslint on the three files, clean. Nothing else imports the module.
  • An independent review (reviewer-medium) of 9293fb3 found nothing material.

Not changed

The O2 plan's M1 acceptance (docs/doperpowers/plans/2026-10-27-p5-o2-mawsd.md, "A run is valid when the absolute 1-minute load stays under 5 at every one of the window's samples") still states the peak rule. It is M1's record, so it is left to the architect's Decision Log entry for this ruling.

Commits

Sminos-Session: p5-desk-track-owner#b4948247 (doperpowers on macbook)

…from the peak rule (the architect's Rule B at 4.7)

A window is void on load only when its 1-minute peak reaches 5 and its 30 s pair reaches 4.7: the highest load two
adjacent 30 s intervals both held, each interval's own load rebuilt from the 1-minute series at the nominal spacing,
u_t = (l_t - e^-0.5 l_(t-1)) / (1 - e^-0.5). The pair guards the peak rule and can only exempt; a seeded spread of 4,003
series pins that, and a rule voiding on the pair alone fails it. The boundary windows are unit fixtures, their recorded
21-sample series copied literally and run through invalidReasons: void 40789442114, 40793346639 and 40647561480; valid
the bursts 40805962574, 40809164967, 40634705341 (the highest exempted pair, 4.15, the threshold's lower edge) and the
runtime floor's 40502284016, reclassified as a burst by its shape (a diagnostic run: the floor record stands). Every
line that prints a load prints the pair beside it, `load 7.6 (30 s pair 2.6)`, and the void reason names it.

Each sample also records two diagnostics no verdict reads: the cores' cumulative os.cpus() times with the interval's
busy share, and the process outside the measured set that used the most CPU over the interval. Both come from reads the
sample already makes or that spawn nothing: one `ps -axo pid=,lstart=,time=,comm=` table replaces the per-process
liveness check, so a sample spawns no more processes than before.

Sminos-Session: p5-desk-track-owner#b4948247 (doperpowers on macbook)
…ct's Decision Log entry

Sminos-Session: p5-desk-track-owner#b4948247 (doperpowers on macbook)
Sminos-Session: p5-desk-track-owner#b4948247 (doperpowers on macbook)
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-10-29T08:04:10.224022Z
We couldn’t complete this review. Comment @codex review to try again.
ef0c5b9 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

…e2e launches)

Sminos-Session: p5-desk-track-owner#b4948247 (doperpowers on macbook)
@SSFSKIM
SSFSKIM merged commit b22b7e4 into master Oct 29, 2026
SSFSKIM added a commit that referenced this pull request Oct 29, 2026
…s; the O2 plan's validity sentence points to it; the load-rule tracker row closed

Sminos-Session: GUI AI agent workspace charter#37052769 (MAWS on macbook)
SSFSKIM added a commit that referenced this pull request Oct 29, 2026
…he spine series

The three daemon-idle files: the imports join both sides; the spine case keeps M5's spineLine, SPINE_RELEASED_RUN and the 'spine alone' case on master's Rule B. SPINE_RELEASED_RUN gains pairLoad (IdleRun now names it), the spine line prints each window's 30 s pair as master's lines do, and its test fixtures carry loadPair. services.js and its three chunks are byte-identical to 4c3fcbe's.

Sminos-Session: GUI AI agent workspace charter#37052769 (MAWS on macbook)
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