diff options
| author | Agando <roduccomm@gmail.com> | 2026-10-27 11:23:10 +0100 |
|---|---|---|
| committer | Agando <roduccomm@gmail.com> | 2026-10-27 11:23:23 +0100 |
| commit | d2de622744212ea0ba720b3f4212b82940ffe84b (patch) | |
| tree | 9aaa4a6513e5251297bb9160444c12b1d26a3a2e /modules/core/module-predictor.js | |
| parent | 91bfed13d679a76529c6284c7de5f4a87e0d3a0f (diff) | |
fix(newos4): rollback keeps scaffolding, checkpoints cannot collide, tests gate the build
Review of the 08:30 implementer run (v4.6.102, checkpoint name fix). The shipped fix was
correct; these are the defects it introduced or left behind, each measured first.
- virtual-fs.js rollback(): the snapshot strips _snapshots/_sessions/.trash for bloat. Restoring
it verbatim deleted every checkpoint, every agent session and the trash, made rollback
irreversible and unrepeatable. Re-attach the live copies after the root swap.
- checkpoint(): names are millisecond-resolution, so tight calls overwrote each other
(measured 6 calls -> 3 snapshots). Dedupe with a -N suffix, refuse names containing "/"
(written but unlistable), and prune by snapshot createdAt instead of filename sort, which
let a custom name ("aaa-oldest") evict newer auto-named checkpoints.
- module-predictor.js: legacy pre-v2 points have no `usable`, so a 0.079 s aborted run
re-entered similarity as evidence and floored every prediction at 1 s. Backfill `usable`
from the measurement on load, drop the ones it rejects, add a belt-and-braces guard in
_findSimilar and count only usable points as actual executions.
- newos4-maintain.py: run every node-runnable modules/test/test-*.js on each maintenance pass.
The v4.6.102 regression was written but no job ever executed it.
- newos4-steer.py: `done` now requires --commit <sha> that exists in the repo, and gains
`reopen`. A written plan was being closed as done at 06:17 while the predictor fix shipped
nowhere, so the implementer's pre-flight queue was empty.
- steering.json: predictor item reopened, checkpoint item stamped with f7249ff.
- maintenance board: MAINT-002/005/015 were fixed in v4.6.81-85 but still listed open/high;
closed with their commit ids, and MAINT-010/016 annotated with the probes that keep them open.
Tests: test-vfs-checkpoint 23/23 (RED 14/9 before), test-predictor-accuracy 38/38
(T1-T3 RED on HEAD), maintain --fix all PASS, browser round-trip
"Checkpoint created: <name>" -> "Rolled back to checkpoint: <name>" on v4.6.103.
Also carries the already-deployed 2026-10-26 syntax-gate hunk in newos4-maintain.py (syntax_failures + gated rebuild) that had never been committed.
Diffstat (limited to 'modules/core/module-predictor.js')
| -rw-r--r-- | modules/core/module-predictor.js | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/modules/core/module-predictor.js b/modules/core/module-predictor.js index aebda87..b534d34 100644 --- a/modules/core/module-predictor.js +++ b/modules/core/module-predictor.js @@ -118,6 +118,7 @@ class PredictorModule { return this._dataPoints.filter(dp => { if (!dp.observedDuration) return false; // outcomes only, never predictions if (dp.usable === false) return false; // aborted runs are not evidence + if (!(dp.observedDuration >= 1.5)) return false; // belt and braces: never evidence if (dp.features) return this._similarity(features, dp.features) > 0.3; return false; }); @@ -269,7 +270,7 @@ class PredictorModule { // ─── Commands ─── showStatus() { - const actualExecutions = this._dataPoints.filter(dp => dp.observedDuration).length; + const actualExecutions = this._dataPoints.filter(dp => dp.observedDuration && dp.usable !== false).length; const paired = this._accuracy.total; const unpaired = this._dataPoints.filter(dp => dp.paired === false).length; const accPct = paired > 0 ? ((this._accuracy.correct / paired) * 100).toFixed(0) + '%' : 'n/a'; @@ -374,8 +375,16 @@ class PredictorModule { const data = fs.fsReadJSON('/system/metrics/predictor.json'); if (!data) return; - // Prediction-only points are noise for similarity; keep outcomes. - this._dataPoints = (data.dataPoints || []).filter(dp => dp && dp.observedDuration); + // Legacy (pre-v2) points carry no `usable`. Backfill it from the measurement — an + // aborted run must not enter similarity as evidence (measured: a 0.079 s point + // dragged avgDuration to ~0 and floored every prediction at 1 s). + this._dataPoints = (data.dataPoints || []) + .filter(dp => dp && dp.observedDuration) + .map(dp => { + if (typeof dp.usable !== 'boolean') dp.usable = dp.observedDuration >= 1.5; + return dp; + }) + .filter(dp => dp.usable !== false); this._predictions = data.predictions || 0; if (data.v === this._SCHEMA) { |