interplane.Get Omega
Read in your language

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

branch main Branches Tags History

omega-mv / spec / workflow-fusion.md

225 lines · 12387 bytes Raw Blame History Rendered
1# Omega verified workflow fusion (OMEGA_WORKFLOW_FUSION)
2
3Code: `src/runtime/rx_fusion.{c,h}`, plus the `AG_META` node kind in
4`src/runtime/rx_graph.{c,h}`. Test: `tests/runtime/rx_workflow_fusion.c`,
5`make test-workflow-fusion`. Receipt: `evidence/WORKFLOW_FUSION/`.
6
7## Purpose
8
9Omega runs the same verified action-graph fragments again and again. When a
10fragment `A -> B -> C -> D` keeps coming back with the same semantic
11dependencies, the same authority pattern and the same result contract, a low
12failure rate and stable evidence, Omega may propose it as a **MetaSkill**:
13one node that does what the steps did, with fewer reactions, crumbs and
14scheduling rounds per run.
15
16A MetaSkill never replaces behaviour silently. It starts as a candidate and
17only becomes usable after verification, measurement, a canary, promotion
18through the generation barrier and publication into the Skill Net table.
19`rx_fusion_compile` applies only published MetaSkills and reports each fusion
20it made; everything else in its library is refused and counted.
21
22## Pipeline
23
24| Stage | What happens | State after |
25|---|---|---|
26| observe | `rx_fusion_observe` takes a run only when the lowered result equals the sequential reference on every node (status, value, evidence, step evidence), the outcome is decided, and every evidence node of a successful run has its word. Fragments are enumerated and grouped by signature. | pattern |
27| judge | too small; evidence unstable (a repeated input gave a different result or step evidence); failure rate over the policy; too few occurrences; seen in too few graphs | candidate or not |
28| build | `rx_fusion_build`: ancestry, contracts derived from the fragment, realization, reference graph, observed samples | CANDIDATE |
29| verify | `rx_fusion_verify` against the reference fragment | VERIFIED / REJECTED |
30| measure | original and fused side by side; `rx_fusion_accept_measure` | MEASURED / SLOWER |
31| canary | fused graph in shadow beside production; `rx_fusion_canary` | CANARY_PASSED / QUARANTINED |
32| promote | `rx_fusion_promote`: an R9 generation carrying the realization bytes, identities, contracts and figures; the promotion right is checked on the native authority; the proposer cannot promote its own candidate | PROMOTED |
33| publish | `rx_fusion_publish`: the promoted generation must be active and its bytes must equal the MetaSkill as it is now | PUBLISHED |
34
35REJECTED, SLOWER and QUARANTINED are final.
36
37## What a fragment may hold
38
39So that one node means exactly what the steps meant:
40
41- steps: CONST, PURE, WORLD_READ, RECALL, PHYSICAL, SKILL, RETRY,
42 EFFECT_PROPOSE, and VERIFY as the exit;
43- never an effect boundary (WORLD_PUBLISH, EFFECT_PERFORM). The effect chain
44 stays as it was, by construction;
45- no BRANCH or JOIN, no control dependency touching a step, no ON_FAIL edge
46 between steps; an outside source may feed the fragment by ON_FAIL, and one
47 source never feeds it in both modes;
48- one exit: the only step whose result leaves the fragment; every step is an
49 ancestor of the exit; no step but the exit is an evidence or condition node;
50- the authority of the steps is READ on the objects they read, nothing else;
51- it fits one reaction: ports + objects + run token + own cell + one
52 authority-slot wake ≤ `RX_MAX_DEPS` (8), at most 4 ports and 2 objects.
53 Larger fragments are counted (`fragments_over_budget`) and never proposed.
54
55Enumeration grows each fragment backwards from its exit, adding a producer
56only when every consumer of that producer is already inside, so every set is
57convex and single-exit.
58
59## The MetaSkill
60
61```
62AgMetaSkill {
63 id, state, identity
64 ancestry[] graph digest, run, exit origin of the runs it came from
65 input_contract type and edge mode per port
66 output_contract type, may fail
67 authority_contract READ per object slot, nothing else
68 resource_contract merged need of the steps
69 effect_contract performs 0, publishes 0, proposals n
70 realization COMPILED | LEARNED | HYBRID | HARDWARE
71 reference the fragment as observed (a step program)
72 samples[] observed inputs and what the reference produced
73 verdict, measure, canary counts, generation
74}
75```
76
77Contracts are derived from the fragment, never chosen. The identity is
78SHA-256 over the id, contracts, realization identity, reference signature and
79ancestry.
80
81### Realizations
82
83A realization is not assumed to be text or code.
84
85- **Compiled**: the step program — steps in canonical order (post-order from
86 the exit over data inputs by port), inputs resolved to a port or an earlier
87 step — run in one reaction. Each step runs through the same node semantics
88 the graph uses (`semantics()` in rx_graph.c).
89- **Learned**: a table learned from verified observations (inputs, the World
90 fields read, result, step evidence). Nothing else: outside what it saw it
91 cannot run, so verification rejects it (`not_runnable`). It is kept as a
92 contract kind, not promoted.
93- **Hybrid**: the learned table, and the step program on a miss.
94- **Hardware**: a contract slot. No hardware realization exists on this host;
95 verification rejects it (`not_runnable`).
96
97### The AG_META node
98
99`AG_META` is an action-graph node kind. `op` is the skill id; `imm`/`imm2`
100hold the first 128 bits of the realization identity the node was built for,
101and the node runs only a published realization with that identity. It carries
102its input contract (`in_type`) and its object slots (`mobj`). Lowering gives
103it one reaction reading its ports, its objects, the run token and its cell;
104authority is derived from its objects (READ each). Its cell field 5 holds the
105**step evidence**: the chain `H(acc, local step identity, status, value,
106inputs)` over the steps that ran, which is exactly what the original steps
107would have recorded. Identity, validation, dependency budgets, CSE, the
108effect-ordering rule and the sequential reference all know the kind.
109
110## Verification
111
112`rx_fusion_verify` first checks, in order, and rejects on the first failure:
113
1141. identity: resealed reference and realization, realization identity and
115 MetaSkill identity equal what it carries;
1162. contracts: input/output contracts equal those derived from the reference;
117 the realization's program signature equals the reference's;
1183. authority equivalence: READ per slot, equal to the reference's;
1194. effect equivalence: no boundary in reference or realization; effect
120 contract equal;
1215. resource contract equal.
122
123Then it runs vectors. Both sides run in the sequential reference: the
124original fragment step by step as ordinary graph nodes, the candidate as one
125`AG_META` node, behind the same port drivers (each port ends OK with a value,
126FAILED, or SKIPPED):
127
128- every observed sample: the fragment must reproduce what was recorded, and
129 the candidate must agree with the fragment;
130- every combination of OK / FAILED / SKIPPED over the ports, each with value
131 and World sets (zeros, ones, all-ones, three random ranges, and the bounds
132 of the steps' checks).
133
134Per vector: exit status, value and attempts (semantic equivalence; failure
135behaviour when a port was not OK or the exit was not OK), and step evidence
136(evidence equivalence). Any mismatch rejects.
137
138What each check catches (all exercised by the test): narrowed or widened
139authority → authority; a claimed effect → effect; a change without a new
140identity → identity; a changed program step → contract; a learned wrong value
141→ semantic; a learned right value with wrong evidence → evidence; a learned
142failure turned into success → failure behaviour; the reference and the
143realization rewritten together → semantic (it no longer reproduces the
144observations), and it matches no real workflow anyway.
145
146Tampering with contracts cannot widen authority at run time either: a fused
147node's authority is derived from its objects, and `rx_fusion_apply` checks
148that it equals exactly the union of the replaced steps' authority.
149
150## Measurement
151
152Original and fused graphs run side by side in two worlds with the same inputs,
15341 interleaved runs each at 4 workers, pinned to one core class:
154
155- cognitive operations avoided: reactions that computed per run, crumbs per
156 run;
157- latency: median run time;
158- resource use: process CPU time per run, reactions registered, World objects;
159- success and failure counts;
160- energy: the `aien_spbm` package and performance-core accumulators, two
161 rounds of idle / original / idle / fused / idle (1 s each), idle power
162 subtracted, the spread between rounds reported. A difference inside twice
163 the spread is reported as not resolved. On a machine without the meter the
164 receipt says `unavailable`.
165
166Accepted when fewer reactions compute per run, the median is within the
167original leg's own spread ((p75 − p25) / median, never less than 5 %) of the
168original, and success and failure counts are equal. The receipt records the
169spread and the tolerance used. A fragment of two
170independent heavy steps is refused (SLOWER): fused, they no longer run side
171by side.
172
173## Canary
174
175The fused graph runs in shadow beside the original on production traffic,
176including inputs never observed. Per run: exit status, value and attempts,
177outcome, the out and effect objects, and the fused node's step evidence
178against the evidence recomputed from the original run. One divergence
179quarantines the MetaSkill for good. The test's poisoned hybrid (one learned
180entry for an input verification never generates) verifies and is then
181quarantined by the canary.
182
183## Promotion and publication
184
185`rx_fusion_promote` proposes an R9 generation carrying the realization's
186canonical bytes (`rx_graph_realization_encode`), the realization and
187MetaSkill identities, the authority contract, the verification, measurement
188and canary figures, and the ancestry, then promotes it with the caller's
189request. The barrier checks the promotion right on the native authority and
190refuses a proposer promoting its own candidate. `rx_fusion_publish` then
191requires the generation to be active and re-reads the bytes: a MetaSkill
192changed after promotion is not published.
193
194`rx_fusion.o` references no Aienux admin operation (checked by the build).
195
196## Gate evidence (what the test proves)
197
198| Claim | How |
199|---|---|
200| observation of verified runs only | a run that differs from its reference is refused |
201| repeated fragments found across graphs | the workflow found in three procedures, with its failure count |
202| unstable / flaky / too-big / single-graph fragments not proposed | judge reasons, budget counter |
203| semantic, authority, effect, evidence, failure-behaviour equivalence | verification of compiled and hybrid; nine tampering cases caught |
204| learned alone and hardware not promoted | both rejected `not_runnable` |
205| never silent | an unpublished MetaSkill (verified, measured, canary-passed, promoted) is not applied and the graph is unchanged; after publication, three unpublished library entries are still refused |
206| benchmark is a real gate | the parallel fragment is SLOWER |
207| canary is a real gate | the poisoned hybrid is QUARANTINED |
208| promotion needs authority | refused without the right and for the proposer |
209| fused graphs equal the originals | every run: lowered == reference (incl. step evidence), original vs fused (exit, outcome, out and effect objects, step evidence), causal ancestry, evidence present, no bypass; determinism at 1, 2, 4, 8 workers |
210| authority removed (golden path N3) | both sides block with BLOCKED_AUTHORITY and perform nothing; the fused node needs READ on A and nothing else; missing authority is reported on it |
211
212## Limits
213
214- Observation and proposal are host calls, not resident reactions.
215- Fragments never contain effect boundaries, branches, joins or control
216 dependencies; one exit; at most 8 steps, 4 ports, 2 objects.
217- A node blocked for authority blocks the whole fused node (the steps before
218 the blocked one do not run either) — conservative, as in the action graph.
219- The compiled realization is a typed step program run in one reaction, not
220 machine code. The learned realization is a table, not a neural module. No
221 hardware realization is built.
222- Energy saved per run is only claimed where it exceeds the meter's
223 round-to-round spread.
224- Host processor only. The authority is the native C library, not the Aienux
225 kernel.