Repository navigation
P5 O2: the idle window's load rule voids sustained load and passes a burst (Rule B at 4.7) - #340
Merged
Merged
Conversation
…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)
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
…e2e launches) Sminos-Session: p5-desk-track-owner#b4948247 (doperpowers on macbook)
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)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.tsreads the 1-minute load (loadavg()[0]) every 30 s across the 600 s window, 21 samples. Until nowinvalidReasonsvoided 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):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.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.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*.jsonwith its run id, and run through the shippedinvalidReasons.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 shippedinvalidReasonsandloadPair, 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:
die2e:daemon-idle,di-base-baseline,di-floor-floor,di-mawsd-mawsd,di-enrolled-enrolled (windowenrorunenr),di-aba-aba.Two exempted windows read outside their limits at the time. No verdict changes retroactively, but a reader of the record should know:
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 owndaemon-idle-aba.json: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:
invalidReasonsandloadPair(at a2fc850), run on the run's recorded samples, never by hand;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.
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:
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.pairLoadis 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_FLOORstays 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.tsare 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) unenrolledabaLine, per window:(maws-supervisor 66120 KiB 0.11 s; load 3.1, 30 s pair 2.3)The JSON record carries
loadPairbesideload.The diagnostics (recorded only, never in the verdict)
Each sample in the record now carries:
cpuTimesMs: the cores' cumulativeos.cpus()times (user, nice, sys, idle, irq, summed over the cores, in ms), andbusyShare, the interval's1 − 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-processps -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-idleat 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: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.jsoncarriesloadPairbesideload,run.pairLoad: 4.7, and on each of its 21 samplescpuTimesMs,busyShareandtopProcess. 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'sbfsin 9 of 20 intervals, at up to 94 CPU seconds in one 30 s interval.Gates
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 onsrc/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--failedrerun. 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.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.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 withoutMAWS_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.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 --noEmitfor tsconfig.node.json and tsconfig.e2e.json, and eslint on the three files, clean. Nothing else imports the module.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)