interplane.Get Omega
Read in your language

omega-harness

Agent skills for operating, encoding and communicating in Omega (.om) and the AIEN repositories

Brought by drakestapleton

branch main Branches Tags History

omega-harness / coder / eval / case.sh

38 lines · 2531 bytes Raw Blame History
1# case.sh: sourced by run.sh, refcheck.sh, compare.sh and selftest.sh. The one place the eval's gate case line,
2# its deadline, the session limits and the verdict words are written, so they all agree.
3CASE_DEADLINE=10
4# Session limits, shared by both arms so the arms stay comparable (eval protocol, not a guard against our own
5# bugs): the wall-clock timeout around aien (its end scores as session rc 124) and the guard's OMEGA_STOP_LIMIT.
6# compare.sh marks every row that reached one (AT_LIMIT), so a result bound by a limit is not misread.
7SESSION_TIMEOUT=900
8SESSION_STOP_LIMIT=5
9VERDICTS="pass wrong-output timeout crash compile-fail"
10# narrow_gate HOME RO RW GATE-ARGS...: the om2 gate is not a sandbox (its header says so) and the programs it
11# runs are model-written: whatever such a program can open it can copy to its stdout. So the gate runs inside
12# bwrap with nothing mounted but the system directories, the gate, the pinned omc and the gate fixtures (under
13# HOME, the gate's working directory), RO read-only and RW writable (its scratch goes inside RW): no task
14# directory, output directory, context pack or home directory, no /proc, no network, its own pid namespace,
15# killed with its parent. score.sh never puts a task's expected output in RO while a model-written program runs.
16# Containment of untrusted code (the rules' exception to no hard caps): every file the gate or the program writes
17# is limited to CASE_FSIZE_BLOCKS 512-byte blocks (1 MiB), so a program that writes without end gets SIGXFSZ and
18# scores crash instead of filling the disk. refcheck.sh alarms when a task's expected output reaches half of it.
19CASE_FSIZE_BLOCKS=2048
20narrow_gate() {
21 _gh=$1
22 _gro=$2
23 _grw=$3
24 shift 3
25 (
26 ulimit -f "$CASE_FSIZE_BLOCKS" || exit 125
27 exec bwrap --ro-bind /usr /usr --ro-bind-try /bin /bin --ro-bind-try /lib /lib --ro-bind-try /lib64 /lib64 \
28 --dev /dev --tmpfs /tmp --ro-bind "$_gh/gate" "$_gh/gate" --ro-bind "$_gh/omc" "$_gh/omc" \
29 --ro-bind "$_gh/seed/qualification/om2/fixtures" "$_gh/seed/qualification/om2/fixtures" \
30 --ro-bind "$_gro" "$_gro" --bind "$_grw" "$_grw" \
31 --unshare-net --unshare-pid --unshare-ipc --die-with-parent --chdir "$_gh" -- ./gate "$@"
32 )
33}
34# caseline ID SRC TASK: the om2 gate line that runs SRC on TASK's stdin and expects its output and exit (refcheck.sh
35# runs the held-out references, which are not model-written, on these lines)
36caseline() {
37 printf '%s run %s file:%s/stdin file:%s/expected.out - %s\n' "$1" "$2" "$3" "$3" "$(cat "$3/expected.exit")"
38}