writing-omega: per-pin loop bound limits (e5b32567 caps bound at 999999)
open0d5361510ae43236 #216 · opened 2026-11-07 08:00 UTC
Imported from GitHub aien-dev/omega-harness#216, by drakestapleton
Base bd107ca15c40b6cdfef0f23afb03a884fe3c8086 · Head 18b123a5dfe909f471eaf7757e8f028b4858cf7d
drakestapleton wrote on 2026-11-07 08:00 UTC
writing-omega documented only the f4df8239 (omc 3ad9f10f) loop limits and said the MCP pin was f4df8239. Drake's pure-Omega directive (DIRECTIVE-20261107-pure-omega.md) and the running omega MCP server (compiler_sha256 2c82480596bbdc50cda9626866209ef662d5834f278f839ff4ce0250c495029f in an xd://mcp__omega_compile result, 2026-11-07) both use e5b32567, where the limits are narrower. This adds a per-pin table and per-pin notes in writing-omega, and a dated note in aien-repositories next to the omega-mcp entry.
Measured (Spark, Linux AArch64, 2026-11-07)
Compilers: omega-mv/seed/out/omc at e5b32567 (sha256 2c824805...) and git show f4df8239:seed/out/omc (sha256 3ad9f10f...). Each case: omc < case.om > case.bin; echo $?, then run when compile exit is 0. Script: m.sh (7-line programs; full output below).
== 2c824805 (e5b32567)
w999999 compile=0 stderr=[] run=3
w1000000 compile=8 stderr=[omc: line 3: error 8] run=-
w2000000 compile=8 stderr=[omc: line 3: error 8] run=-
wmax compile=8 stderr=[omc: line 3: error 8] run=- (bound 9223372036854775807)
w0 compile=8 stderr=[omc: line 3: error 8] run=-
forbound compile=5 stderr=[omc: line 3: error 5] run=- (for i ulong 3 bound 1000000)
forbound10 compile=5 stderr=[omc: line 3: error 5] run=- (for i ulong 3 bound 10)
forcast compile=0 stderr=[] run=6 (for i ulong ulong e, e = int 4)
fornocast compile=7 stderr=[omc: line 4: error 7] run=- (for i ulong e)
g16m compile=0 stderr=[] run=0 (global g uchar 16777216)
g16m1 compile=23 stderr=[omc: line 1: error 23] run=- (16777217)
nob compile=0 stderr=[] run=104 (while, no bound, 1000001 passes)
== 3ad9f10f (f4df8239)
w999999 compile=0 stderr=[] run=3
w1000000 compile=0 stderr=[] run=3
w2000000 compile=0 stderr=[] run=3
wmax compile=0 stderr=[] run=3
w0 compile=8 stderr=[omc: line 3: error 8] run=-
forbound compile=0 stderr=[] run=3
forbound10 compile=0 stderr=[] run=3
forcast compile=0 stderr=[] run=6
fornocast compile=7 stderr=[omc: line 4: error 7] run=-
g16m compile=0 stderr=[] run=0
g16m1 compile=23 stderr=[omc: line 1: error 23] run=-
nob compile=0 stderr=[] run=104
The cast and 16777216-element cases behave the same on both pins, so the guide records them as shared. No example changed; bash examples/gate.sh <f4df8239 omc> -> GATE PASS examples=110 pass=110 fail=0 (exit 0).
Apply it
git checkout -b patch-0d5361510ae43236bd107ca15c40b6cdfef0f23afb03a884fe3c8086
curl -fsSL https://interplane.io/drakestapleton/omega-harness/patches/0d5361510ae43236.patch | git am
diff --git a/skills/aien-repositories/SKILL.md b/skills/aien-repositories/SKILL.md
index 91e403e..8412094 100644
--- a/skills/aien-repositories/SKILL.md
+++ b/skills/aien-repositories/SKILL.md
@@ -140,6 +140,7 @@ For memory, do not route to an archived repo just because its name sounds right.
- [omega-bridge](https://github.com/aien-dev/omega-bridge): owns compatibility, not computation or GPU execution. Checked Omega-subset conversion to C/Python (`src/toc.om`), native bindings so foreign callers call compiled Omega (`src/native.om`), framework attachments (PyTorch, llama.cpp/GGML, MAX) and the opt-in GPU artifact boundary (`src/gpu_adapter.om`, which runs no kernel; device runs go through CUDApp). It is an adoption mechanism that makes existing ecosystems optional and must not constrain Omega to them. [Current instructions](https://github.com/aien-dev/omega-bridge/blob/main/AGENTS.md) explicitly refuse universal conversion: Python/C input conversion is not implemented. Adapter admission is not proof of device execution. Do not take a compiler from it; pin omega-mv's (omega-mv#870, open). [omega-bridge #47](https://github.com/aien-dev/omega-bridge/pull/47) (merged 2026-10-31, squash `6ec6dab7`) runs a `.om` matmul inside a MAX 26.7.0 graph as a CPU custom op (`max-cpu/`; one Mojo glue file, `OwnedDLHandle` + dlsym; plain `external_call` cannot resolve the symbol in MAX's kernel JIT). EXERCISED on the Spark host CPU only (`sh max-cpu/run.sh`: `OMEGA MAX CPU: PASS`, controls green and four negative controls refused); no kernel ran on GB10. The graphs are CPU-only, but MAX 26.7.0 `Graph()` still creates a CUDA context whenever a GPU is visible, and `run.sh` at `6ec6dab7` did not hide it: a 2026-10-31 rerun there passed every check and control, then exited 1 when its last measurement failed in `Accelerator()` with `CUDA_ERROR_OUT_OF_MEMORY`. [omega-bridge #51](https://github.com/aien-dev/omega-bridge/pull/51) (merged 2026-10-31, squash `9532044e`) fixes this: `run.sh` exports `CUDA_VISIBLE_DEVICES=` and `omega_max.py` refuses a visible GPU (exit 2). Its requalification at head `5f7492ff` exited 0 with 16 of 16 measurements and no harness process in `nvidia-smi --query-compute-apps` across 77 samples, and a copy of `run.sh` without the export was refused. Run plain `sh max-cpu/run.sh` on main; on the Spark pin it to cores 5-9, never 10-14. When reproducing it, give each run an empty `MODULAR_CACHE_DIR`, because MAX 26.7.0 reuses a compiled custom-op kernel after its Mojo source changes; `max-cpu/mogg-cache-repro.sh` shows this and exits 0 since #51.
- x86linux native bindings (merged): since [omega-bridge#44](https://github.com/aien-dev/omega-bridge/pull/44) (merged 2026-10-31, squash `49b69635`) the native generators (`native c` and `native freest`, `src/native.om`) also emit `x86linux` output: the same `.om` units compiled by an `omc` built with `target x86linux`, with the x86 frame and preamble selected from the ELF header, so an x86-64 consumer gets a binding it can assemble instead of the migration-pending stand-in of omega-mv [#940](https://github.com/aien-dev/omega-mv/issues/940) (issue still open). The x86 suite result is EMULATED (qemu-x86_64), not native x86 and not a hardware qualification.
- [omega-mcp](https://github.com/aien-dev/omega-mcp) (created 2026-10-27): an MCP stdio server written in `.om` that lets an agent `compile` and `run` Omega with the pinned seeded omc in a per-call bwrap+prlimit sandbox, and answers `explain_error` and `lookup` from data checked against that pin. Since [omega-mcp#6](https://github.com/aien-dev/omega-mcp/pull/6) the pin is omega-mv `f4df8239`, omc sha256 `3ad9f10f…3194` (before: `e5b32567`, `2c824805…`); a server started before that build still runs the old omc, so check `compiler_sha256` in a `compile` result. Its smoke session, reference oracle and trust gate (a `~/.local/state` read, a fork bomb, an infinite loop and a 10 GiB write, each with a no-isolation negative control) run in `.github/workflows/gates.yml` on `ubuntu-24.04-arm` and on the Spark host; bwrap and prlimit are recorded host dependencies awaiting Omega namespace and rlimit words. It is agent tooling, not a conversion route: conversion stays with omega-bridge.
+ - Checked 2026-11-07: the running omega MCP server reports `compiler_sha256` `2c82480596bbdc50cda9626866209ef662d5834f278f839ff4ce0250c495029f` (omega-mv `e5b32567`), so at that pin `while ... bound` is 1..999999 and `for ... bound` is error 5 (see the per-pin table in `writing-omega`).
- [babel](https://github.com/aien-dev/babel) (created 2026-10-26): the code-translation CLI that goes through Omega. `babel <dir> --to rust|c|python|cpp|zig|go` writes `<dir>.babel/` (input copy, Omega units, target project, differential vectors, REPORT.md/report.json). The driver is `.om`; the translation adapters stay in omega-mv (#624 lanes), so change adapters there, not in babel. Only profile S1 (C17 pure `uint64_t` functions, adapters pinned at `universal/624-g1-integration` `2d4c6407`) is implemented. Everything else is refused or MISSING_IMPLEMENTATION per item. TRANSLATED requires the original C, the Omega unit and the target output to agree byte for byte on every vector. Its README matrix and `tests/run.sh` (with a mutated-oracle negative control) own the status; host CI is not hardware qualification.
- PENDING (babel#5, draft, not merged): every run computes a completion record (policy `complete-v1`: walked files, split items, skipped entries such as hidden files and symlinks, and required checks) in `report.json` `"completion"` and REPORT.md; `--complete` makes the exit status 0 COMPLETE, 1 FAILED, 3 PARTIAL, 4 BLOCKED. `--exclude FILE` takes a manifest of `<path> <reason>` lines (exact path or `dir/` prefix, no globs); matched non-source entries stay in the denominator as EXCLUDED (COMPLETE = covered + excluded == denominator), and a line with no reason, a stale entry, a glob, or one naming source (including hidden or symlinked `.c`) exits 2. Until #5 merges, babel main has neither `--complete` nor `--exclude`.
- [omnet](https://github.com/aien-dev/omnet): Omega security-critical networking, initially server-side Tailnet Lock. It is not part of the alpha bundle. Its [README](https://github.com/aien-dev/omnet/blob/main/README.md) Status section (main `83f605b`, 2026-10-26) records the Omega daemon with all eight TKA RPCs and isolated end-to-end verification of the Headscale adapter and stock-client control-plane lifecycle, and says this is not deployed tailnet protection, data-plane qualification or a production security audit. Live deployment needs its own evidence.
diff --git a/skills/writing-omega/SKILL.md b/skills/writing-omega/SKILL.md
index c0a2356..e49c012 100644
--- a/skills/writing-omega/SKILL.md
+++ b/skills/writing-omega/SKILL.md
@@ -22,6 +22,23 @@ For compiler internals, register rules, wire formats and the reasons behind each
The language reference is normative. Where this guide and OMEGESE disagree, the compiler at the pin
decides; this guide records the known disagreements.
+The pin above is not the only compiler in use. Drake's pure-Omega directive of 2026-11-07 and the
+omega MCP server (`compiler_sha256` in a `compile` result, checked 2026-11-07) both use omega-mv
+`e5b32567`, omc sha256 `2c82480596bbdc50cda9626866209ef662d5834f278f839ff4ce0250c495029f`. Loop
+bounds differ between the two pins:
+
+| Program | omc `2c824805` (e5b32567, directive and MCP) | omc `3ad9f10f` (f4df8239) |
+|---|---|---|
+| `while C bound 999999` | compiles | compiles |
+| `while C bound 1000000`, `2000000`, `9223372036854775807` | error 8 | compiles |
+| `while C bound 0` | error 8 | error 8 |
+| `for i ulong 3 bound 10` (any `for ... bound`) | error 5 | compiles |
+| `while` with no bound, 1000001 passes | trap 4 (exit 104) | trap 4 (exit 104) |
+
+Same on both: a global array of 16777216 elements compiles and 16777217 is error 23; a `for` count of
+another type needs a cast (`for i ulong e` with `e = int 4` is error 7, `for i ulong ulong e` runs).
+At `e5b32567`, write `while C bound N` with N at most 999999 and no `for ... bound`.
+
## 1. Compile and run
```sh
@@ -103,7 +120,7 @@ Every declaration and statement form at the pin (OMEGESE sections 9 to 12 are th
| `put A i v`, `put p f v` | function body | store into an array element or a field |
| `f v1 v2 ...` | function body | a call to a `void` function |
| `if C` ... `else` ... `end` | function body | `else` is optional; no `else if` |
-| `while C bound N` ... `end` | function body | N 1..9223372036854775807 (IR mode 1..1000000) |
+| `while C bound N` ... `end` | function body | N 1..9223372036854775807 (IR mode 1..1000000); at `e5b32567` N 1..999999 |
| `for i T K` ... `end` | function body | `unroll` after K in OM-2, K 1..64 |
| `break`, `continue` | inside a loop | |
| `ret`, `ret v` | function body | `ret v` in a function with a result |
@@ -188,14 +205,16 @@ A trap ends the process with exit status 100 + N. Output already written stays w
## 6. Loops and bounds
- `while COND bound N` runs the body at most N times, N 1..9223372036854775807 (error 8 outside;
- IR mode 1..1000000). Without `bound` the limit is 1000000. One more pass traps 4. Choose N from
+ IR mode 1..1000000). At `e5b32567` (directive and MCP pin) N is 1..999999 and `bound 1000000`
+ is error 8. Without `bound` the limit is 1000000. One more pass traps 4. Choose N from
an argument you can write down in a `note`, for example "every pass consumes at least one byte of
a 65536-byte input".
- `for i T K` runs i from 0 to K-1. A number K is unguarded. Any other K (a name or value) with no
`bound` traps 4 (exit 104) after 1000000 passes, as a `while` with no bound. `for i T K bound N`
takes the same N as `while`, caps every count and traps 4 when K exceeds N (`for_bound.om`,
- `trap4_for_bound.om`). The MCP pin (`f4df8239`, omc `3ad9f10f…`, since omega-mcp #6) accepts
- `for ... bound`; the previous MCP pin `e5b32567` (omc `2c824805…`) refused it with error 5.
+ `trap4_for_bound.om`). At `e5b32567` (omc `2c824805…`, the directive pin and the MCP pin as of
+ 2026-11-07) `for ... bound` is error 5; omega-mcp #6 moved the MCP source to `f4df8239`, but the
+ running server still reports `2c824805`, so check `compiler_sha256` before relying on it.
- `break` and `continue` work in both loops. There is no `else if`: nest an `if` inside `else`.
- No loop runs forever and recursion is bounded by the stack.
@@ -301,7 +320,7 @@ with its exact stderr line in the matching `.expect`, except 24, which needs a g
| 5 | words left after a complete statement | `err05_extra_words` | count each word's values; there is no infix |
| 6 | malformed number | `err06_bad_number` | decimal digits; hex only in OM-2, lowercase |
| 7 | type mismatch | `err07_type_mismatch` | convert with a type word: `add int 1 int u` |
-| 8 | number out of range | `err08_out_of_range` | a literal that fits its type; a bound 1..9223372036854775807 (IR mode 1..1000000); a trap code 1..14 |
+| 8 | number out of range | `err08_out_of_range` | a literal that fits its type; a bound 1..9223372036854775807 (IR mode 1..1000000; 1..999999 at `e5b32567`); a trap code 1..14 |
| 9 | a word in a place where it is not allowed | `err09_disallowed` | move it: `new` only in a function's outermost block, `struct` before the first `fn` |
| 10 | duplicate name | `err10_duplicate` | choose a name that is not visible, not a function, not a struct |
| 11 | a number with nothing to give it a type | `err11_ambiguous` | `x = uint 5` |
@@ -360,7 +379,7 @@ Each row is a program in `examples/` with its observed refusal.
| `return x` | `ret x` | error 18 (silent assignment) | `mistake_return.om` |
| `else if c` | `else`, then a nested `if c` | error 5 | `mistake_else_if.om` |
| `fn main argc int to int` | `argcnt`, `argread` | error 9 | `mistake_main_args.om` |
-| `while c bound 9223372036854775808` (or `bound 0`) | a bound 1..9223372036854775807 | error 8 | `mistake_bound_range.om` |
+| `while c bound 9223372036854775808` (or `bound 0`; at `e5b32567` also `bound 1000000`) | a bound 1..9223372036854775807 (1..999999 at `e5b32567`) | error 8 | `mistake_bound_range.om` |
| `ir` unit with `while c bound 1000001` | an IR bound 1..1000000 | error 8 | `mistake_ir_bound.om` |
| `a = new uchar n 0` | a literal or `const` length | error 16 | `mistake_new_var_len.om` |
| `free a` | nothing: no heap | error 9 | `mistake_free.om` |