interplane.Get Omega
Read in your language

aienos.com

Source of www.aienos.com, served from my own hardware

Brought by drakestapleton

GitHub aien-dev/aienos.com#166 (code only)

closed derived 5be5f98b101b7c60 #166

Imported from GitHub aien-dev/aienos.com#166 (code only)

GitHub's metadata for this pull request is unavailable: its state is DERIVED from the commits (merged: the head is reachable from this project's main; open: GitHub kept a merge ref; else closed).

Base 0127685b40d2477033769568aa21bf550113ced6 · Head f8a08ce9a318716dea94fed612ced158e9e40de8

Apply it

git checkout -b patch-5be5f98b101b7c60 0127685b40d2477033769568aa21bf550113ced6
curl -fsSL https://interplane.io/drakestapleton/aienos.com/patches/5be5f98b101b7c60.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/aienos.com
166
f8a08ce9a318716dea94fed612ced158e9e40de8
{"kind":"github-import","owner":"aien-dev","repo":"aienos.com","number":166,"url":"https://github.com/aien-dev/aienos.com/pull/166","export_sha256":"967c79e26a893657b5cdaa45efd442be5dbd2ecfe68e25f9a8c1b5da4d60d452","imported_utc":"2026-11-18T16:38:31Z","metadata":"unavailable","state_derived":true}

Changes

diff --git a/.crumb b/.crumb
index 3d5916d3..5268fe1f 100644
--- a/.crumb
+++ b/.crumb
@@ -78,14 +78,14 @@
         }
       ],
       "children_root": "sha256:dda6036f5cc4a440fe7d501f49197693d86ac0baaed26856465ae6b8cfeb59ac",
-      "compiled_at": "2026-10-28T14:28:36Z",
+      "compiled_at": "2026-10-28T15:30:17Z",
       "compiler": "crumb-compile/1",
-      "digest": "sha256:0d2f5a004131493feb00498b717725033caf31e76c74bb25379064e0602d575b",
+      "digest": "sha256:95a5f7eac79beac30f4892c0f2cde1d99c56cc9ce0fe95e270e38cc006b31898",
       "evidence_files": 6,
       "evidence_root": "sha256:7fde48972a09dd4b0f7206aca4e313cd02c8cd195ec602e3924e59246c016aa5",
-      "files": 788,
-      "generated_at_commit": "3a689ff5c2dfed4c4de88c47a531d18c891eeb50",
-      "source_tree": "sha256:1d88876e04e1b57abec760cfb1742b4466e9102f755ec3af2c4441ffdcfce282"
+      "files": 789,
+      "generated_at_commit": "ce80c8e1586107b1be2cdfbe3d0d98483e33a7d5",
+      "source_tree": "sha256:2822bd034f0c82289070bfd5688bb86142ae7e5289efd23ddcdf6d59f2477e38"
     },
     "progress": {
       "initial_edits": "Dashboard draft predates explicit Crumb reminder; subsequent integration is claimed and recorded.",
diff --git a/om/agora/check.sh b/om/agora/check.sh
index f7ee8384..d7d3fb13 100755
--- a/om/agora/check.sh
+++ b/om/agora/check.sh
@@ -100,10 +100,12 @@ command -v "$nginx" >/dev/null || { printf 'missing nginx oracle: %s\n' "$nginx"
 build reload-check.om "$tmp/reload"
 mkdir "$tmp/reload.d"
 "$tmp/reload" "$nginx" "$tmp/reload.d"
-for mode in barrier-off old-retirement-off; do
+for mode in barrier-off active-listener-off draining-worker-refused listener-check-off; do
     case "$mode" in
-        barrier-off) edit='s/^if and gt cur 0 ne cur old$/if gt cur 0/; s/^if eq killpid old 0 -3$/if true/'; expected=11 ;;
-        old-retirement-off) edit='s/^if eq killpid old 0 -3$/if true/'; expected=14 ;;
+        barrier-off) edit='s/^if and gt cur 0 ne cur old$/if gt cur 0/; s/^if rc_clear old$/if true/'; expected=11 ;;
+        active-listener-off) edit='s/^if rc_clear old$/if true/'; expected=14 ;;
+        draining-worker-refused) edit='s/^ret eq rc_list pid 0$/ret false/'; expected=23 ;;
+        listener-check-off) edit='s/^ret eq rc_list pid 0$/ret true/'; expected=30 ;;
     esac
     sed "$edit" reload-check.om > "$tmp/$mode.om"
     build "$tmp/$mode.om" "$tmp/$mode"
diff --git a/om/agora/deploy/DEPLOY.md b/om/agora/deploy/DEPLOY.md
index 14bb3030..11900ec3 100644
--- a/om/agora/deploy/DEPLOY.md
+++ b/om/agora/deploy/DEPLOY.md
@@ -116,14 +116,25 @@ running master has adopted the candidate. Reload sends a signal asynchronously.
 A fresh TLS connection can still reach an old worker and fall through to Pages.
 Do not change the location hierarchy or add a fixed sleep to mask that race.
 
-Before reload, record the actual master PID, executable, command line and its
-worker PIDs. Confirm the service uses the same executable/configuration that
-passed `nginx -t`; an alternate `-c` or `-p` must be accounted for. After reload,
-use a bounded 30-second observation loop: require at least one new worker PID
-and require every captured old worker PID to have exited. Record both sets.
-Signal-command completion alone is not the barrier. A timeout is FAIL and
-requires rollback, not an extension of the deadline. Long-lived old connections
-can prevent this deliberately strict retirement condition from passing.
+Before reload, record the actual master PID, executable, command line and every
+worker PID **with its process title**, using the equivalent of
+`ps -C nginx -o pid=,ppid=,args=`. Separate active workers from workers already
+reported as `worker process is shutting down`. Record the latter and verify
+their lack of listening sockets with root `ss -ltnp`; an existing draining
+process need not exit. Confirm the service uses the executable/configuration
+that passed `nginx -t`; account for any alternate `-c` or `-p`.
+
+After reload, use a bounded 30-second observation loop. Require at least one
+new active worker PID. Every worker that was **active at capture** must have
+either exited, or entered the shutting down state **and** no longer own any
+listening socket. Observe process titles and root `ss -ltnp` together; a new
+worker alone is insufficient, and a draining title alone is insufficient.
+Record initial active/draining sets, new workers and listener ownership.
+Pre-existing draining workers without listeners cannot accept a fresh request
+and do not block adoption, even when an earlier connection keeps them alive.
+Do not kill or signal a production worker to satisfy this barrier. Signal
+command completion alone is not readiness. A timeout is FAIL and requires
+rollback, not a longer deadline.
 
 Only after worker handover, send one non-mutating GET challenge through the
 actual public TLS/SNI path. Require HTTP 200, `Cache-Control: no-store`, and
@@ -134,14 +145,25 @@ approved observation mechanism. A missing observation or unexpected response
 is FAIL. Only then begin the remaining identity, route, privacy and browser
 gates. Never retry a failed acceptance request as though it had passed.
 
-The native `om/agora/reload-check.om` oracle includes missing-reload and
-old-worker-alive failure controls, actual old-worker retirement, and a
-post-barrier challenge with exact upstream count. It launches only isolated
-loopback nginx workers through Omega's process facilities, observes Linux
-`/proc`, uses monotonic deadlines and performs its own HTTP request. Run
-`OMEGA_OMC=/path/to/pinned/omc NGINX_BIN=/path/to/nginx sh om/agora/check.sh`;
-the existing conductor compiles the Omega unit and requires both barrier-off
-and old-retirement-off source mutants to fail with their expected exits.
+The native `om/agora/reload-check.om` oracle holds a real response open across
+an initial reload, proving that a pre-existing draining worker can stay alive
+without a listener. It checks missing reload, an old active worker still owning
+a listener, and a post-barrier challenge with exact upstream count. A bounded
+predicate fixture supplies a draining classification for the proven owned
+listener and must still refuse it, independently exercising the listener guard.
+It launches only isolated loopback nginx workers through Omega's process
+facilities, observes Linux `/proc`, uses monotonic deadlines and performs its
+own HTTP request. Its socket inode checks stream both kernel TCP tables through
+EOF in a small buffer, retaining split token/row state and failing closed on
+read errors, incomplete final rows or exhaustion of the bounded read loop.
+Its one-worker and explicit 128-descriptor fixture limits are not production
+worker enumeration limits. Production uses the full root `ss -ltnp` observation.
+Run `OMEGA_OMC=/path/to/pinned/omc NGINX_BIN=/path/to/nginx sh om/agora/check.sh`;
+the existing conductor compiles the Omega unit and requires barrier-off,
+active-listener-off, draining-worker-refused and listener-check-off mutants
+to fail with exits 11, 14, 23 and 30 respectively. Current source/binary pins
+and observations are in `reload-draining.evidence.json`; the earlier
+`reload.evidence.json` remains the historical stricter-barrier receipt.
 Local oracle nginx version: 1.24.0; it is an unchanged verification oracle,
 not an implementation substituted for Omega. When
 diagnosing a host-specific failure, also replay the complete `nginx -T`
diff --git a/om/agora/deploy/reload-draining.evidence.json b/om/agora/deploy/reload-draining.evidence.json
new file mode 100644
index 00000000..171aa203
--- /dev/null
+++ b/om/agora/deploy/reload-draining.evidence.json
@@ -0,0 +1,103 @@
+{
+  "status": "EXERCISED_HOST_ORACLE",
+  "repository_base": "0127685b40d2477033769568aa21bf550113ced6",
+  "compiler_source": "omega-mv@e5b32567",
+  "compiler_sha256": "2c82480596bbdc50cda9626866209ef662d5834f278f839ff4ce0250c495029f",
+  "oracle": "nginx1.24.0 unchanged external loopback verification binary",
+  "source": "om/agora/reload-check.om",
+  "compose_command": "{ printf \"om2\\n\"; cat om/agora/sha256.om om/agora/http.om om/agora/reload-check.om; } | \"$OMEGA_OMC\" > \"$TMP/reload\"; chmod 700 \"$TMP/reload\"",
+  "run_command": "\"$TMP/reload\" \"$NGINX_BIN\" \"$EMPTY_SCRATCH\"",
+  "observed_stdout": "AGORA RELOAD OMEGA PASS pre-existing drainer/no-listener accepted; missing-reload and old-active-listener refused; readiness 200/no-store/one upstream hit",
+  "controls": [
+    {
+      "name": "real",
+      "source_sha256": "9ce28f58f43c3de467f0f8668ee6664712aa9abca4f10472a9c39798cc9c0f6d",
+      "binary_sha256": "fe9e1696c7841f93d72e29708e120440dce62ee8e7e86a8775298010db27e594",
+      "compile_exit": 0,
+      "expected_exit": 0,
+      "observed_exit": 0
+    },
+    {
+      "name": "barrier-off",
+      "source_sha256": "1dedcac7c092d9b7f79806b3e5967a43141c821c2080789ca335838e26b4c90a",
+      "binary_sha256": "3ed180f65e002a3a46e9dd157e082da98e6de8f6a8b5349746c971bb86f80b89",
+      "compile_exit": 0,
+      "expected_exit": 11,
+      "observed_exit": 11
+    },
+    {
+      "name": "active-listener-off",
+      "source_sha256": "fcd0d6917bd4d919edcb42df46061f5b43d2959ca6d744bed2b1c920a6df0a95",
+      "binary_sha256": "e3ac0b6c8ce4a3f7dfa405b6953aee4a63b506896e30b81f4a00ac4cfd70e631",
+      "compile_exit": 0,
+      "expected_exit": 14,
+      "observed_exit": 14
+    },
+    {
+      "name": "draining-worker-refused",
+      "source_sha256": "24f7642adc5ed178ab37e266fc5d12798e2d9416d091e8b9adf9eecab4bd02a1",
+      "binary_sha256": "6c09108f524001c69fa204c702b440c8dc33ac9d8ec3f9c92d07c8750be75e00",
+      "compile_exit": 0,
+      "expected_exit": 23,
+      "observed_exit": 23
+    },
+    {
+      "name": "listener-check-off",
+      "source_sha256": "2656df0323acc60dafc9649253c608547bd48bf37784c4a839610d73496f45d9",
+      "binary_sha256": "f8114cdacc23170bd5d29ad8bf8ff64611146655c15061728b91362b1872b3d5",
+      "compile_exit": 0,
+      "expected_exit": 30,
+      "observed_exit": 30
+    }
+  ],
+  "commands": [
+    {
+      "command": "NET_KEEP=1 OMEGA_OMC=/tmp/aienet-omc NGINX_BIN=/tmp/aienet-nginx-oracle/usr/sbin/nginx sh om/agora/check.sh",
+      "exit": 0,
+      "observed": "core realPASS;7coremutants rejected; native realPASS; barrier-off11; active-listener-off14; draining-worker-refused23; listener-check-off30; networkPASS; independent edge client quotas NOT_IMPLEMENTED (not used by registration-only deployment)"
+    },
+    {
+      "command": "NGINX_BIN=/tmp/aienet-nginx-oracle/usr/sbin/nginx python3 scripts/test-agora-deploy.py",
+      "exit": 0,
+      "observed": "exact routes/methods; refusalupstream0; nonPROXYrefusal; spoofidentity/quota; responseprivacyheaders; APIaccesslogexclusion; active-debug syntheticbody-sentinelabsence; no retainedbodyfiles. Suppressioncausality NOT_QUALIFIED (override-removal mutant survived); transientbodyspill and recoverykey response logs NOT_QUALIFIED"
+    }
+  ],
+  "mechanism": [
+    "Held native /hold response across initial HUP leaves a real old worker alive, title shutting down, with no listener; barrier accepts it.",
+    "The next active worker is stopped only in the isolated fixture; its actual listener is proven before master HUP control. Barrier refuses a still-active owner despite a newer worker.",
+    "rc_safe(pid,true) predicate seam must refuse that proven owned listener even when given a draining classification. Only removal of the listener predicate produces exit30. This is a classification seam, not an observation that a naturally draining nginx worker retained a listener.",
+    "TCP ownership uses128descriptor fixturelimit and ARM64 stat inodeoffset8; socket filekind is learned from live fstat on the native reference socket. Both TCP tables streamed in256bytebuffer, preserving tokens/rows across reads, absence only afterEOF; read errors/incomplete rows/boundedloop exhaustion refuse.",
+    "Successful observations recheck monotonicdeadline before returningtrue."
+  ],
+  "diagnostic_history": [
+    {
+      "observation": "initial single-read reader could return absence beforeEOF; corrected following read-onlyreview",
+      "label": "CODE_DEFECT; historical missed-row cause INFERENCE"
+    },
+    {
+      "observed_full_matrix_exits": [
+        25,
+        32
+      ],
+      "observation": "64K accumulated-table reader failed its safe capacity check during corematrix load; instrumented capacity stage203 ondrainingworker320280; simultaneous rootlessss showed no320280listener",
+      "command": "wc -c /proc/net/tcp /proc/net/tcp6",
+      "observed_bytes": {
+        "tcp": 140250,
+        "tcp6": 1569
+      },
+      "fix": "bounded streaming parser; subsequent complete matrix exit0"
+    }
+  ],
+  "production_read_only_control": {
+    "command": "ssh hub 'sudo ss -ltnp && ps -p 1707,1708,1710 -o pid=,ppid=,args='",
+    "observed": "AllthreePIDs1707/1708/1710 are nginx worker process is shutting down; none owns any listed IPv4/IPv6TCP listening socket. No worker signaled or killed."
+  },
+  "review": "Read-only DrainBarrierFinal approved logic with explicit fixture/production limits; no checks run by reviewer.",
+  "wolfram": "WolframLanguageEvaluator output relayed by Main: UnitConvert[Quantity[{30,0.1,0.01},\"Seconds\"],\"Nanoseconds\"] -> {Quantity[30000000000,\"Nanoseconds\"],Quantity[1.*^8,\"Nanoseconds\"],Quantity[1.*^7,\"Nanoseconds\"]}.",
+  "limits": [
+    "One-worker native fixture is not full productionworker enumeration; explicit128FDlimit is fixture-only.",
+    "Native newchildPID observation is not independent proof of production new ACTIVE title; production ps/ss evidence remains mandatory.",
+    "No live activation in this receipt; productionprivacy/browser/durability andbootenable NOT_RUN.",
+    "Earlier reload.evidence.json remains historical and unchanged. No Omega harness language/compiler/pin/genericguide affected; deploymentrunbook updated."
+  ]
+}
diff --git a/om/agora/reload-check.om b/om/agora/reload-check.om
index adb34596..9eac8868 100644
--- a/om/agora/reload-check.om
+++ b/om/agora/reload-check.om
@@ -7,6 +7,16 @@ global rc_b uchar 16384
 global rc_p uchar 4096
 global rc_r uchar 4096
 global rc_x uchar 4096
+global rc_inos ulong 128
+global rc_meta uchar 128
+global rc_net uchar 256
+global rc_ts ulong 6
+text rc_cmd "/cmdline"
+text rc_fds "/fd/"
+text rc_tcp "/proc/net/tcp"
+text rc_tcp6 "/proc/net/tcp6"
+text rc_down "nginx: worker process is shutting down"
+text rc_hold "GET /hold HTTP/1.0\nHost: localhost\n\n"
 text rc_pre "/proc/"
 text rc_mid "/task/"
 text rc_ch "/children"
@@ -15,21 +25,21 @@ text rc_hit "/hits.log"
 text rc_flag "-c"
 text rc_g "-g"
 text rc_off "daemon off;"
-text rc_cfg "worker_processes 1;\nerror_log stderr error;\npid "
+text rc_cfg "worker_processes 1;\nworker_rlimit_nofile 128;\nerror_log stderr error;\npid "
 text rc_pid "/pid;\nevents { worker_connections 64; }\nhttp { access_log off;\nclient_body_temp_path "
 text rc_tmp "/body;\nproxy_temp_path "
 text rc_tmp2 "/proxy;\nfastcgi_temp_path "
 text rc_fc "/fastcgi;\nuwsgi_temp_path "
 text rc_uw "/uwsgi;\nscgi_temp_path "
 text rc_sc "/scgi;\nserver { listen 127.0.0.1:"
-text rc_route "; location = /agora/api/challenge { add_header Cache-Control no-store always; proxy_pass http://127.0.0.1:"
+text rc_route "; location = /hold { limit_rate 1; return 200 'synthetic draining-worker verification connection held open without touching any production worker'; } location = /agora/api/challenge { add_header Cache-Control no-store always; proxy_pass http://127.0.0.1:"
 text rc_srv "; } }\nserver { listen 127.0.0.1:"
 text rc_log "; access_log "
 text rc_tail "; location / { return 200 'synthetic readiness'; } } }\n"
 text rc_req "GET /agora/api/challenge HTTP/1.0\nHost: localhost\n\n"
 text rc_ok "HTTP/1.1 200 OK"
 text rc_nost "Cache-Control: no-store"
-text rc_pass "AGORA RELOAD OMEGA PASS barrier; missing-reload and old-worker-alive refused; readiness 200/no-store/one upstream hit\n"
+text rc_pass "AGORA RELOAD OMEGA PASS pre-existing drainer/no-listener accepted; missing-reload and old-active-listener refused; readiness 200/no-store/one upstream hit\n"
 
 fn rc_ck yes bool to void
 if not yes
@@ -75,6 +85,23 @@ fn rc_file t view uchar * to long
 n = rc_path t
 ret fopen rc_p 0 n 0 0
 end
+fn rc_has needle view uchar * n ulong to bool
+if lt n len needle
+ret false
+end
+for i ulong add sub n len needle 1
+same = true
+for j ulong len needle
+if ne get rc_r add i j get needle j
+same = false
+end
+end
+if same
+ret true
+end
+end
+ret false
+end
 fn rc_child master int to int
 put rc_s 0 0
 rc_emit rc_pre
@@ -110,6 +137,187 @@ ret -1
 end
 ret int get rc_s 7
 end
+fn rc_proc pid int suffix view uchar * to ulong
+put rc_s 0 0
+rc_emit rc_pre
+rc_dec ulong pid
+rc_emit suffix
+ret get rc_s 0
+end
+fn rc_drain pid int to bool
+n = rc_proc pid rc_cmd
+fd = int fopen rc_b 0 n 0 0
+if lt fd 0
+ret false
+end
+got = read fd rc_r 0 len rc_r
+r = fclose fd
+if le got 0
+ret false
+end
+ret rc_has rc_down ulong got
+end
+fn rc_u64 off ulong to ulong
+v = ulong 0
+for i ulong 8
+v = or v shl ulong get rc_meta add off i mul i 8
+end
+ret v
+end
+fn rc_owned ino ulong to bool
+if eq ino 0
+ret false
+end
+for i ulong 128
+if eq get rc_inos i ino
+ret true
+end
+end
+ret false
+end
+note Linux ARM64 stat inode offset8 follows asm-generic/stat.h; worker fd limit128 is explicit above.
+fn rc_fstat pid int to bool
+for i ulong 128
+put rc_inos i 0
+n = rc_proc pid rc_fds
+rc_dec i
+r = stat rc_b 0 get rc_s 0 rc_meta 0 len rc_meta
+if eq r 0
+if eq ulong shr get rc_meta 17 4 get rc_s 3
+put rc_inos i rc_u64 8
+end
+else
+if ne r -2
+ret false
+end
+end
+end
+ret true
+end
+note TCP streaming state: column, token length, inode, LISTEN flag, header flag, token flag.
+note The small buffer exercises rows and tokens split across reads; no whole-table allocation.
+fn rc_char c uchar to long
+if or eq c 32 eq c 10
+if eq get rc_ts 5 1
+if eq get rc_ts 0 3
+if ne get rc_ts 1 2
+put rc_ts 3 0
+end
+end
+put rc_ts 0 add get rc_ts 0 1
+put rc_ts 5 0
+end
+if eq c 10
+if eq get rc_ts 4 0
+if lt get rc_ts 0 10
+ret -1
+end
+if eq get rc_ts 3 1
+if rc_owned get rc_ts 2
+ret 1
+end
+end
+end
+put rc_ts 4 0
+put rc_ts 0 0
+put rc_ts 2 0
+put rc_ts 3 1
+end
+else
+if eq get rc_ts 5 0
+put rc_ts 1 0
+put rc_ts 5 1
+end
+if eq get rc_ts 4 0
+if eq get rc_ts 0 3
+if eq get rc_ts 1 0
+if ne c 48
+put rc_ts 3 0
+end
+else
+if or ne get rc_ts 1 1 ne c 65
+put rc_ts 3 0
+end
+end
+end
+if eq get rc_ts 0 9
+if or lt c 48 gt c 57
+ret -1
+end
+if ge get rc_ts 1 20
+ret -1
+end
+put rc_ts 2 add mul get rc_ts 2 10 ulong sub c 48
+end
+end
+put rc_ts 1 add get rc_ts 1 1
+end
+ret 0
+end
+fn rc_end fd int value long to long
+r = fclose fd
+if ne r 0
+ret -1
+end
+ret value
+end
+note proc seq files may short-read; absence is proven only at EOF after complete rows.
+fn rc_table path view uchar * to long
+fd = int fopen path 0 len path 0 0
+if lt fd 0
+ret -1
+end
+for i ulong len rc_ts
+put rc_ts i 0
+end
+put rc_ts 3 1
+put rc_ts 4 1
+for j ulong 65536
+n = read fd rc_net 0 len rc_net
+if lt n 0
+ret rc_end fd -1
+end
+if eq n 0
+if eq get rc_ts 4 1
+ret rc_end fd -1
+end
+if or ne get rc_ts 5 0 ne get rc_ts 0 0
+ret rc_end fd -1
+end
+ret rc_end fd 0
+end
+for i ulong ulong n
+r = rc_char get rc_net i
+if ne r 0
+ret rc_end fd r
+end
+end
+end
+ret rc_end fd -1
+end
+fn rc_list pid int to long
+if not rc_fstat pid
+ret -1
+end
+r = rc_table rc_tcp
+if ne r 0
+ret r
+end
+ret rc_table rc_tcp6
+end
+fn rc_safe pid int draining bool to bool
+if not draining
+ret false
+end
+note MUTANT_DRAIN: a pre-existing draining worker with no listener is safe.
+ret eq rc_list pid 0
+end
+fn rc_clear pid int to bool
+if eq killpid pid 0 -3
+ret true
+end
+ret rc_safe pid rc_drain pid
+end
 fn rc_wait master int old int limit long to bool
 start = monons
 if lt start 0
@@ -122,9 +330,10 @@ ret false
 end
 cur = rc_child master
 if and gt cur 0 ne cur old
-note MUTANT_OLD: a new worker alone is not readiness.
-if eq killpid old 0 -3
-ret true
+note MUTANT_OLD: a new worker alone cannot excuse an old active listener.
+if rc_clear old
+now = monons
+ret and ge now start lt sub now start limit
 end
 end
 r = sleepns 10000000
@@ -173,6 +382,8 @@ rc_ck eq r 0
 fd = int hlisten a 16
 rc_ck ge fd 0
 prt = hport a
+rc_ck eq fstat fd rc_meta 0 len rc_meta 0
+put rc_s 3 ulong shr get rc_meta 17 4
 r = fclose fd
 rc_ck eq r 0
 ret prt
@@ -210,50 +421,73 @@ n = write fd rc_b 0 get rc_s 0
 rc_ck eq n long get rc_s 0
 rc_ck eq fclose fd 0
 end
-fn rc_has needle view uchar * n ulong to bool
-if lt n len needle
-ret false
-end
-for i ulong add sub n len needle 1
-same = true
-for j ulong len needle
-if ne get rc_r add i j get needle j
-same = false
-end
-end
-if same
-ret true
-end
-end
-ret false
-end
-fn rc_request prt ulong to bool
+fn rc_send prt ulong req view uchar * to int
 a = new uchar 16 0
 r = haddr4 a 2130706433 prt
 fd = int socknew 2 1 0
 if lt fd 0
-ret false
+ret -1
 end
 r = connect fd a 0 16
 if lt r 0
 r = fclose fd
-ret false
+ret -1
 end
 n = ulong 0
-for i ulong len rc_req
-if eq get rc_req i 10
+for i ulong len req
+if eq get req i 10
 put rc_b n 13
 n = add n 1
 end
-put rc_b n get rc_req i
+put rc_b n get req i
 n = add n 1
 end
 r = send fd rc_b 0 n 0
 if ne r long n
 r = fclose fd
+ret -1
+end
+ret fd
+end
+fn rc_hopen prt ulong to int
+fd = rc_send prt rc_hold
+if lt fd 0
+ret -1
+end
+r = waitio fd 1 100000000
+if gt r 0
+r = recv fd rc_r 0 1 0
+end
+if ne r 1
+r = fclose fd
+ret -1
+end
+ret fd
+end
+fn rc_dwait pid int to bool
+start = monons
+while true bound 999999
+now = monons
+if or lt now 0 ge sub now start 30000000000
+ret false
+end
+if and rc_drain pid eq rc_list pid 0
+now = monons
+ret and ge now start lt sub now start 30000000000
+end
+if ne killpid pid 0 0
+ret false
+end
+r = sleepns 10000000
+end
+ret false
+end
+fn rc_request prt ulong to bool
+fd = rc_send prt rc_req
+if lt fd 0
 ret false
 end
-n = 0
+n = ulong 0
 while lt n len rc_r bound 4096
 r = waitio fd 1 100000000
 if le r 0
@@ -281,6 +515,39 @@ if le old 0
 ret 10
 end
 put rc_s 5 ulong old
+held = rc_hopen front
+if lt held 0
+ret 24
+end
+put rc_s 4 ulong held
+put rc_s 6 ulong old
+if ne killpid master 1 0
+ret 13
+end
+if not rc_dwait old
+if eq killpid old 0 -3
+ret 26
+end
+if not rc_drain old
+ret 31
+end
+if ne rc_list old 0
+ret 32
+end
+ret 25
+end
+note Pre-existing draining worker still exists, holds a response, but owns no listening socket.
+if ne killpid old 0 0
+ret 26
+end
+if not rc_wait master old 30000000000
+ret 23
+end
+old = rc_child master
+if or le old 0 eq old int get rc_s 6
+ret 27
+end
+put rc_s 5 ulong old
 note MUTANT_NEW: absent reload must not pass even though the old worker is alive.
 if rc_wait master old 100000000
 ret 11
@@ -292,6 +559,20 @@ if ne killpid master 1 0
 ret 13
 end
 note The old worker is stopped before HUP, so cannot retire; a new child is not enough.
+if rc_drain old
+ret 22
+end
+found = rc_list old
+if lt found 0
+ret 28
+end
+if ne found 1
+ret 29
+end
+note Bounded predicate seam: even a draining classification must refuse this proven owned listener.
+if rc_safe old true
+ret 30
+end
 if rc_wait master old 100000000
 ret 14
 end
@@ -340,6 +621,10 @@ if le master 0
 ret 91
 end
 result = rc_test master front
+held = int get rc_s 4
+if gt held 0
+r = fclose held
+end
 old = int get rc_s 5
 if gt old 0
 r = killpid old 18