INTERPLANE Forge v1: forge
The merge decision of INTERPLANE Forge and the gate runner that feeds it, in seeded Omega
(forge.om). Spec: docs/FORGE.md. Host dependencies: DEPENDENCIES.md.
Agents express intent. The forge retains authority. An agent proposes a patch, an independent
reviewer writes a verdict for one exact head, forge gate runs the gate and its negative control in
fresh clones of that head and writes a receipt. forge decide is the only step that turns those
three objects into MERGE, and it says HOLD for anything it cannot prove.
Build and test
OMC=~/work/flux/omega-mv/seed/out/omc # omega-mv f4df8239, sha256 3ad9f10f…3194
"$OMC" < forge/forge.om > /tmp/forge && chmod +x /tmp/forge
OMC="$OMC" sh forge/tests/run.sh # every check, then every mutant; exit 0 only when all pass
run.sh refuses any omc whose sha256 is not the pin (prints NOT_RUN, exit 3). It needs git for
the gate fixture.
Commands
forge decide [--json] <patch-head> <verdict-file> <gate-receipt>
forge status <RID> [reviews-dir [receipts-dir]]
forge gate <RID> <head> [--name N] [--out DIR] [--timeout S] --author A --neg ARGV.. -- ARGV..
Any other subcommand prints the usage on stderr and exits 2.
forge decide
Prints exactly one line, MERGE OK (exit 0) or HOLD <CODE> (exit 1). With --json (first
argument after decide) it prints exactly one line holding one JSON object instead, with the same
exit codes:
{"schema":"forge-decision/1","head":"<40 lowercase hex>","decision":"MERGE","reason":"OK"}
{"schema":"forge-decision/1","head":"<40 lowercase hex>","decision":"HOLD","reason":"<CODE>"}
{"schema":"forge-decision/1","head":null,"decision":"HOLD","reason":"USAGE"}
The keys always appear in that order with no spaces. head is the patch head argument when it is
40 lowercase hex and the argument count is right, else null (USAGE, BAD_HEAD). reason is
one of the codes in the table below.
forge status
Runs rad patch list --all --repo <RID> and rad patch show <id> --repo <RID> for every patch and
prints one line per patch, then a summary:
patch <id7> status=<rad status> head=<40 hex> verdict=<file|none> receipt=<file|ambiguous|none> decision=<MERGE OK|HOLD <CODE>|NOT_RUN no verdict file>
forge status <RID> patches=N decided=K merge=A hold=B not_run=C
For each patch head H, the verdict is the one file in reviews-dir named *-<first 8 hex of H>.verdict.txt
(two or more such files give HOLD VERDICT_AMBIGUOUS), and the receipt is the one file in
receipts-dir named *-<first 8 hex of H>.receipt.txt, the name forge gate writes (two or more
give receipt=ambiguous and HOLD RECEIPT_AMBIGUOUS; none gives receipt=none and
HOLD RECEIPT_UNREADABLE). Defaults: $HOME/handoffs/hive/manager/reviews and
$HOME/handoffs/hive/forge/receipts. Names are followed through symlinks. status is a report and
exits 0 when rad ran; a rad failure prints forge: rad failed, exit N and exits 2. It decides at
most the first 512 listed patches: when rad lists more, it prints the summary for those, then
TRUNCATED patches=N examined=512, and exits 2. It never merges or writes anything.
forge gate
forge gate rad:z6do9WDBhuSnvopDkgFdFr1yWA62 215ea39afdc0cf1914cfadf43bbb6d23ce68c920 \
--author "t_04379749" --out ~/handoffs/hive/forge/receipts \
--neg <command that must fail> -- <the repository's gate command>
- Checks the arguments:
RIDisrad:and 1 to 60 ASCII letters and digits;headis 40 lowercase hex;--author(required) is 1 to 256 bytes with a printable ASCII byte and no control byte;--nameis 1 to 100 bytes ofA-Z a-z 0-9 . _ -not starting with.; each option at most once;--timeoutis 1 to 5 decimal digits giving 1 to 86400 seconds (default 1800); both commands are 1 to 40 arguments, at most 1024 bytes joined, no CR or LF, and a first argument that is not empty, does not start with-and holds no=. - Reads
HOME(required),PATH(default/usr/local/bin:/usr/bin:/bin),OMCandRAD_HOME. The storage is$RAD_HOME/storage/<RID without rad:>, else$HOME/.radicle/storage/…. WhenOMCis set, its file's SHA-256 is recorded asomc=(an unreadableOMCis an error); unset,omc=none. The name is--name, else thenameofrad inspect <RID> --payload. - Makes
/tmp/forge-gate-<pid>-<16 random hex>(mode 0700) and, twice, a fresh clone of exactlyheadfrom the storage (git init,fetch --no-tags,checkout --detach), with git's system and global config off. Each clone'sHEADmust equalhead. - Runs the gate command in one clone and the negative control in the other, each through
/usr/bin/envwith onlyHOME,PATHand (when set)OMCin the environment, stdin/dev/null, stdout and stderr to<name>-<head8>.gate.log/<name>-<head8>.negctl.login the out dir. An exit code is the command's status, or 128 + the signal number when it was killed. Each command runs in its own process group (the child callssetpgid(0, 0)beforechdir, and forge sets the same group from the parent, so there is no race) with its own timeout of--timeoutseconds (default 1800), measured on the monotonic clock and polled every 100 ms. A command still running at its timeout is killed with its whole process group (SIGKILLto-pid) and by its pid (so a direct child that moved to another group is killed too), reaped (forge stops waiting for the reap 10 s after the kill, so forge itself stays bounded), its exit code recorded as 124, and the lineforge: timeout after S s, process group killed with SIGKILL, exit status recorded as 124appended to its log, so the log hash covers it; the receipt and logs are then written as usual, anddecidegivesHOLD GATE_TIMEOUT. Limits: a grandchild that leaves the group (setsid,setpgid) escapes the kill; a direct child stuck in uninterruptible sleep is not reaped by forge (it is left to init after the 10 s reap deadline, and could still finish a write it was in); a command that exits 124 by itself is indistinguishable from a timeout and also holds asGATE_TIMEOUT(fail closed: both are HOLD); background processes a command leaves running after it exits are not killed. - Hashes both logs (SHA-256, first-party Omega) and creates the out files: the logs, then the
receipt
<name>-<head8>.receipt.txt, then removes the temp dir. The command logs live in the 0700 temp dir (gate.log,negctl.log), created with `O_WRONLY|O_CREAT|O_EXCL|O_NOFOLLOW| O_CLOEXEC` (557249) and opened a second time read-only (557056), both fds checked to be the same file. The commands write through the first fd (duplicated to stdout and stderr, never reopened by name); forge hashes and copies through the second, so a log renamed or swapped while a gate runs changes neither the out log norlog_sha256. Out files are created only at the end, with the sameO_EXCL|O_NOFOLLOWflags: forge never replaces or follows an out file. A name already taken (file or symlink) is refused before the gate runs; one that appears during the run makes the run exit 2, and the out files it had created are removed, so a refused run leaves no file. The out dir must exist and be writable (checked first). The flag values are aarch64 Linux, the only target the pinned omc emits;tests/run.shreports NOT_RUN (exit 3) on any other machine, and x86 is not supported.
It prints forge gate <RID> head=<head> gate_rc=N negctl_rc=M receipt=<path> and exits 0 when
gate_rc is 0 and negctl_rc is neither 0 nor 124, 1 when the receipt records anything else (decide
would HOLD), 2 on an error, with a message on stderr and no receipt: bad arguments (including a
bad --timeout), unknown head, clone failure, unreadable OMC, no HOME, or an out directory that does not exist or cannot be
written. The out directory defaults to $HOME/handoffs/hive/forge/receipts; the forge never creates
directories. gate decides nothing: the receipt is evidence for forge decide.
Verdict file (the desk format, read as is)
- Line 1 is exactly
VERDICT <KIND> head=<40 lowercase hex>, withKINDone ofMERGE,MERGE_AFTER_FIX,REJECT, ended by a newline or the end of the file. Anything else (uppercase hex, a short head, CRLF, a trailing byte, a trailing space, a second word such asVERDICT MERGE head=<sha> REJECT, lowercaseverdict) isVERDICT_MALFORMED. - No later line may start with
VERDICT(VERDICT_MALFORMED): a file holds one verdict. - At most one line starting
reviewer=(two areVERDICT_MALFORMED). A value with a control byte (below 32 other than tab, or 127; NUL included) isVERDICT_MALFORMED. No such line, or a value without a printable ASCII byte (33..126), so empty or only spaces and tabs, isNO_REVIEWER. - Other lines are free text. Files of 65536 bytes or more are
VERDICT_UNREADABLE.
Gate receipt, forge-receipt v1 (format defined here)
forge gate writes every key, in this order:
FORGE-RECEIPT v1
rid=<rad: and 1 to 60 ASCII letters and digits>
clone=<40 lowercase hex: HEAD of the fresh clone the gate ran in>
tree=<40 lowercase hex: that clone's HEAD^{tree}>
omc=<64 lowercase hex: SHA-256 of $OMC, or none>
gate_cmd=<free text: the gate arguments joined with single spaces (not shell-quoted)>
gate_rc=<0..255: exit status of the gate; 124 when forge killed it at the timeout>
negctl_cmd=<free text: the negative-control arguments, joined the same way>
negctl_rc=<0..255: exit status of the negative control; 124 when forge killed it at the timeout>
author=<the patch author: a printable ASCII byte (33..126), no control byte>
started=<YYYY-MM-DDTHH:MM:SSZ, UTC, after both clones, just before the gate runs>
finished=<YYYY-MM-DDTHH:MM:SSZ, UTC, after both runs>
log_sha256=<64 lowercase hex: SHA-256 of the gate log>
negctl_log_sha256=<64 lowercase hex: SHA-256 of the negative-control log>
decide requires only clone, gate_rc and author (and negctl_rc, else NO_NEGCTL); the
other keys are optional, so receipts written by hand in the v0 key set stay valid. Line 1 is
exactly FORGE-RECEIPT v1. Every other line is key=value with a key from the list, in any order,
each at most once, no empty lines (the final newline is optional); exit codes are 1 to 3 decimal
digits. An unknown key, a duplicate, an empty line, a missing required key, a value that is not of
its form (including uppercase hex or a hash of the wrong length) or a number above 255 is
RECEIPT_MALFORMED. Times are checked as a digit pattern, not as a calendar date. Files of 4096
bytes or more, and missing files, are RECEIPT_UNREADABLE. decide does not compare rid, tree,
omc or the log hashes with anything; they let a reader check a receipt against the repository,
the compiler and the logs.
Decision and reason codes
Checks run in this order; the first that fails is the reason.
| Exit | Line | Meaning |
|---|---|---|
| 0 | MERGE OK | every check below passed |
| 1 | HOLD USAGE | decide without exactly three arguments (after --json) |
| 1 | HOLD BAD_HEAD | the patch head is not 40 lowercase hex |
| 1 | HOLD VERDICT_UNREADABLE | verdict file missing, empty or too large |
| 1 | HOLD VERDICT_MALFORMED | verdict file breaks the format above |
| 1 | HOLD VERDICT_MERGE_AFTER_FIX | the reviewer asked for fixes; only MERGE merges |
| 1 | HOLD VERDICT_REJECT | the reviewer rejected the patch |
| 1 | HOLD HEAD_MISMATCH | verdict head is not the patch head (all 40 hex compared) |
| 1 | HOLD NO_REVIEWER | no reviewer= line, or one without a printable ASCII byte |
| 1 | HOLD RECEIPT_AMBIGUOUS | status only: more than one receipt file for the head |
| 1 | HOLD RECEIPT_UNREADABLE | receipt missing, empty or too large |
| 1 | HOLD RECEIPT_MALFORMED | receipt breaks the format above |
| 1 | HOLD NO_NEGCTL | the receipt has no negative control |
| 1 | HOLD CLONE_MISMATCH | the gate ran on another head than the patch head |
| 1 | HOLD GATE_TIMEOUT | gate_rc or negctl_rc is 124: a run was killed at the forge gate timeout, so its evidence is incomplete (checked before its result) |
| 1 | HOLD GATE_FAIL | gate_rc is not 0 |
| 1 | HOLD NEGCTL_PASSED | negctl_rc is 0: the control did not fail, so the gate proves nothing |
| 1 | HOLD SELF_REVIEW | the normalized reviewer text contains the normalized receipt author |
| 1 | HOLD VERDICT_AMBIGUOUS | status only: more than one verdict file for the head |
Self-review normalization. Both the reviewer value and the author are folded to ASCII lower
case; tab, _ and - count as spaces and every run of them becomes one space; then ASCII
punctuation (!"#$%&'()*+,./:;<=>?@[\]^{|}~`) and spaces are stripped from both ends. The
reviewer text is then searched for the author as a substring. Manager reviewer agent as author
matches reviewer= MANAGER reviewer agent (relayed), and the authors "Manager reviewer agent",
Manager_reviewer_agent, manager-reviewer-agent. all match it. An author that normalizes to
nothing (only punctuation) is contained in every reviewer text, so it is SELF_REVIEW. Punctuation
inside a name is kept. Bytes of 128 and above are compared as they are: no Unicode case folding, and
no folding of Unicode punctuation or look-alike letters. Identities are unsigned text until signed
receipts land.
Test fixtures (tests/)
verdicts/: copies of three real review verdicts from~/handoffs/hive/manager/reviews/(sha256 checked equal when copied, 2026-11-07), except one edit: inaien-architecture-mv-6daec174a home-directory path/home/<user>/work/…is replaced by$HOME/work/….omega-mv-215ea39a(MERGE, omega-mv patch 4dd099d),CUDApp-9714eba8(MERGE, CUDApp #373) andaien-architecture-mv-6daec174(MERGE_AFTER_FIX, arch #382, held).receipts/<head>.receipt: TRANSCRIBED. No forge receipt existed before v0; these three restate inforge-receipt v1the gate and negative-control exit codes that the reviewer recorded in each verdict's EXERCISED section (omega-mv: run-tape.sh rc 0, control C2 rc 1; CUDApp:make test-om-encoder-ldgrc 0, control NC1 rc 11; arch: doctrine gate rc 0, wrong-omc control rc 3).authoris the lane that wrote the patch (t_04379749; the hive-ng gpu lane whose bundle is~/handoffs/hive-ng/gpu/CUDApp-373/; omp-queen-ng).receipts/*.receiptwith descriptive names: synthetic, one defect each.- Derived verdicts and receipts:
run.shmakes them at test time with onesededit each, from the real omega-mv verdict, fromreceipts/self-review.receipt(case, whitespace, punctuation,_,-, blank and control-byte values), or by appending the gate-written keys to the real omega-mv receipt (valid, and one defect each), and fails if an edit changes nothing. json-*cases incases.txtrundecide --json.statusruns:run.shputs a fakeradfirst onPATHthat lists 512, then 513 patches, then one patch with zero, one and two receipts for its head.gateruns:run.shmakes a git repository with two commits (100000 random bytes, then a second file) in a Radicle-shaped storage under a tempRAD_HOME, with a fakerad inspect, and checks every receipt key against independent tools (git rev-parse,sha256sumat 0, 55, 56, 63, 64, 65, 1000 and 100000 bytes,date -u), clone isolation (the gate's marker file is absent from the negative control's clone), exit codes 0/1/2, killed commands, the default out dir, and that every error writes no receipt. A receipt the gate wrote must giveMERGE OKwith a verdict. Timeout runs: a gate and a negative control that are eachshwith a background childsleep 20, at--timeout 1: exit 1, rc 124, the receipt written, the log ending in the timeout line and hashed,HOLD GATE_TIMEOUT(text and JSON), done in under 10 s, and the child sleeper gone (the group kill); a direct child that joins forge's own group (tests/joinpg.om, then a 20 s sleep) still ends at--timeout 1with rc 124 in under 6 s and is gone (the kill by pid); a run that ends inside--timeout 5is unaffected;--timeout 86400is accepted and0,86401,1x, empty, 8 digits and a repeated--timeoutare refused.mutants.txt: one-line mutants offorge.om, each removing or weakening one invariant; each runs the whole suite.run.shchecks the original line first, so a stale list fails, and counts a mutant that does not compile as not caught.