wgate
wgate.om runs the round40 retention gates for DRA-187 (lane wsp) in seeded Omega. It replaces the Python
glue evidence/OMEGALLM/wsp-dra187-20261107/gates.py, which imported round41 lib.py, repair.py,
checker.py and check_behavior.py.
Scope
wgate covers only the 7 retention and latency gates of PREREG section 7: latency, copies, screen, dev_jobs, regression, story_w256 and retention.
Numerical validity (every weight finite, |w| <= 1e6, f32 against f64 agreement) and the byte-identical revert are separate checks. They belong to wprobe and wpatch. wgate does not cover them.
wgate reproduces the gates.py verdicts only on the inputs it reads. Any other input shape (non-ASCII model text, JSON shapes the round40 files do not use, nesting past the Python recursion limit) is refused with a nonzero exit. It does not guess.
Build
wgate is composed after tools/omegallm/wdrive/wbuild.om. That file supplies the path, argv, stdout,
environment and sha256 helpers (wd*), and its main is renamed wbmain. Build from the worktree root
with the pinned compiler (omega-mv e5b32567, omc sha256
2c82480596bbdc50cda9626866209ef662d5834f278f839ff4ce0250c495029f):
OMC=$HOME/work/wsp/omega-mv/seed/out/omc CORE=0 taskset -c 0 \
wbuild OUT/wgate tools/omegallm/wdrive/wbuild.om@wbmain tools/omegallm/wgate/wgate.om
wbuild is the wdrive bootstrap binary. It prints BUILD_OK <binary sha256> ... source_sha256 ....
Commands
wgate run CANDIDATE.ck OUTDIR
wgate replay probe|first|jobs DATA.json RECORDED.json OUTDIR [STRIDE]
wgate replaylog probe|first|jobs DATA.json RECORDED.json LOGDIR LABEL OUTDIR [STRIDE]
wgate dryrun probe|jobs CK OUTDIR LABEL DATA.json
runis the gates.py main loop. It refuses with exit 3 before creating anything when SPARK_WINDOW is missing or empty.- It checks the base checkpoint sha256 and samples on the GPU binary.
- It writes
OUTDIR/gates.txt(candidate, candidate_sha256, start, window, aux, thengate NAME VALUE PASS|FAIL WINDOW UTCandend UTC VERDICT) andOUTDIR/commands.txt. - A rerun on the same OUTDIR resumes. It skips gates already decided and stops at the first failed gate.
- The last line is exactly
GATES_PASSorGATES_NOT_ALL_PASS.
replayscores recorded model answers without sampling and compares every row with the recorded file.- Kinds:
probeis checker.check_answer probes,firstis repair.check_answer (the screen gate), andjobsis the multi-turn tool jobs of check_behavior. STRIDEselects every Nth data row, asprobes(..., stride).- Output lines:
MISMATCH row=R [turn=T] field=F, thenREPLAY mode=KIND rows=N pass=P recorded_pass=Q mismatches=M. - Per-row results go to
OUTDIR/results/replay.txt.
- Kinds:
replaylogdoes the same from a batch-sample log directory instead of the recorded raw outputs.dryrunprints the encode, sample and geval argv thatrunwould execute, plus the batch-0 bytes and sha256. It executes nothing and writes nothing (NOT_RUN).
Relative paths are resolved lexically against PWD (exit 2 when PWD is absent). Symlinks are not
resolved.
Exit codes
| Code | Meaning |
|---|---|
| 0 | run: every task finished or stopped at a failed gate; replay: no mismatch |
| 1 | replay mismatch |
| 2 | usage |
| 3 | refused: no SPARK_WINDOW |
| 4 | base checkpoint sha256 mismatch |
| 5 | OUTDIR belongs to another candidate |
| 10 | window budget reached |
| 61 | arena or table full |
| 70 | host failure |
| 71 | file operation failed |
| 72 | text decode or encode error (non-ASCII model text) |
| 73 | native command exit status not 0 |
| 74 | native command timeout |
| 75 | sampler answer count mismatch |
| 76 | compile or test timeout inside compile_test |
| 77 | JSON nesting past the Python recursion limit |
| 78 | geval output unparsable |
| 79 | unsupported JSON shape |
| 80 | data or recorded file is not JSON |
| 81 | no recorded answer for a turn |
Replay evidence (MEASURED, 2026-11-07, core 0, binary sha256 edbb7ae16db47ab9ca9febdec8e0b4a2c7fd678f24921a2a15896e64f1ed8a6b)
R40 = ~/handoffs/tool-omega-20261104/round40, R41 = ~/handoffs/tool-omega-20261104/round41.
| Check | Data | Recorded | rows | pass | recorded | mismatches |
|---|---|---|---|---|---|---|
| screen gate | R40/data/localization-screen.json | R41/blend/results/blend-s1000-a250-action-screen.json | 8 | 8 | 8 | 0 PASS |
| screen gate | same | blend-s1000-a500-action-screen.json | 8 | 7 | 7 | 0 PASS |
| screen gate | same | blend-s2000-a250-action-screen.json | 8 | 8 | 8 | 0 PASS |
| screen gate | same | blend-s2000-a500-action-screen.json | 8 | 7 | 7 | 0 PASS |
| regression | R40/data/regression.json | R40/step600-regression.json | 685 | 685 | 685 | 0 PASS |
| copies | R40/data/copy-final.json | R40/step600-copy.json | 64 | 64 | 64 | 0 PASS |
| regression-screen checker (STRIDE 10) | R40/data/regression.json | R40/step600-screen.json | 69 | 69 | 69 | 0 PASS |
| dev_jobs | R40/data/dev-jobs.json | R40/step600-dev-jobs.json | 84 | 84 | 84 | 0 PASS |
| retention | R40/data/retention-jobs.json | R40/step600-retention-jobs.json | 847 | 847 | 847 | 0 PASS |
step600-screen.json is the regression-screen checker (regression.json at stride 10). It is not the screen
gate. The screen gate is localization-screen.json scored with repair.check_answer.
Negative controls (all exit 1):
- screen row 0 raw_output set to
garbagegivesMISMATCH row=0 field=passand pass 7 of recorded 8. - regression row 3 raw_output set to
garbagegives 3 mismatches (pass, compile_rc, run_rc). - dev_jobs row 5 recorded pass set to false gives
MISMATCH row=5 turn=0 field=pass.
env -u SPARK_WINDOW wgate run X OUT exits 3 and creates nothing.
NOT_RUN: live sampling, GPU geval scoring and latency timing (the run path). They need a GPU window.
ORACLE
jq is used only as an ORACLE, outside wgate. It built the negative-control copies (one field changed)
and it reads round41/commands.jsonl to compare the dry-run argv with the recorded round41 argv. wgate
itself has no jq, Python, shell or C dependency.
Known differences and risks
- Results are plain text (
results/LABEL.txt), not the JSON that gates.py wrote. - gates.py never created
OUT/build. wgate creates it. - Children run with an empty environment and inherit open descriptors. Process polling has 200 us latency.
- Python exceptions in the original are mirrored as the nonzero exits above, not as tracebacks.
- Loops are bounded by omc limits (at most 999999 per loop level). Arena 16 MiB, JSON nodes 2097152.
- wgate depends on the in-progress wdrive library
wbuild.om.