Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/omega-mv/patches/7291a9156ece8bd2 # omega-mv Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance. Brought by drakestapleton Sign in to star 1 stars 0 watching About Files History Releases Proposed changes Issues For developers ## tests: speed checks time only repetitions the machine did not disturb (RX-HOST-REFERENCE) closed `7291a9156ece8bd2` #585 · opened 2026-10-19 18:44 UTC · closed 2026-10-29 19:01 UTC Imported from GitHub aien-dev/omega-mv#585, by drakestapleton Base `a8ffd2b912c84197d08f963b05f9c7d8b30a3f8a` · Head `a1126aaf6764ff072a65b33a9cdab12500bb25f2` drakestapleton wrote on 2026-10-19 18:44 UTC The two speed checks in the action graph and workflow fusion tests (`4 workers must be at least 2x faster than 1`, `a fused fragment must not be slower`) fail on a busy shared machine for a reason that has nothing to do with the code: when other jobs hold the cores, the 4-worker run waits for a core and takes longer. They made OMEGA-RX-HOST-REFERENCE fail on heads that do not touch the runtime. ## What changes Each repetition now reads, per thread, the time the kernel says the thread was runnable but waiting for a core (`/proc//task//schedstat`, field 2). A repetition whose threads waited more than 50 microseconds plus 2% of its own length is set aside and run again. The work, the statistic (the median) and the threshold are unchanged; they are simply taken over repetitions the machine did not disturb. If too few clean repetitions come within the attempt budget, the check FAILS with "machine too busy to time". A busy machine can therefore never turn into a pass, and a slowdown the code causes itself disturbs every repetition and fails. Every attempt is still checked for equal outcomes. Files: `tests/runtime/rx_quiet_reps.h` (new), `rx_action_graph.c`, `rx_workflow_fusion.c`, one line in `spec/action-graph-ir.md`. No runtime code changes. ## Evidence (full write-up: Spark `~/handoffs/2026-10-19-gates-fix-2.md`) - Red on main at load 36: action graph failed 4 of 5, fusion 4 of 5. - Green on this branch: action graph 3 of 3 at load 27 to 28 (speedup 3.88 to 3.91x, the quiet-machine figure), fusion 3 of 3 at load 20. - Interleaved old / new / mutant, 5 rounds, load about 20: main passed 4 of 5, new passed 10 of 10, mutant failed 10 of 10. - Mutant (a real slowdown: one lock around every node's work) fails both checks on their real thresholds (speedup 0.96 to 0.98; fragment not refused), not on "too busy". - Full gate step `tests/gates/run.sh rx-host-reference`, interleaved: branch PASS twice at load 14 to 22, main FAIL twice. Crumbs compiled with the pinned tool (`d0f0b95d`). Refs the OMEGA-RX-HOST-REFERENCE failures on #565 (`68a3a614`). drakestapleton wrote on 2026-10-29 19:01 UTC Closing in org cleanup (Drake, 2026-10-29): superseded by PR #598 and abandoned with merge conflicts. Replacement: PR #598. Reopen if still needed. ### Apply it ``` git checkout -b patch-7291a9156ece8bd2 a8ffd2b912c84197d08f963b05f9c7d8b30a3f8a curl -fsSL https://interplane.io/drakestapleton/omega-mv/patches/7291a9156ece8bd2.patch | git am ``` Raw patch (mbox) · Diff ### Provenance This proposal is imported from GitHub; it is not signed by its author. Its import statement and source record: ``` github-import 1 aien-dev/omega-mv 585 a1126aaf6764ff072a65b33a9cdab12500bb25f2 ``` ``` {"kind":"github-import","owner":"aien-dev","repo":"omega-mv","number":585,"url":"https://github.com/aien-dev/omega-mv/pull/585","export_sha256":"7319147b350ad908bf0b731068ec3be7b8dee848041dc862f71455e8e4680140","imported_utc":"2026-11-18T16:35:53Z"} ``` ### Changes ``` diff --git a/.crumb b/.crumb index d121d2dad..deb6bfe4f 100644 --- a/.crumb +++ b/.crumb @@ -71,8 +71,8 @@ "purpose": "Directory research. Purpose not yet described by a human." }, { - "digest": "6327473d41e10acbf43be0918d3557509322bfd7d6e075e114c79c2600a47305", - "last_commit": "43d8d20d", + "digest": "9289fdc052f3890619d4fe73f6f06d659345df1ea9bc83ef95f25abd7e94d381", + "last_commit": "4d41a40d", "name": "spec", "purpose": "Directory spec. Purpose not yet described by a human." }, @@ -83,8 +83,8 @@ "purpose": "Directory src. Purpose not yet described by a human." }, { - "digest": "4eb9d4d76234448c0ed691f0aeb9c90d785f8a47b1b1291d728bbe3e1509dc10", - "last_commit": "88e24bdd", + "digest": "f398ff3e6cc63ccc6dc26842697df3733b7e28a582858dc2b53c087e8c003e54", + "last_commit": "4d41a40d", "name": "tests", "purpose": "Directory tests. Purpose not yet described by a human." }, @@ -95,15 +95,15 @@ "purpose": "Directory tools. Purpose not yet described by a human." } ], - "children_root": "sha256:e1a8c008214ad5dbc33a3e184d7e882dc56d1d50f9bd14c58f8773992961557e", - "compiled_at": "2026-10-18T21:10:38Z", + "children_root": "sha256:75604dd94829da3b5954433fd2381780784b8beba2ba93278f250870baae006e", + "compiled_at": "2026-10-19T15:10:01Z", "compiler": "crumb-compile/1", - "digest": "sha256:be7220db494238bb4c33023d1df17286c35f947336bee5fc2e0405c136ec3e73", + "digest": "sha256:eac81d4638859ce6f9c12de6b446de7813ff6a94371e86b22f49fa47665f6248", "evidence_files": 11127, "evidence_root": "sha256:4528085ec1661c442b64fb5dc8def65067ea2620ff88e42bcf52d58b7642ea6e", - "files": 14100, - "generated_at_commit": "f4a9849fb127f8d2d664dfc56890752ad180c507", - "source_tree": "sha256:21f93defce6c9ba159a4bd31083db787e156dfaa4afb80c3427cf88f732f8258" + "files": 14101, + "generated_at_commit": "4d41a40daf1bd5cfd0feaaf6860d17d63c477af6", + "source_tree": "sha256:e82718e714db187efedb822c8b098ecf6b23d31f8ce33cf295fc73a34e73846d" }, "owner_lane": "", "provenance": { diff --git a/spec/.crumb b/spec/.crumb index e63063df8..aaa27408b 100644 --- a/spec/.crumb +++ b/spec/.crumb @@ -20,14 +20,14 @@ } ], "children_root": "sha256:6834a3241647d3a098283d4eafedbdb1428dfa4d834f9ed5f22025b6d2303093", - "compiled_at": "2026-10-16T07:53:23Z", + "compiled_at": "2026-10-19T15:10:01Z", "compiler": "crumb-compile/1", - "digest": "sha256:6327473d41e10acbf43be0918d3557509322bfd7d6e075e114c79c2600a47305", + "digest": "sha256:9289fdc052f3890619d4fe73f6f06d659345df1ea9bc83ef95f25abd7e94d381", "evidence_files": 0, "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "files": 58, - "generated_at_commit": "4197e0bb49ad1e67d9dac37f259246470ffecedc", - "source_tree": "sha256:2130510e8275fd1ae1fdf6078a82521c7ac2fe0ea6ada8a9d1156f0f2ba191fd" + "generated_at_commit": "4d41a40daf1bd5cfd0feaaf6860d17d63c477af6", + "source_tree": "sha256:8600186ce7e305d32c916b5ba572ab49a9e268bad784c75c51f7ec6f8d5acc10" }, "owner_lane": "", "provenance": { diff --git a/spec/action-graph-ir.md b/spec/action-graph-ir.md index c9573125c..61ea8bfb5 100644 --- a/spec/action-graph-ir.md +++ b/spec/action-graph-ir.md @@ -172,7 +172,7 @@ chain. The effect object holds count, last value, an order chain | Claim | How | |---|---| | same semantic result as sequential reference | every run: status, value and evidence of every node, outcome, effect chain | -| lower critical path for parallel graphs | 1 vs 4 workers, same lowered graph, median of 15 runs, pinned to one core class | +| lower critical path for parallel graphs | 1 vs 4 workers, same lowered graph, median of 15 runs the machine did not disturb (run-queue delay from schedstat, `tests/runtime/rx_quiet_reps.h`), pinned to one core class | | zero authority bypass | every commit to a boundary target comes from a lowered boundary reaction; stolen, revoked, forged and tampered cases blocked; compile mints nothing | | zero missing evidence | every evidence node of every successful run has its word | | same causal ancestry | per node, crumb parents inside the run's episode reach exactly the graph's ancestors and the run token | diff --git a/tests/.crumb b/tests/.crumb index bd5535a8b..9872aff61 100644 --- a/tests/.crumb +++ b/tests/.crumb @@ -265,8 +265,8 @@ "purpose": "Reservoir tests (omega#440): Gate 1 simulator and readout checks against an independent binary64" }, { - "digest": "bc2b514054f69604a155900fb1884948a78e12b88a15852296cbea1f751055b2", - "last_commit": "501d555c", + "digest": "61b604608d568b57aec1467b55f880359c2414d322cfa8f0aea72352b3b2dadb", + "last_commit": "4d41a40d", "name": "runtime", "purpose": "Directory tests/runtime. Purpose not yet described by a human." }, @@ -295,15 +295,15 @@ "purpose": "Directory tests/visor. Purpose not yet described by a human." } ], - "children_root": "sha256:ddc3618190458bc5073e3bee67ffccc68a2ee9f065f2cb0d86545386a29fddf8", - "compiled_at": "2026-10-16T19:04:20Z", + "children_root": "sha256:582e8ddf66251d4bf0a88108fc4f4d091490024efee28fb7b5543619f736b915", + "compiled_at": "2026-10-19T15:10:01Z", "compiler": "crumb-compile/1", - "digest": "sha256:4eb9d4d76234448c0ed691f0aeb9c90d785f8a47b1b1291d728bbe3e1509dc10", + "digest": "sha256:f398ff3e6cc63ccc6dc26842697df3733b7e28a582858dc2b53c087e8c003e54", "evidence_files": 16, "evidence_root": "sha256:96d08097822ad95f4e562c19e0ba5df5a035774c48632f1832912c40a27bd27a", - "files": 1270, - "generated_at_commit": "88e24bdd57b27817d030d0ad95f62c3f3eacf426", - "source_tree": "sha256:e6c4f0021d383ba2e59da0d85d06a0b98170f6d188289c891b5745200548e6fc" + "files": 1271, + "generated_at_commit": "4d41a40daf1bd5cfd0feaaf6860d17d63c477af6", + "source_tree": "sha256:af575470adb33eeb7568b9511607a1b0c2a82e009ddfd17dbe0c2f4ade76082d" }, "owner_lane": "", "provenance": { diff --git a/tests/runtime/.crumb b/tests/runtime/.crumb index 48918ae9f..01b987384 100644 --- a/tests/runtime/.crumb +++ b/tests/runtime/.crumb @@ -7,14 +7,14 @@ "generated": { "children": [], "children_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "compiled_at": "2026-10-13T02:12:57Z", + "compiled_at": "2026-10-19T15:10:01Z", "compiler": "crumb-compile/1", - "digest": "sha256:bc2b514054f69604a155900fb1884948a78e12b88a15852296cbea1f751055b2", + "digest": "sha256:61b604608d568b57aec1467b55f880359c2414d322cfa8f0aea72352b3b2dadb", "evidence_files": 0, "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "files": 70, - "generated_at_commit": "95829f2abd7f66461b4ba153ea807f39e9d06db8", - "source_tree": "sha256:e037c5156071865094d0e60262d34ca920be2dd6f98e2603a1f0082330ba7841" + "files": 71, + "generated_at_commit": "4d41a40daf1bd5cfd0feaaf6860d17d63c477af6", + "source_tree": "sha256:e07c4484944a6eaf04726b0a1afee08e87427134a3356847db8a546091e0a985" }, "owner_lane": "", "provenance": { diff --git a/tests/runtime/rx_action_graph.c b/tests/runtime/rx_action_graph.c index 55efd1dbb..6acbd0a6d 100644 --- a/tests/runtime/rx_action_graph.c +++ b/tests/runtime/rx_action_graph.c @@ -29,6 +29,7 @@ #include #include #include +#include "rx_quiet_reps.h" enum { SUBJ_EXTERNAL = 100, ISSUER = 3, SUBJ_PLAN = 61, SUBJ_OTHER = 62 }; @@ -794,9 +795,12 @@ static void t_effects(void) { static void t_parallel(void) { printf("[*] parallel graph: critical path\n"); - const uint32_t reps = 15; + /* 15 undisturbed repetitions per leg (rx_quiet_reps.h), at most 60 times + * as many attempts. */ + const uint32_t reps = 15, attempts = 15 * 60; uint64_t times[2][32]; - uint32_t workers[2] = { 1, 4 }; + uint32_t workers[2] = { 1, 4 }, kept[2] = { 0, 0 }, tried[2] = { 0, 0 }; + int delay_known = 1; AgReport rep; for (uint32_t k = 0; k < 2; k++) { Env e; @@ -811,14 +815,28 @@ static void t_parallel(void) { CHECK(res.outcome == AG_RUN_SUCCESS && res.value[node_of_kind(&g, AG_SKILL)] == 7 + 500 * 3 + 40 * 6 + 7 * 9 + 3 * 12, "combine = 7 + 3*500 + 6*40 + 9*7 + 12*3"); - for (uint32_t i = 0; i < reps; i++) { + for (uint32_t i = 0; i < attempts && kept[k] < reps; i++) { reference(&e, &g, 2 + i); - int64_t ext = run(&e, &L, 2 + i, &res, ×[k][i]); + uint64_t ns = 0; + int64_t d0 = rx_run_delay_ns(); + int64_t ext = run(&e, &L, 2 + i, &res, &ns); + int64_t d1 = rx_run_delay_ns(); compare(&e, &g, &res, &g_ref, "parallel"); if (i == 0) ancestry(&e, &L, ext, "parallel"); + tried[k]++; + if (d0 < 0 || d1 < 0) delay_known = 0; + if (rx_quiet_rep(d0 < 0 || d1 < 0 ? -1 : d1 - d0, ns)) times[k][kept[k]++] = ns; } env_stop(&e); } + printf(" undisturbed repetitions: 1 worker %u of %u, %u workers %u of %u (%s)\n", kept[0], + tried[0], workers[1], kept[1], tried[1], + delay_known ? "run-queue delay from schedstat" : "schedstat missing: every repetition counts"); + if (kept[0] < reps || kept[1] < reps) { + CHECK(0, "machine too busy to time the parallel graph: %u and %u of %u undisturbed " + "repetitions in %u attempts", kept[0], kept[1], reps, attempts); + return; + } for (uint32_t k = 0; k < 2; k++) for (uint32_t i = 1; i < reps; i++) for (uint32_t j = i; j > 0 && times[k][j - 1] > times[k][j]; j--) { diff --git a/tests/runtime/rx_quiet_reps.h b/tests/runtime/rx_quiet_reps.h new file mode 100644 index 000000000..95944424d --- /dev/null +++ b/tests/runtime/rx_quiet_reps.h @@ -0,0 +1,67 @@ +/* Speed checks on a shared machine: keep only the repetitions the machine did + * not disturb. + * + * A stopwatch check compares wall times. On the Spark other jobs share the + * cores, and a run whose threads sat runnable without a core (the kernel's + * run-queue delay) is longer by time the code under test never asked for. + * That delay is measured, not guessed: /proc/self/task//schedstat field 2 + * is the time each thread of this process has spent runnable but waiting for + * a CPU (Documentation/scheduler/sched-stats.rst, "time spent waiting on a + * runqueue"). A repetition whose threads waited more than the allowance below + * is set aside and run again; the check then takes the same statistic (the + * median) with the same threshold over undisturbed repetitions only. + * + * Nothing is loosened: the work, the statistic and the threshold are the + * ones the check always had. A real slowdown is in every repetition, + * undisturbed ones included, so it still fails. When too few repetitions are + * undisturbed within the attempt budget the check fails and says why; a + * busy machine never turns into a pass. Where schedstat is missing every + * repetition counts (the old behaviour) and the output says so. + */ +#ifndef RX_QUIET_REPS_H +#define RX_QUIET_REPS_H + +#include +#include +#include + +/* Allowance: run-queue delay summed over all threads of the process during + * one repetition, at most RX_QUIET_FLOOR_NS plus RX_QUIET_PERMILLE of the + * repetition's wall time. The floor covers waking an idle worker (a few + * microseconds per hand-off on an idle core). */ +#define RX_QUIET_FLOOR_NS 50000ull +#define RX_QUIET_PERMILLE 20ull + +/* Sum of run-queue delay (ns) over every thread of this process; -1 when the + * kernel does not report it. */ +static inline int64_t rx_run_delay_ns(void) { + DIR *d = opendir("/proc/self/task"); + if (!d) return -1; + int64_t sum = 0; + int seen = 0; + struct dirent *de; + while ((de = readdir(d))) { + if (de->d_name[0] < '0' || de->d_name[0] > '9') continue; + char path[288]; + snprintf(path, sizeof path, "/proc/self/task/%s/schedstat", de->d_name); + FILE *fp = fopen(path, "r"); + if (!fp) continue; + unsigned long long on_cpu = 0, waited = 0; + if (fscanf(fp, "%llu %llu", &on_cpu, &waited) == 2) { + sum += (int64_t)waited; + seen = 1; + } + fclose(fp); + } + closedir(d); + return seen ? sum : -1; +} + +/* Whether a repetition of `wall_ns` whose threads waited `delay_ns` for a + * core counts. delay < 0 (not reported) always counts. */ +static inline int rx_quiet_rep(int64_t delay_ns, uint64_t wall_ns) { + if (delay_ns < 0) return 1; + return (uint64_t)delay_ns <= RX_QUIET_FLOOR_NS + wall_ns * RX_QUIET_PERMILLE / 1000ull; +} + +#endif diff --git a/tests/runtime/rx_workflow_fusion.c b/tests/runtime/rx_workflow_fusion.c index 5f3e56ff4..2897358e5 100644 --- a/tests/runtime/rx_workflow_fusion.c +++ b/tests/runtime/rx_workflow_fusion.c @@ -40,6 +40,7 @@ #include #include #include +#include "rx_quiet_reps.h" enum { SUBJ_EXTERNAL = 100, ISSUER = 3, SUBJ_PLAN = 61, SUBJ_PROPOSER = 71, SUBJ_PROMOTER = 72 }; @@ -1040,27 +1041,58 @@ static void measure(AgMetaSkill *m, uint32_t goal, AgFusionMeasure *ms, int with AgResult ro, rf; for (uint64_t r = 1; r <= 3; r++) pair_run(p, r, a_value(r), &ro, &rf, NULL, NULL, 0); enum { RUNS = 41 }; + /* RUNS undisturbed pairs (rx_quiet_reps.h): a pair counts only when + * neither leg's threads waited for a core, at most 60 attempts per pair. + * Every attempt is still checked for the same outcome on both legs. */ + enum { ATTEMPTS = RUNS * 60 }; uint64_t ns_o[RUNS], ns_f[RUNS], cpu_o = 0, cpu_f = 0, cr_o = 0, cr_f = 0, cm_o = 0, cm_f = 0; - for (uint64_t i = 0; i < RUNS; i++) { - uint64_t id = 10 + i, a = a_value(id); + uint32_t kept = 0, tried = 0; + int delay_known = 1; + for (uint64_t i = 0; i < ATTEMPTS && kept < RUNS; i++) { + uint64_t id = 10 + i, a = a_value(id), t_o = 0, t_f = 0; set_inputs(&p->o, a, id); set_inputs(&p->f, a, id); uint64_t c0 = p->o.w.n_crumbs, t0 = cpu_ns(); - run(&p->o, &p->lo, id, &ro, &ns_o[i]); - cpu_o += cpu_ns() - t0; - cr_o += p->o.w.n_crumbs - c0; - cm_o += commits_between(&p->o, c0, p->o.w.n_crumbs); + int64_t d0 = rx_run_delay_ns(); + run(&p->o, &p->lo, id, &ro, &t_o); + int64_t d1 = rx_run_delay_ns(); + uint64_t u_o = cpu_ns() - t0, k_o = p->o.w.n_crumbs - c0; + uint64_t m_o = commits_between(&p->o, c0, p->o.w.n_crumbs); c0 = p->f.w.n_crumbs; t0 = cpu_ns(); - run(&p->f, &p->lf, id, &rf, &ns_f[i]); - cpu_f += cpu_ns() - t0; - cr_f += p->f.w.n_crumbs - c0; - cm_f += commits_between(&p->f, c0, p->f.w.n_crumbs); + int64_t d2 = rx_run_delay_ns(); + run(&p->f, &p->lf, id, &rf, &t_f); + int64_t d3 = rx_run_delay_ns(); + uint64_t u_f = cpu_ns() - t0, k_f = p->f.w.n_crumbs - c0; + uint64_t m_f = commits_between(&p->f, c0, p->f.w.n_crumbs); + tried++; + CHECK(ro.outcome == rf.outcome, "%s: attempt %u: outcomes differ", what, tried); + if (d0 < 0 || d1 < 0 || d2 < 0 || d3 < 0) delay_known = 0; + if (!rx_quiet_rep(delay_known ? d1 - d0 : -1, t_o) || + !rx_quiet_rep(delay_known ? d3 - d2 : -1, t_f)) + continue; + ns_o[kept] = t_o; + ns_f[kept] = t_f; + kept++; + cpu_o += u_o; + cr_o += k_o; + cm_o += m_o; + cpu_f += u_f; + cr_f += k_f; + cm_f += m_f; ms->ok_before += ro.outcome == AG_RUN_SUCCESS; ms->failed_before += ro.outcome == AG_RUN_FAILURE; ms->ok_after += rf.outcome == AG_RUN_SUCCESS; ms->failed_after += rf.outcome == AG_RUN_FAILURE; } + printf(" %s: undisturbed pairs %u of %u (%s)\n", what, kept, tried, + delay_known ? "run-queue delay from schedstat" : "schedstat missing: every pair counts"); + if (kept < RUNS) { + CHECK(0, "%s: machine too busy to time: %u of %u undisturbed pairs in %u attempts", what, + kept, RUNS, (unsigned)ATTEMPTS); + pair_stop(p); + return; + } qsort(ns_o, RUNS, sizeof ns_o[0], cmp_u64); qsort(ns_f, RUNS, sizeof ns_f[0], cmp_u64); ms->runs = RUNS; ```