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-harness/patches/1292d9f870b3b9de # omega-harness Agent skills for operating, encoding and communicating in Omega (.om) and the AIEN repositories Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers ## guides: execenv 233 host word (pending omega-mv#1074) open `1292d9f870b3b9de` #217 · opened 2026-11-07 08:05 UTC Imported from GitHub aien-dev/omega-harness#217, by drakestapleton Base `bd107ca15c40b6cdfef0f23afb03a884fe3c8086` · Head `d53d31c55117090f787dea2a3b53b7f52680f444` drakestapleton wrote on 2026-11-07 08:05 UTC This guide update depends on aien-dev/omega-mv#1074 (head `7d9ed10f`, omc `cfd96b48b0460ab5557853d6856f9c741b96ac8d0d624e06198defb4cbfa0d8a`), which is not merged. Changes - `skills/writing-omega`: the host-word list goes from 67 to 68 words with `execenv A off n B off m`, marked pending. - `skills/omega-encoding`: adds the `execenv` contract. - `examples/execenv.om`: a new example, with `.expect`, `.stdout` and `.env` files. - `examples/gate.sh`: the pin moves to omega-mv `7d9ed10f` / omc `cfd96b48`. Evidence - `bash examples/gate.sh ` gives `GATE PASS examples=111 pass=111 fail=0`. - In the example, the parent runs with `FOO=bar` and the child prints only `GREETING=hi`. - Negative control: the old omc `5f90edea` refuses `execenv.om` with `line 63: error 3`. Not done yet: the MCP pin and the other pin mentions in README and omega-harness still point at `f4df8239` / `3ad9f10f`. They should move after #1074 merges. Agent: ExecEnv (omp subagent of omp-queen-spark) ### Apply it ``` git checkout -b patch-1292d9f870b3b9de bd107ca15c40b6cdfef0f23afb03a884fe3c8086 curl -fsSL https://interplane.io/drakestapleton/omega-harness/patches/1292d9f870b3b9de.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-harness 217 d53d31c55117090f787dea2a3b53b7f52680f444 ``` ``` {"kind":"github-import","owner":"aien-dev","repo":"omega-harness","number":217,"url":"https://github.com/aien-dev/omega-harness/pull/217","export_sha256":"81c8a50ec4f210545ba0c1f58b0895bf875fb250a73642ad466e88a680f2107e","imported_utc":"2026-11-18T16:39:27Z"} ``` ### Changes ``` diff --git a/examples/execenv.env b/examples/execenv.env new file mode 100644 index 0000000..c075a74 --- /dev/null +++ b/examples/execenv.env @@ -0,0 +1 @@ +FOO=bar diff --git a/examples/execenv.expect b/examples/execenv.expect new file mode 100644 index 0000000..420e65e --- /dev/null +++ b/examples/execenv.expect @@ -0,0 +1,2 @@ +compile 0 +exit 0 diff --git a/examples/execenv.om b/examples/execenv.om new file mode 100644 index 0000000..4b369fd --- /dev/null +++ b/examples/execenv.om @@ -0,0 +1,79 @@ +note execenv (keyword 233, omega-mv #1074): execprog with a private environment packet. +note The parent re-executes /proc/self/exe with argv [/proc/self/exe, "child"] and an environment +note of exactly one record GREETING=hi, in a forked child. The child prints its whole environment; +note the parent exits with the child's exit status. A missing program returns -2 (ENOENT). +om2 +text self "/proc/self/exe" +text cmode "child" +text greet "GREETING=hi" +text missing "/nonexistent/omega-execenv-example" +global argv uchar 256 +global envp uchar 64 +global buf uchar 256 +global status uchar 4 + +fn arec pos ulong s view uchar * to ulong +put argv pos uchar and len s 255 +put argv add pos 1 uchar shr len s 8 +for i ulong len s +put argv add add pos 2 i get s i +end +ret add add pos 2 len s +end + +fn erec pos ulong s view uchar * to ulong +put envp pos uchar and len s 255 +put envp add pos 1 uchar shr len s 8 +for i ulong len s +put envp add add pos 2 i get s i +end +ret add add pos 2 len s +end + +fn child to int +c = ulong envcnt +for i ulong c +n = envread i buf 0 len buf +if le n 0 +ret 2 +end +put buf n 10 +w = write 1 buf 0 add ulong n 1 +end +if ne c 1 +ret 1 +end +ret 0 +end + +fn main to int +n = argcnt +if eq n 2 +ret child +end +put argv 0 2 +put argv 1 0 +an = arec 2 self +an = arec an cmode +put envp 0 1 +put envp 1 0 +en = erec 2 greet +pid = fork +if eq pid 0 +r = execenv argv 0 an envp 0 en +exit 3 +end +w = waitpid int pid status 0 len status 0 +if ne w pid +ret 4 +end +note A missing program: execenv returns -2 (ENOENT) to the caller. +put argv 0 1 +put argv 1 0 +mn = arec 2 missing +r = execenv argv 0 mn envp 0 en +if ne r neg long 2 +ret 5 +end +ret int get status 1 +end diff --git a/examples/execenv.stdout b/examples/execenv.stdout new file mode 100644 index 0000000..ef88aed --- /dev/null +++ b/examples/execenv.stdout @@ -0,0 +1 @@ +GREETING=hi diff --git a/examples/gate.sh b/examples/gate.sh index 2ce38a3..67f5260 100755 --- a/examples/gate.sh +++ b/examples/gate.sh @@ -16,8 +16,8 @@ # Exit 0 only when every example passes; 1 on any failure; 2 on a usage or pin error. set -u -PIN_REV=f4df82394e35893dcf1354dda69a2fe028d94bc1 -PIN_SHA=3ad9f10f64309e7acf8a725082b28e23a2a4aeb07e98322fb4dc0fcd8fc93194 +PIN_REV=7d9ed10fd7b7fc33d8bfc39435f3eea80ee55dea +PIN_SHA=cfd96b48b0460ab5557853d6856f9c741b96ac8d0d624e06198defb4cbfa0d8a if [ "$#" -ne 1 ]; then echo "usage: $0 /path/to/omc (omega-mv $PIN_REV seed/out/omc)" >&2 diff --git a/skills/omega-encoding/SKILL.md b/skills/omega-encoding/SKILL.md index 94dd8fa..26e5e4b 100644 --- a/skills/omega-encoding/SKILL.md +++ b/skills/omega-encoding/SKILL.md @@ -1458,6 +1458,15 @@ the `target x86linux` build gives the same PASS line with exit 0 under `qemu-x86 and `peername = int 1` as a one-line unit is `omc: line 1: error 16`. This supersedes the pending candidate notes of harness draft #108 (candidate omc `4ef67f18`/`6a2916cd`). +**`execenv` (pending [omega-mv#1074](https://github.com/aien-dev/omega-mv/pull/1074), omc `cfd96b48…`; +the MCP pin refuses it with error 3).** `r = execenv A off n B off m` (keyword 233) is `execprog A off n` +with a private environment: the child's environment is exactly packet B, packed like argv (u16 count +1..64, nonempty u16-length `NAME=VALUE` records, 2..4096 bytes, no zero byte, no trailing bytes). Both +packets are checked (trap 3, exit 103) before descriptors 3 and up close; it returns only on failure, +with a negative errno; function mode is error 9 and a contract is error 30; AArch64 and x86linux. +`examples/execenv.om` re-executes `/proc/self/exe` with the one record `GREETING=hi` while the parent +runs with `FOO=bar`; the child prints only `GREETING=hi` (gate `GATE PASS examples=111` at `cfd96b48`). + **`execpure` and descriptor closing in `execprog`** (merged in [omega-mv#970](https://github.com/aien-dev/omega-mv/pull/970) as `1db941627`; in the current pin `d3d1b1bc` / omc `b4f45121`; observed below with the then pin `91c83438` / omc `2aec185d`). `execpure A off n` is host word 198 diff --git a/skills/writing-omega/SKILL.md b/skills/writing-omega/SKILL.md index c0a2356..343c60c 100644 --- a/skills/writing-omega/SKILL.md +++ b/skills/writing-omega/SKILL.md @@ -146,7 +146,7 @@ Every declaration and statement form at the pin (OMEGESE sections 9 to 12 are th | structs | `new S v1 v2 ...`, `get p f`, `put p f v` | | control | `if` / `else` / `end`, `while COND bound N`, `for i T K`, `break`, `continue`, `ret`, `exit`, `trap N` | | conversion | the type words, `bitcast T v` | -| I/O | `read fd A off n`, `write fd A off n`, `pread` / `pwrite fd A off n pos`, and the 67 host words of section 10 | +| I/O | `read fd A off n`, `write fd A off n`, `pread` / `pwrite fd A off n pos`, and the 68 host words of section 10 | - `and`, `or`, `xor` on integers of any width are bitwise, not logical: `and ulong 12 ulong 10` is 8 ([`examples/int_bits_and.om`](../../examples/int_bits_and.om)). Compare first when you want a bool. @@ -271,7 +271,7 @@ Examples: [`om2_tour.om`](../../examples/om2_tour.om), [`om2_views.om`](../../ex `envread` ([`examples/env_read.om`](../../examples/env_read.om)). Short capacity returns -105. - Host words carry the process's own permissions; they are not a sandbox. -The 67 host words at the pin, with their values (OMEGESE section 10 has each one's exact contract). +The 68 host words at the pin (`execenv` is pending: it needs omc `cfd96b48…`, omega-mv#1074; the MCP pin refuses it with error 3), with their values (OMEGESE section 10 has each one's exact contract). `A` and `B` are `uchar` arrays, `off`, `n` and `capacity` are `ulong`, and descriptors, flags, modes and ids are `int`. A path is the slice `A off n`; a packed list is a `u16` count, then `u16`-length records. Each word is reserved: using it as a name is error 16 at the pin, while an unreserved name @@ -281,7 +281,7 @@ in the same program compiles. |---|---| | files | `fopen A off n flags mode`, `fclose fd`, `fsync fd`, `fdsync fd`, `syncfs fd`, `memfd A off n flags`, `fseek fd offset whence`, `ftrunc fd length`, `flock fd op`, `fstat fd A off n`, `getdnts fd A off n` | | paths | `chmod A off n mode`, `fchmod fd mode`, `chown A off n uid gid`, `faccess A off n mode`, `truncate A off n length`, `unlink A off n`, `makedir A off n mode`, `rmdir A off n`, `cwd A off capacity`, `chdir A off n`, `fchdir fd`, `readlnk A off n B off capacity`, `stat A off n B off capacity`, `lstat A off n B off capacity`, `renames A off n flags`, `link A off n`, `symlnk A off n`, `umask mask` | -| processes | `getpid`, `getppid`, `getuid`, `geteuid`, `getgid`, `getegid`, `setsid`, `getpgid pid`, `getsid pid`, `setpgid pid pgid`, `fork`, `killpid pid signal`, `waitpid pid A off n options`, `pipefds A off n flags`, `dupfd fd target flags`, `execprog A off n` | +| processes | `getpid`, `getppid`, `getuid`, `geteuid`, `getgid`, `getegid`, `setsid`, `getpgid pid`, `getsid pid`, `setpgid pid pgid`, `fork`, `killpid pid signal`, `waitpid pid A off n options`, `pipefds A off n flags`, `dupfd fd target flags`, `execprog A off n`, `execenv A off n B off m` | | arguments, environment, randomness | `argcnt`, `argread index A off capacity`, `envcnt`, `envread index A off capacity`, `random A off n flags` | | time | `monons`, `realns`, `sleepns interval` | | sockets | `socknew domain kind protocol`, `bind fd A off n`, `connect fd A off n`, `listen fd backlog`, `accept fd flags`, `sockname fd A off n`, `sockopt fd level option A off n`, `recv fd A off n flags`, `send fd A off n flags`, `sendmsg fd A off n flags`, `shutdown fd how`, `waitio fd events interval`, `pollfds A off n interval`, `peercred fd A off capacity` | ```