Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/interplane-forge/blob/main/docs/NODES.md # interplane-forge INTERPLANE Forge Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `interplane-forge / docs / NODES.md` 139 lines ยท 9696 bytes Raw Blame History Rendered 1 # Node health, the floor-edge restarts, and what forged runs outside Omega 2 3 Lane E of L1008 (card t_`e5e50a41`). Evidence words: IMPLEMENTED (in this tree), HOST_TESTED (run on the 4 Spark with the named test), DEPLOYED (live), NOT_RUN. 5 6 ## What forged runs outside Omega 7 8 Every outside program is started with `execprog`: an argument list, no shell, no `PATH`, an empty 9 environment, stdout into a pipe, stderr to `/dev/null`. 10 11 | Program | Started from | What for | Replacement | 12 |---|---|---|---| 13 | `/usr/bin/git` | `server/util.om` `fexec` (every git page), `nodes/srch.om` `nsrun` (search), `dl/dl.om` (archives) | read-only `archive`, `blame`, `cat-file`, `diff`, `for-each-ref`, `format-patch`, `grep`, `log`, `ls-tree`, `rev-list`, `rev-parse`, `show` on allow-listed storage (12 subcommands, from the `fka` after each `fkgit` / `fkgiti` in the composed source) | README row 1: a seeded-Omega object reader (zlib inflate, pack index, tree walk). First step done in this lane: `symbolic-ref HEAD` (repository home, commits, branches and tags, in-repository search, and the clone panel) is replaced by `nodes/head.om`, which reads the storage `HEAD` file; parity in `nodes/tests/ab.sh check`. Next: loose and packed refs, then objects. | 14 | `/usr/bin/ssh-keygen` | `social/20crypt.om` | `ssh-keygen -Y verify` of a Radicle-key sign-in signature | README row 2: Ed25519 verify in Omega. Not built in this lane. | 15 16 The node snapshot writer `nodes/snap.om` is its own program, not part of forged. It runs 17 `/usr/bin/sqlite3 -readonly` (the node's two databases) and `rad node status` / `rad node events` 18 (through `/usr/bin/env HOME=...`, because `rad` finds its node socket from `HOME`). Those stay host 19 programs: sqlite3 is how the node's own database is read, and `rad` is the node's own interface. 20 21 ## Node snapshot 22 23 `nodes/snap.om`, built by `./run.sh deploy` as `server/nodes-snap`, run by 24 `infra/spark/aien-nodes.service` as `nodes-snap follow`: 25 26 - writes the snapshot at start; 27 - then follows `rad node events`, the node's own stream of what it just did (a sync, an announcement, 28 a peer coming or going). After an event the snapshot is written again, at most once per 30 s; 29 - with no event nothing runs: there is no timer. When the stream ends (the node restarted) it exits 30 with status 6 and systemd starts it again 30 s later. 31 32 `nodes-snap` with no argument writes once and exits (0 written, 3 or 4 a database query failed, 5 the 33 file could not be written). Any argument other than `follow` is refused with exit 2 and nothing written. 34 35 The file is `~/.local/state/aien-factory/nodes.txt`, mode 0600, replaced by rename. Format 2, one item 36 per line: 37 38 1. `2`, the format 39 2. unix time it was written 40 3. our node id, ``z6MkfZDue1TbaNFi3ZzcD9uiTeduPLC52ucdFVuLKZwexxhK``; readers refuse any other 41 4. connected peers: rows of `rad node status` marked connected 42 5. and on: `RID scope copies behind reach wait` for every repository the node has a sync record for 43 44 | Field | Meaning | Source | 45 |---|---|---| 46 | scope | 2 seed all, 1 seed followed, 0 not seeded here | `policies.db` table `seeding`, policy `allow` | 47 | copies | other nodes that told us which version of our signed refs they hold | `node.db` table `repo-sync-status`, rows of other nodes | 48 | behind | of those, how many do not hold our latest version | head differs from our own row's head | 49 | reach | seconds our latest version took to reach the slowest node that holds it | that node's row time minus our row time | 50 | wait | seconds our latest version has been out while some copy still lacks it; 0 when none is behind | write time minus our row time | 51 52 The writer lists every repository it finds, at most 131072 bytes; a snapshot that would not fit is 53 not written (exit 5), so a cut-off last line never reaches a reader. Readers accept a line only in this 54 exact shape: a RID of 1 to 64 ASCII letters or digits, then five numbers of 1 to 19 ASCII digits, single 55 spaces, nothing else. The time and peer lines must be 1 to 19 digits too. Anything else (markup, quotes, 56 a 30-digit number, a 250-byte line) is dropped whole; a bad header means "not measured". Each reader then 57 shows only its own public allow-list: 58 59 - forge `/status` and `/status.json` (`nodes/stat.om` `nsshape`, `nsdigs`): the forge allow-list (the first 60 table of RIDS.md, minus the deny list). Every loop over a line stays inside its bound because the line 61 has this shape, so no snapshot content can stop the server. The page never runs a program. 62 - the factory floor (`server.py` `nodes_view`, aien-factory patch): the first table of RIDS.md, the same 63 shape, this node's id only, a final newline and at most 262144 bytes; it shows "N peers, M behind" in 64 the machine bar. 65 66 Tests (HOST_TESTED, see READY file for the run): 67 68 - `nodes/tests/snap.sh`: the writer against copies of the live node databases, compared line by line 69 with an independent SQL computation of the same numbers; poisoned repository ids put into the copy 70 (markup, a field separator, a 111-byte id) are never written, and a mutant without the id length guard 71 stops with trap 4 on the long id; a mutant that never counts "behind" fails the comparison; a 512-byte 72 buffer gives exit 5 and no file, and without the refusal it writes a cut-off file; missing database and 73 missing output directory give their exit codes and no file; an argument other than `follow` (for 74 example `once`) gives exit 2 and no file; follow mode against a stand-in event 75 stream writes exactly at start, 30 s and 60 s after two events, never in the silent tail, and exits 76 6 when the stream ends. 77 - `nodes/tests/ab.sh check`: `/status` and `/status.json` from fixture snapshots: public rows with 78 their numbers, links under `/` and `/forge/`, withdrawn and unlisted RIDs never shown, poisoned 79 lines never shown, malformed and overlong lines dropped with the server still answering, JSON 80 parses, old format, wrong node id, a 25-digit time and missing file all give "not measured", a 81 day-old snapshot is flagged, POST is refused. The previous build of this page stopped on such lines 82 (trap 4); that run is the negative control (READY file). 83 - `floor-reader-test.py` (hand-off evidence, not in this repository): the floor reader on the same cases. 84 85 ## aien-floor-edge restarts: root cause 86 87 The unit carries the public floor page to the hub: `ssh -NT -o ExitOnForwardFailure=yes -o 88 ServerAliveInterval=15 -o ServerAliveCountMax=3 -R 127.0.0.1:4748:127.0.0.1:4748 hub`, 89 `Restart=always`, `RestartSec=5`. On 2026-11-08 it restarted 1313 times. 90 91 Timeline (UTC, from the Spark user journal, the hub `ssh` journal and the hub `tailscaled` journal): 92 93 | Time | Where | Line | 94 |---|---|---| 95 | 19:48:37 | hub tailscaled | `timeout opening (TCP => :22)`: the private link between the two machines dropped | 96 | 19:49:06 | Spark, ssh of the unit | `Timeout, server hub not responding`: after 3 x 15 s without an answer the Spark side gave up and exited | 97 | 19:49 to 19:52:42 | Spark | each restart: `connect to host hub port 22: Connection timed out` | 98 | 19:52:49 | Spark | link back; each restart now: `remote port forwarding failed for listen port 4748` | 99 | 19:52:49 to 21:59:43 | hub sshd | 1298 lines `error: bind [127.0.0.1]:4748: Address already in use`; the forge tunnel's port 18480 failed the same way | 100 | 21:59:48 | hub | a new session (sshd-session 959915) binds 4748; the floor is reachable again; Spark ssh pid `3065115` has held it since | 101 102 Cause: the hub never noticed that the old session was dead. Hub sshd ran with `ClientAliveInterval 0` 103 (it never asks a silent client whether it is still there), so the only thing that could end the old 104 session was the kernel's TCP keepalive: `tcp_keepalive_time` 7200 s, then 9 probes 75 s apart. 105 106 WolframLanguageEvaluator: `7200 + 9*75` -> 7875 s = 2 h 11 min 15 s. 107 WolframLanguageEvaluator: `DateObject[{2026,11,8,21,59,43}] - 7875 s` -> 19:48:28, which is inside 108 the outage, consistent with the hub hearing nothing from the Spark after about 19:48:28. 109 110 So the old session, and with it its listener on 127.0.0.1:4748, lived on for 2 h 11 min after the 111 link dropped, and every new forward in between was refused. The restarts were a symptom: the Spark 112 end was right to reconnect; the hub end held the port. 113 114 Reproduction (`nodes/evidence/control-before.txt`, 2026-11-09T05:52Z): open a throwaway forward 115 `ssh -N -R 127.0.0.1:47999:127.0.0.1:9 hub`, then freeze that client with SIGSTOP (it stops answering, 116 like a dead link). After 75 s the hub still listened on 47999 (`HELD`), and a second forward was 117 refused: `Error: remote port forwarding failed for listen port 47999`, exit 255. 118 119 ## Fix (on the hub, DEPLOYED 2026-11-09T05:55Z) 120 121 `/etc/ssh/sshd_config.d/60-aien-client-alive.conf` on the hub: 122 123 ``` 124 ClientAliveInterval 15 125 ClientAliveCountMax 3 126 ``` 127 128 sshd now asks a silent client every 15 s and drops it after 3 unanswered asks, so a dead session lets 129 go of its forwarded ports within 45 s instead of 2 h 11 min. Checked with `sshd -t` (syntax OK), 130 `systemctl reload ssh`, `sshd -T` (`clientaliveinterval 15`, `clientalivecountmax 3`), and a new 131 session opened after the reload. Undo: remove the file and `systemctl reload ssh`. 132 133 Same test after the fix (`nodes/evidence/after-fix.txt`, 2026-11-09T05:55Z): after 75 s frozen the 134 hub had released 47999 (`FREE`), and a second forward bound it and held it for the 20 s test window 135 (timeout exit 124). The live floor and forge tunnels were not restarted. 136 137 The earlier attempt in this lane had installed a polling wrapper (`floor-edge.sh` plus a systemd 138 drop-in) on the Spark without review. It treated the symptom, so it was removed on 2026-11-09 and the 139 unit runs its original `ssh` command again.