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 / docs / r16-operator-control.md

304 lines · 21470 bytes Raw Blame History Source

R16 G6: operator control of the production program (interface contract)

Status: CONTRACT, written before the code (lane ESTOP, CAND-3), then implemented. Two points were corrected from the code: when the socket opens (section 2) and a store refusal under a stop (section 6). The runtime control it wires is spec/r16-operator-emergency-stop.md (merged #300); this document says how an operator outside the running production program reaches that control, and what the program does with a request. It adds no authority scheme: every decision is made by the existing world authority (rx_world_emergency_stop / _resume, halt_authorize in src/runtime/rx_world.c).

Production program: tests/runtime/rx_r13_living.c, built without AIEN_TEST_BUILD as build/rx_r13_living_host and build/rx_r13_living_silicon. It runs six modes, each in its own world. Every statement below holds for each of those worlds.

1. Who the operator is and how its authority reaches the program

2. The outside entry point

3. Formats

Credential file (text):

aien-operator-credential v1
world <mode-key> <program pid> <world start CLOCK_REALTIME ns>
socket <absolute socket path>
subject 70
cred <generation> <64 hex secret>
cap <cap_id> <cap generation>

Request (one line):

aien-operator v1 <command> subject=<u32> gen=<u64> secret=<64 hex> cap=<id>:<gen> deadline=<u64> [reason=<int>]

deadline is required: the CLOCK_MONOTONIC time in nanoseconds after which the client has given up (the client sends now + 55 s and waits 60 s). A deadline more than 120 s ahead is BAD_REQUEST. A request that waited for the world's setup past its deadline is answered EXPIRED and not run, unless it is a stop: a late stop is fail-safe and still runs; a late resume would restart a world nobody is watching.

<command> is status, stop, resume, revoke-cap, revoke or shutdown. Any other token, a missing or repeated field, a secret that is not 64 hex digits, a number out of range or extra bytes is BAD_REQUEST, decided before any world call.

Reply (one line): aien-operator v1 <RESULT> key=value .... RESULT is one of OK, STOPPED_NOT_DURABLE (the stop is in force in memory but its mark could not be written: a restart would NOT come up stopped; carries durable=<-errno> errno=<n> (<text>)), ALREADY (stop of a stopped world), NOT_STOPPED (resume or shutdown of a running world), EXPIRED (the client deadline passed while the request waited; nothing done), REFUSED reason=peer|identity|authority, BAD_REQUEST, ERROR rc=<n>. A refusal says nothing about the world: no state, no counters.

Client exit status: 0 for OK, 3 for STOPPED_NOT_DURABLE, 1 for any other reply, 2 for a usage error, no credential file, no world serving the socket, or a reply timeout that could not be set.

4. Commands

Every command except BAD_REQUEST cases goes to the world authority first. status, revoke-cap, revoke and shutdown are checked by rx_world_operator_authorize (the same halt_authorize the stop and resume use, under the same locks, added to rx_world.c so no second authority check exists). stop and resume are checked inside rx_world_emergency_stop / _resume themselves.

commandworld callreply on success
statusrx_world_operator_authorize, rx_world_halt_statusOK state=running\|stopped restored= seq= durable= refused= cancelled= crumbs= reactions= plus program counters served= production_commits= promotion= inforce= active_generation= seat_claims= seat_halted=
stop [reason]rx_world_emergency_stopOK state=stopped seq= crumb= durable=1; mark not written: STOPPED_NOT_DURABLE ... errno= (client exit 3); a second stop: ALREADY with no new crumb
resumerx_world_emergency_resumeOK state=running seq=; a running world: NOT_STOPPED
revoke-capauthorize, then aienos_cap_revoke of the presented control capability by the authority's officeOK revoked=capability; afterwards every request with that capability is REFUSED reason=authority
revokeauthorize, then aienos_cap_revoke (capability) and rx_world_revoke_caller (credential); the credential file is removedOK revoked=capability,credential; afterwards REFUSED reason=identity
shutdownauthorize; only while stoppedOK state=stopped shutdown=1; the program ends the current mode, tears the world down with the stop still in force, writes no R13 receipt and exits 3. The durable mark stays.

A revoked operator cannot be re-enrolled in the same world (enrollment is closed); the world keeps running without operator control until the program starts the next world, which issues a new credential and capability. Revoking while stopped leaves the world stopped for the rest of that world's life; the durable mark makes the next start of that mode come up stopped, and the next credential can resume it.

Stale credentials. A credential is valid for one world of one program start: every world start enrolls a new random secret and mints a new capability. A credential from an earlier world or an earlier program start fails the constant-time caller check (REFUSED reason=identity).

5. State directory, durability and restart

6. What a stop covers, and what it does not

6.1 Closed limit: the halt right is the epoch right

**Closed at aienos.lock b84c0a67590a934f3f3e001b12ec85ebc086a9eb (aienos#272, closing aienos#266).** The native auth_use now honors a privileged right only on an entry whose resource is AIENOS_CAP_RES_AUTHORITY, else AIENOS_CAP_ERR_RESOURCE. omega's Linux oracle (src/runtime/rx_caproot.c auth_use) carries the same rule so R7 parity holds. Proof: make test-r16-operator-authority-misuse mints the operator capability as R13 does and requires every authority operation to refuse it (and one holding every privileged right on the control resource), the halt check to accept it, and the office to still operate; against bbad5e4 the halt capability bumps the epoch and the test fails. make test-r7 compares the two authorities on the same case. The text below is the record at bbad5e4.

The spec gives the stop the privileged epoch right (spec/r16-operator-emergency-stop.md §2 lines 44-45: "The right is RX_RIGHT_EPOCH ... The right that may void every capability may also pause the world"). ADR 0016 (aien-architecture main 014159e) is silent on a halt or pause right: neither word occurs in it. Its capability section (lines 367-382) lists the resource among what a capability binds, and line 1475 asks that a wrong-resource attack fail.

The locked native authority does not check the resource when a capability is used: auth_use (aienos native/capability/aienos_capability.c lines 205-218 at aienos.lock bbad5e4) checks delivery, generation, state, epoch, expiry, the delegation chain and the rights, not the entry's resource. So the operator's control capability (RX_WORLD_RES_CONTROL with RX_RIGHT_EPOCH) would also pass aienos_cap_bump_epoch (same file, line 555, through auth_use(..., AIENOS_CAP_RIGHT_EPOCH, ...) at line 369) if anything handed it there. omega does not change the locked authority; the request is aien-dev/aienux#266 (a resource check in auth_use, or a dedicated halt right).

What keeps it closed today is omega's own code, shown here and tested:

A future omega change that hands the control capability to any other authority entry point reopened this while it was a known limit (until aienos#266 closed; see the note above).

7. Proof (G6 by execution)

make test-r16-operator-host (tests/runtime/rx_operator_host.sh) starts the production host binary and drives it only through build/rx_operator and signals, checking replies, the files in the state directory and the program's crumb-log audit lines: authorized stop and resume; forged secret, wrong capability, wrong peer (root via sudo -n, reported SKIPPED and therefore NOT_RUN if sudo is unavailable), malformed request; stale credential (earlier world, earlier program start); revoke-cap and revoke; repeated stop and resume; repeated stop and resume cycles under production load (in-flight work refused and re-run); promotion blocked while stopped and completed after resume; restart while stopped after shutdown and after SIGKILL; recovery to a passing R13 episode; startup refusal of a group-readable, foreign-owned or symlinked state directory; a second program on the same state directory or on the first one's generation directory refused while the first keeps its socket and credential; a stop whose mark cannot be written (generation directory made 0500) answering STOPPED_NOT_DURABLE errno=13 with client exit 3; eleven unknown commands with a full credential refused; an expired resume answering EXPIRED and doing nothing, a missing or too-distant deadline refused. On host three checks are made deterministic by holding one thread of the production program under gdb in non-stop mode (the socket keeps serving): the seat acceptor held with a computed seat result while a stop is accepted, then released, must end that claim halted (seat_halted in status, so the episode's claim subtraction is exercised on host); the positive world held after its episode's work, stopped, then released, must stay up and stopped and print that it waits for a resume; the next world's open held after the positive world closed must find a credential file planted by someone else still in place. Without gdb those checks are SKIPPED (gate NOT_RUN). Silicon runs without gdb; its in-flight count is reported, not checked. A host run whose only gap is a missing sudo -n or gdb is NOT_RUN with the reason in the receipt, never FAIL. tests/runtime/rx_operator_mutants.sh rebuilds the production program from mutated copies and requires the test to fail against each (wiring missing, handler disconnected, success reply without a state transition, unauthorized resume accepted, wiring present only in a comment, wiring present only as an unused call, and the others it lists). make test-r16-operator-silicon runs the same test on build/rx_r13_living_silicon (resident GB10 seat) without the SIGKILL phase (a chip program is never killed). The receipt labels host and silicon results separately. The silicon test requires the program's own gate R13_LIVING_SYSTEM=PASS (bound to the candidate commit on a clean tree): the spec allows no SILICON_PASS_UNBOUND. Each run writes operator_<seat>_receipt.json to RX_OP_OUT (default build/r16-operator); the mutant script gives every mutant its own directory, so a mutant never overwrites the real receipt. tools/r16_qualify.sh copies both receipts into its raw directory (covered by the raw digest) and refuses PASS unless each names its seat, the candidate commit on a clean tree, no failure or skip, the seat's gate, and the SHA-256 of the production binary built in that run; the silicon run counts toward silicon_observed. The G6 item operator_emergency_controls_passing is PASS only when both ran and passed in the same qualification run on the candidate.