@vibelord/lanes 1.7.3 → 1.7.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/README.md +9 -0
  2. package/package.json +1 -1
  3. package/payload/lanes/VERSION +1 -1
  4. package/payload/lanes/bin/lanes +128 -24
  5. package/payload/lanes/bin/lanes-site-serve +15 -0
  6. package/payload/lanes/bin-rs/BINARIES.json +5 -0
  7. package/payload/lanes/container/lane-mcp +108 -5
  8. package/payload/lanes/container/lane_core.py +116 -0
  9. package/payload/lanes/container/throttle-pulse +159 -14
  10. package/payload/lanes/docs/ARCHITECTURE.md +132 -13
  11. package/payload/lanes/docs/DESIGN.md +10 -8
  12. package/payload/lanes/docs/INSTALL.md +1 -1
  13. package/payload/lanes/docs/RUNBOOK.md +436 -8
  14. package/payload/lanes/docs/USERGUIDE.md +82 -9
  15. package/payload/lanes/install/host-install.sh +35 -4
  16. package/payload/lanes/libexec/adopt.py +364 -0
  17. package/payload/lanes/libexec/attach.py +35 -5
  18. package/payload/lanes/libexec/cutover.py +656 -0
  19. package/payload/lanes/libexec/docsd.py +12 -8
  20. package/payload/lanes/libexec/doctor_lanes2.py +284 -0
  21. package/payload/lanes/libexec/economy_poll.py +87 -2
  22. package/payload/lanes/libexec/gc_unregistered.py +407 -0
  23. package/payload/lanes/libexec/lanes_lib.py +474 -2
  24. package/payload/lanes/libexec/native.sh +38 -0
  25. package/payload/lanes/libexec/native_bin.py +670 -0
  26. package/payload/lanes/libexec/session_actions.py +85 -7
  27. package/payload/lanes/libexec/shadow.py +1311 -0
  28. package/payload/lanes/libexec/sidebar.py +252 -30
  29. package/payload/lanes/libexec/sidebar_status.py +373 -25
  30. package/payload/lanes/libexec/statusd.py +67 -3
  31. package/payload/lanes/libexec/tokens.py +99 -131
  32. package/payload/lanes/libexec/tokens.sh +1 -1
  33. package/payload/lanes/libexec/update.py +78 -8
  34. package/payload/lanes/libexec/users.py +282 -0
  35. package/payload/lanes/site/README.md +9 -0
  36. package/payload/lanes/site/conformance.py +280 -0
  37. package/payload/lanes/site/protocol.py +368 -0
  38. package/payload/lanes/site/server.py +314 -0
  39. package/payload/lanes/systemd/lanes-gc.service +1 -1
  40. package/payload/lanes/systemd/lanes-gc.timer +14 -3
  41. package/payload/lanes/tokens/README.md +156 -0
  42. package/payload/lanes/tokens/generate.py +930 -0
  43. package/payload/lanes/tokens/generated/parity.v1.tsv +489 -0
  44. package/payload/lanes/tokens/generated/tokens.resolved.json +835 -0
  45. package/payload/lanes/tokens/tokens.v1.json +763 -0
  46. package/payload/lanes/tokens/tokens.v1.schema.json +143 -0
  47. package/payload/lanes/web/Caddyfile +11 -0
  48. package/payload/lanes/web/README.md +253 -4
  49. package/payload/lanes/web/directory.css +95 -0
  50. package/payload/lanes/web/directory.js +951 -0
  51. package/payload/lanes/web/generated/README.md +107 -0
  52. package/payload/lanes/web/generated/lanes2_protocol.d.mts +1162 -0
  53. package/payload/lanes/web/generated/lanes2_protocol.mjs +2333 -0
  54. package/payload/lanes/web/inbox.js +1140 -0
  55. package/payload/lanes/web/mobile.js +35 -45
  56. package/payload/lanes/web/tokens.css +137 -0
  57. package/payload/manifest.json +7 -4
@@ -171,7 +171,7 @@ replaces only its own files, by rename, and never a `zmx-*` binary a running lan
171
171
  | `bin/lane-mcp` | The Lanes MCP server for the agents (left out with `--no-mcp`) |
172
172
  | `bin/zmx-*` | The pinned zmx holder (optional lanes only) |
173
173
  | `VERSION`, `hooks/`, `env.sh` | The release that installed them, the hook definitions `lanes hooks install` merges, and the shell settings new shells source |
174
- | `bin/throttle-pulse` | The Throttle pulse (1.4.0): reads the daemon's loopback control port every 10 s (GET only) and writes `state/throttle.json`, which the host's statusd reads for the sidebar's fleet block. Installed in every container, **started only in the daemon's container** |
174
+ | `bin/throttle-pulse` | The Throttle pulse (1.4.0): reads the daemon's loopback control port every 10 s (GET only) and writes `state/throttle.json`, which the host's statusd reads for the sidebar's fleet block. Installed in every container, **started only in the daemon's container**. `--projection FILE` (lanes2 E5, opt-in) reads the shared projection adapter's file instead of the daemon ([ARCHITECTURE](ARCHITECTURE.md)) |
175
175
 
176
176
  It installs no agent hook (that is `lanes hooks install`, opt-in) and, unless `--no-mcp`, adds the agents' MCP entries
177
177
  below. A re-run after a server update (the update does it itself for every container `lanes sync` knows) brings every
@@ -385,7 +385,9 @@ lanes studio-host re-key --yes after the owner revoked the Host: a new mac
385
385
  waiting for the terminal:
386
386
  - **Shed and repaint (a slow terminal).** When more than 1 MiB (`LANES_DISPLAY_BACKLOG_BYTES`) would be waiting,
387
387
  the oldest output is dropped until half of it is left, and the cut is marked for the terminal (CAN plus the end of a
388
- synchronized update, so a sequence cut in two cannot swallow what follows). Once everything kept has reached the
388
+ synchronized update, so a sequence cut in two cannot swallow what follows). The first retained escape is found
389
+ across queued read chunks within a 64 KiB scan, so a short read cannot preserve a broken prefix (BEY-7148).
390
+ Without an escape in that window, plain output is retained. Once everything kept has reached the
389
391
  terminal, the supervisor asks Zellij for a full repaint: the client's size goes to one row less and, 0.1 s later,
390
392
  back (Zellij 0.45.1 repaints only on a size it has not seen; with no gap between the two it repaints nothing). At
391
393
  most one repaint a second. The panes are one row shorter for that 0.1 s, so a lane's program also sees a resize.
@@ -409,7 +411,7 @@ lanes studio-host re-key --yes after the owner revoked the Host: a new mac
409
411
  re-reads registries every 2 minutes and the sidebar follows. The zellij layout is never edited live. A sync that
410
412
  finds nothing new leaves `registry.json` (and its `generated_at`) untouched and only records the time in
411
413
  `registry.synced`; the unit is bounded at `TimeoutStartSec=120`.
412
- - **`lanes gc` (daily `lanes-gc.timer`):** truncates zmx logs over 5 MB and removes a `resolve.dynamic/<id>` file
414
+ - **`lanes gc` (`lanes-gc.timer`, daily at midnight):** truncates zmx logs over 5 MB and removes a `resolve.dynamic/<id>` file
413
415
  only when that id is in none of `status.json`'s `lanes`, `unregistered` or `zmx` AND the file is over an hour old.
414
416
  statusd lists every `unregistered` and `zmx` row id under `lanes` as well; reading the other two keys is a
415
417
  defence, not a second source. The mtime alone is no liveness signal: an unregistered session's file is rewritten only when its target or name
@@ -423,6 +425,8 @@ lanes studio-host re-key --yes after the owner revoked the Host: a new mac
423
425
  `.pruning-<version>-…` before it is removed, so a removal cut short never leaves a half tree under its version name;
424
426
  the next run removes the rest. `kept <tree>: <why>` says what holds an old tree (`process <pid> uses it`: look at that
425
427
  process; `the view layout of <device> names it`: `lanes rebuild <device>` moves the view to `current`).
428
+ Last, only on a site whose `site.conf` opts in, it ends the unregistered sessions in which nothing runs
429
+ ([Daily cleanup of unregistered terminals](#daily-cleanup-of-unregistered-terminals-opt-in-lanes-gc---unregistered)).
426
430
  - **What a container sees of its own lanes (`~/.lz/status.json`, LNS-32):** statusd writes each container's slice of
427
431
  `status.json` into that container's `~/.lz` (only where `~/.lz/bin/lane` is installed), on a change and at least
428
432
  every 15 s. Inside the container, `python3 -c 'import json,time; d=json.load(open("/home/coder/.lz/status.json"));
@@ -633,10 +637,15 @@ lanes studio-host re-key --yes after the owner revoked the Host: a new mac
633
637
  The relay keeps keyboard forwarding independent of a blocked display, and current views idle while their tabs
634
638
  have no viewer (BEY-6931/6932). A hidden tab reconnecting to its saved target is normal; the native agent keeps
635
639
  running. `views/<device>/visibility.json` is only a five-second observer hint: uncertainty keeps viewers active.
636
- For a sidebar that refreshes too often, inspect `sidebar-status/<board>.json`; `statusd` updates it only when
637
- that board's rows, shared fleet facts or cross-board attention change (BEY-6933). Older deployments fall back
638
- to `status.json`. These bounds reduce frontend load; exhausted workspace memory or scratch storage still needs
639
- the Fleet owner's resource and retention fix. Do not restart agents or delete tmux sockets to treat latency.
640
+ For a sidebar that refreshes too often, inspect `sidebar-status/@directory.json`, the shared directory every
641
+ sidebar reads: `statusd` rewrites it only when a rendered lane fact, a session listing or a fleet fact changes,
642
+ never for a sample time or process metadata alone, and a sidebar repaints only when its own board's view changed
643
+ apart from the sample times (BEY-6933, Lanes 2.0 C7). A fleet block marked stale on that source while statusd
644
+ runs means statusd stopped publishing payloads: the health line's `status_at` stopped moving
645
+ (`journalctl --user -u lanes-statusd | grep cycle`). Without the directory a sidebar reads
646
+ `sidebar-status/<board>.json`, which `statusd` updates when that board's rows, shared fleet facts or cross-board
647
+ attention change; older deployments fall back to `status.json`. These bounds reduce frontend load; exhausted
648
+ workspace memory or scratch storage still needs the Fleet owner's resource and retention fix. Do not restart agents or delete tmux sockets to treat latency.
640
649
 
641
650
  2026-09-19: ceobox thrashed (load 400+ on 64 cores, swap full, memory pressure 68 %); `coder-dev-work` sat at 207 of
642
651
  its 208 GiB, 95 GiB of that in its RAM-backed `/tmp`. **No lane was lost** — every pane kept its pid — but the
@@ -817,7 +826,8 @@ night sky of single-dot Braille "stars". Started with no client attached it pain
817
826
  - It stops recurring when the clients agree on brightness: the same light/dark choice in Cursor's terminal and in the
818
827
  lanes window (Ghostty `theme = light:…,dark:…` follows the OS and therefore flips twice a day).
819
828
 
820
- The sidebar's own colours and glyphs come from one token table (`libexec/tokens.py`; spec
829
+ The sidebar's own colours and glyphs come from one token source (`tokens/tokens.v1.json`, read through the generated
830
+ table `libexec/tokens.py` loads; regenerate with `python3 tokens/generate.py --write`; spec
821
831
  `docs/superpowers/specs/2026-10-03-lanes-cockpit-design.md` §2.4) and these switches, resolved per device (the
822
832
  notification switch `--notify` / `LANES_NOTIFY` resolves the same way, above):
823
833
 
@@ -2589,7 +2599,7 @@ CSP: pages `default-src 'none'; style-src 'self' 'unsafe-inline'; script-src 'se
2589
2599
  `sandbox allow-scripts`, everything else `default-src 'none'; sandbox`.
2590
2600
  Links and assets in a page are relative (`docs.css`, `d/<id>`), so the pages work under the stripped prefix; open the
2591
2601
  index as `/lanes-docs/` with the slash (`/lanes-docs` alone is the page route a device of that name would have, which
2592
- is why `lanes-docs`, `lanes-assets` and `enrol` are not device names). An upload goes through `uploads.receive` (W5):
2602
+ is why `lanes-docs`, `lanes-assets`, `lanes-hooks` and `enrol` are not device names). An upload goes through `uploads.receive` (W5):
2593
2603
  it lands in the lane's workspace's `uploads/` (`<folder>/uploads/<name>`, `-1` on a collision, exactly as `lanes
2594
2604
  upload` lands one) and `docs_store.intake` (`source` `web`, kind by extension, `for` and `by` the uploader) takes the
2595
2605
  same bytes into the person's store; the receipt's `landed` is the in-container path to tell the agent. The drop area is
@@ -2971,6 +2981,271 @@ signature: without `strict` (and without `**kwargs`) it makes the older call and
2971
2981
  on one address then refuse, as before 1.7.0, instead of being listed — and `lanes doctor` prints the same as a `⚠`.
2972
2982
  The hook's fix is to forward keyword arguments (`def build_registry(previous=None, **kw)`), after which nothing is said.
2973
2983
 
2984
+ ## Daily cleanup of unregistered terminals (opt-in, `lanes gc --unregistered`)
2985
+
2986
+ Operator ask 2026-11-02: "garbage collection on unregistered lanes daily at midnight unless they are running live".
2987
+ Ending a session stays a person's call everywhere else; this is the operator's standing instruction for one site, off
2988
+ until `site.conf` says otherwise (`libexec/gc_unregistered.py`; DM-LANES-SITE, DM-LANES-GC-UNREGISTERED).
2989
+
2990
+ | Setting | File | Default |
2991
+ | --- | --- | --- |
2992
+ | `LANES_GC_UNREGISTERED=1` — the daily `lanes gc` ends the unregistered sessions in which nothing runs (any other value, or none: off) | `~/.config/lanes/site.conf` | off |
2993
+ | `LANES_GC_IDLE_S=<seconds>` — how long a session must have shown no output; a value under 3600 or not a whole number is refused (`lanes doctor` ⚠, the sweep ends nothing) | `~/.config/lanes/site.conf` | 21600 (6 h) |
2994
+
2995
+ Each is `KEY=VALUE` alone on its line (`lanes_lib.SITE_LINE`), a comment on a line of its own. A line naming a
2996
+ `LANES_GC_` key that SITE_LINE does not admit — a trailing comment, quotes, a space after the value, a leading blank —
2997
+ is refused, never read as unset (which would leave the switch silently off or the floor silently 6 h): the sweep ends
2998
+ nothing (one line, `gc unregistered: site.conf line … is refused: …; nothing was ended`, naming it; `lanes gc
2999
+ --unregistered` refuses alike) and `lanes doctor` prints the same line with `⚠`, whatever the switch says. A line that
3000
+ starts with `#` names nothing.
3001
+
3002
+ **The timer.** `lanes-gc.timer` runs `lanes gc` at midnight, host time (`OnCalendar=*-*-* 00:00:00`,
3003
+ `RandomizedDelaySec=300`, `Persistent=true`: a midnight the host was off for runs once at the next boot). Every server
3004
+ install and update renders the unit again; the update's post-commit runs `systemctl --user daemon-reload` and, when the
3005
+ new tree's `systemd/lanes-gc.timer` text differs from the tree before, `systemctl --user try-restart lanes-gc.timer`
3006
+ right after it (the step `try-restart lanes-gc.timer`: the new schedule is armed at once, not after the old one fires;
3007
+ a timer the operator stopped stays stopped). So a host updated from a release whose timer was boot-relative
3008
+ (`OnBootSec=10min`, `OnUnitActiveSec=1d`) moves to midnight at that update; `systemctl --user list-timers
3009
+ lanes-gc.timer` shows the next run. [inferred, not measured here: systemd schedules a `Persistent=` calendar timer from
3010
+ its last trigger, which on such a host lies before the last midnight, so one `lanes gc` may run at the update itself:
3011
+ its housekeeping is idempotent, and its sweep ends only what one at midnight would.] `lanes gc` does its other
3012
+ housekeeping first, then the sweep, in write mode, only with the switch on (off, it prints nothing about it).
3013
+
3014
+ **What it reads and what it ends.** Only `status.json`'s `unregistered` rows (statusd's tmux sessions no registry
3015
+ declares — unregistered, including a lane a person unregistered while it ran): a registered lane is never one. The
3016
+ rule (review of PR #750): a session is ended only on **positive evidence that nothing runs in it** — (1) its agent's
3017
+ status is `shell` (the harness ended into its shell), or it has no agent and its pane's command is a bare shell
3018
+ (`agent_state.SHELL_COMMANDS`; a login shell's `-bash` and a path normalised), or its pane is dead; and (2) just before
3019
+ the close, a live probe of every pane of every window (`tmux list-panes -s -t =<session>: -F
3020
+ '#{pane_current_command}\t#{pane_dead}\t#{pane_pid}'` through `L.tmux_probe`) shows each pane dead, or a bare shell
3021
+ with no process under it (the container's `/proc`, as statusd's `pane_has_child`: lanes start harnesses as `bash -c
3022
+ '<harness> …'`, so tmux names the shell while the harness runs under it). Every other agent — errored, done,
3023
+ needs_input, needs_approval, working, idle, or a status the sweep does not know — keeps the session. One line per
3024
+ session, `<verdict>: <reason> — <id> (<container> <socket>/<session>)`; the first reason found, in this order, keeps
3025
+ it:
3026
+
3027
+ | Line | When |
3028
+ | --- | --- |
3029
+ | `keep: not closable (…)` | no closable tmux row (a retired legacy shell) |
3030
+ | `keep: behind guest:<alias> (its guest sweeps)` | its container is behind a guest (Federation, below): an aggregator never ends a guest's session; the guest's own Lanes does, under its own site.conf |
3031
+ | `keep: not typed here (…)` | no local write route: reached only through a `tmux_probe` hook, or not at all |
3032
+ | `keep: unobserved (…)` | `status.json` older than 30 s (`is lanes-statusd running?`), no row, a `stale` row (its tmux server did not answer), state `unknown`, a row without its client counts, or (no agent) a row that names no pane command |
3033
+ | `keep: attached` / `keep: viewers N` | a terminal is attached, or N sessions (a Studio browser's `view-…`) view it |
3034
+ | `keep: agent <status>` | an agent whose status is not `shell`: `errored`, `done`, `needs_input`, `needs_approval`, `working`, `idle`, … (every harness prompt is live) |
3035
+ | `keep: runs <command>` | no agent, and the pane's command is no bare shell (`vim`, `python3`, `ssh`, `tail`) |
3036
+ | `keep: active <age> ago` | state `active`, or the last output (`activity`, the newest `window_activity`) newer than `LANES_GC_IDLE_S` |
3037
+ | `keep: state <state>` | any state but `quiet` or `dead` |
3038
+ | `keep: no output time` | the row has no `activity`: fail closed |
3039
+ | `keep: runs <command>` (probe) | another pane of the session runs it — a Claude in window 1 behind window 0's bash |
3040
+ | `keep: runs a process under <shell>` (probe) | a live bare-shell pane has a child process |
3041
+ | `keep: panes not checked (…)` (probe) | the probe did not answer `ok`, listed no pane or a line it cannot read, or a pane's children could not be read |
3042
+ | `reap: idle <age>, <what>, no client` | everything else; `<what>` is `agent shell`, `pane dead` or `no agent` |
3043
+
3044
+ The dry run probes the panes of each `reap` candidate too (read-only), so its lines say what a write would do. A `reap`
3045
+ session is ended only with `--write` (the timer's run, or `lanes gc --unregistered --write` by hand, which works with
3046
+ the switch off too: a person typed it), and only after its row is read again from a fresh `status.json`, judged again
3047
+ (`keep: attached (since the listing)` when someone attached meanwhile) and its panes probed once more. The end is
3048
+ `session_actions.close_idle_session` (BEY-7156): it rechecks cached eligibility and every pane's process evidence
3049
+ under the registry lock. The final `if-shell -F` predicate inside tmux requires the exact identity, no client or
3050
+ session group, and positive, old activity on every window. A new client, view or output refuses the close even
3051
+ before statusd catches up. GC never kills a viewer. The sidebar's explicit human close is unchanged. Never a bare
3052
+ `tmux kill-session`, never docker.
3053
+
3054
+ **The journal.** Under the timer the lines go to `journalctl --user -u lanes-gc.service`: `ended: idle 7h, no agent, no
3055
+ client — <id> (…)` for each session ended, `not ended: <why> — <id> (…)` when the close refused (a session that
3056
+ changed, a view, a client that attached, a grouped stranger, a slow tmux), then `gc unregistered: ended N, not ended N,
3057
+ kept N`. A write run is recorded in `~/.local/state/lanes/gc-unregistered.json` with `by`: `timer` when systemd started
3058
+ the process (it sets `INVOCATION_ID` for every unit it runs), else `hand`. `lanes doctor` prints one information line
3059
+ from it and site.conf: `gc unregistered: off (LANES_GC_UNREGISTERED unset)` or `gc unregistered: on, idle ≥ 6h, last
3060
+ sweep 2026-11-02 00:03 UTC: ended 1` (`(by hand)` after the time for a run by hand); `⚠` for a refused
3061
+ `LANES_GC_IDLE_S`, or for a refused `LANES_GC_` line, named.
3062
+
3063
+ **Before switching it on.** Run the dry run, `lanes gc --unregistered` (optionally `--board <board>`), and read every
3064
+ `reap` line: each is a session that will be ended at the next midnight. Register anything worth keeping (`a` in the
3065
+ sidebar, `lanes register`).
3066
+
3067
+ ## Federation: lanes-site/1 (guests behind a forced-command key)
3068
+
3069
+ Plan row H1 (BEY-6899, BEY-6912; Lanes2 architecture §3.32 and §7.5; DM-LANES-SITE-ADAPTER). A host whose boards
3070
+ live in containers on other docker hosts (the guests) reaches them through one protocol, `lanes-site/1`: newline JSON
3071
+ over one long-lived `ssh -T` per guest, behind a forced-command key on the guest. It ships with the reference server
3072
+ and stays inert until a catalog board names a guest transport: with no `transport` key anywhere every call path is
3073
+ the one of before, and `containers.json` keeps its bytes.
3074
+
3075
+ **What v1 does and does not do on the host.** Before the aggregator duty (Lanes2 W20) a host builds no lanes for a
3076
+ guest board: `lanes sync` refuses it with the board error `aggregator_absent: board <id> is behind guest:<alias>; …`
3077
+ (shown by `lanes doctor` under `registry clean`) and keeps the lanes the board had, stale; statusd never reads a
3078
+ guest's lanes as `missing` (it does not observe them, so they stay stale, then `unknown`); `lanes upload` into a guest
3079
+ board refuses before anything lands (a guest's files are not readable from here); statusd neither delivers, renames
3080
+ nor re-arms there (the guest's own statusd does all three). What it gives now: `lanes doctor` greets every guest a
3081
+ board names (`✓ guest:<alias> answers lanes-site/1`, the O-3 installed witness), and the host client
3082
+ (`lanes_lib.SiteClient`, `lane_write`'s `tmux_write` arm, `guest_probe`) that a host whose registry carries a guest's
3083
+ lanes types through — today only a host whose registry a runtime hook builds (rd-control; which functions its hook
3084
+ replaces is O-3 part 1's anchor list, [inferred] not measured here).
3085
+
3086
+ **Choosing the transport.** A board of `catalog.json` takes an optional `"transport"`: `"local"` (the default: its
3087
+ containers run on this docker host) or `"guest:<ssh alias>"`. Every container a board's manifest names gets that
3088
+ board's transport. A board whose transport is invalid, or that puts a container behind another transport than a
3089
+ second board does, costs that board only: `lanes sync` makes it the board's error (its previous lanes kept, stale),
3090
+ its containers get no route (a typed action says `no write transport for <c> (catalog.json board <b>: transport … is
3091
+ not …)`), and every other board keeps its route. A guest's containers are not asked of `docker inspect` here:
3092
+ `lanes sync` records them in `containers.json` as
3093
+ `{"pid": 0, "home": "", "running": false, "transport": "guest:<alias>", "container": "<name>"}`.
3094
+
3095
+ ```json
3096
+ {"version": 1, "workspaces": [
3097
+ {"id": "work", "title": "Work", "manifest": "workspaces.work.json", "transport": "guest:rd-work-site"}]}
3098
+ ```
3099
+
3100
+ **On the guest.** The guest runs its own Lanes (its registry and containers files are what the server answers from).
3101
+ The aggregator's site key gets one `authorized_keys` line (AR §3.32's path), and nothing else may run with it:
3102
+
3103
+ ```text
3104
+ command="/home/<user>/.local/share/lanes/current/bin/lanes-site-serve",restrict ssh-ed25519 AAAA... lanes-site@<aggregator>
3105
+ ```
3106
+
3107
+ `bin/lanes-site-serve` (POSIX sh) execs `python3 -S -E -B site/server.py`. When `$LANES_STATE/flags/rs-site` exists it
3108
+ names the native adapter (`lanesd site-serve`, W20), which no guest has yet, so it answers one
3109
+ `adapter_unavailable` frame and exits 69 instead of serving something else. `restrict` gives no pty, no forwarding and
3110
+ no agent, and the client's requested command is ignored. On the aggregator, `~/.ssh/config` names the alias
3111
+ (`Host rd-work-site`, its `HostName`, `User`, `IdentityFile` of the site key, `IdentitiesOnly yes`). The site alias is
3112
+ never the alias a holder attaches through: attaching needs a pty, which this key refuses.
3113
+
3114
+ **What it serves (v1).** `hello` (first, always: `lanes_site`/`proto` 1, `guest_id`, `boot_id`, `versions`,
3115
+ `capabilities`, `ops`, `epochs` — `{}` until an owner fences a workspace; a newer major is refused
3116
+ `version_unsupported`), `boards.list`, `boards.lanes{board}`, `tmux_read{container, socket, args}` (a read-only verb
3117
+ allowlist: `list-sessions`, `list-panes`, `list-windows`, `list-clients`, `has-session`, `display-message -p`,
3118
+ `capture-pane -p`; no format job `#(`, no `E:`/`T:` format modifier, which expands a value such as a pane title as a
3119
+ format again, no `pane_start_command` and no `@` user option inside a format, no word ending in `;`, only a socket a
3120
+ registered lane of that container uses; the reply's text is cut to a byte budget that always fits one frame, a
3121
+ capture keeping its newest lines), ONE write `tmux_write{lane, text, enter}` (send-keys only, into the active pane of
3122
+ a lane registered on that guest, at most 4000 printable characters on one line, under the recipient's dispatch lock
3123
+ `~/.lz/state/dispatch/<lane>.lock`, the Enter as a second client 0.5 s later), and `exec{template, args: {container}}`
3124
+ by template id only: `pulse.rearm` and `peerd.rearm` (plan row H1's two re-arms, 10 s each). The guest decides
3125
+ whether a re-arm is due by its own statusd's checks — `busy` while its own health is critical, `skipped` (with the
3126
+ reason in `detail`) when the loop is not installed or its state file is fresh, `off` with `LANES_PEERS=0` — so the
3127
+ aggregator is never a second actor. The mutating ops take an optional `intent` (echoed) and `epoch`; v1 enforces
3128
+ neither, and the owner fence's codes (`epoch_required`, `intent_required`, `stale_epoch`, `owner_unclaimed`, …) are
3129
+ reserved so that turning it on stays additive. Every adapter checks a request's shape, verb allowlist and text bound
3130
+ before its recipient. Errors are typed (`hello_required`, `lane_unregistered`, `verb_refused`, `argv_refused`,
3131
+ `template_unknown`, `busy`, `text_too_long`, … — `site/protocol.py` `ERRORS`). No op serves a lane's create recipe
3132
+ or a secret-looking key; `tmux_read` returns what tmux shows of a registered socket (a screen can hold anything typed
3133
+ into it). There is no file read or write, no message store op and no stream in v1: those arrive with the owner
3134
+ runtime (§3.32 W17/W20).
3135
+
3136
+ **Typed actions with no write transport.** A container with no local init and no guest transport is asked through
3137
+ `tmux_probe` first, looked up at call time: when the fleet's runtime hook replaces it and it answers, typing goes on
3138
+ (`lanes upload --paste` types through it, and `lanes doctor` prints `✓ write transport for <c> — tmux_probe
3139
+ reaches it …`), while `lanes names sync` and `lanes message` refuse, because their recipient checks read the container's own
3140
+ files. Only when `tmux_probe` answers `noserver` (rd-control's boards with no hook on `tmux_probe`, BEY-6899) does
3141
+ every typed action say `not typed: no write transport for <container> (…)`: on stderr with exit 1 (`lanes upload
3142
+ --paste` after its files landed and its `.done` was written, `lanes message`, `lanes names sync` with or without
3143
+ `--write`), once per change in statusd's journal (`transport <container>: not typed: …`), and as one
3144
+ `✗ write transport for <container>` line in `lanes doctor`. `lanes upload --paste` exits 1 for every paste that typed
3145
+ nothing (a guest's refusal, a guest that gave no answer — whether it was typed is then not known and it is not
3146
+ resent — or a lane that is no tmux lane). `lanes names sync --write` into a guest's lane is `not typed here` and
3147
+ exit 1: lanes-site/1 v1 carries no rename; run it on the guest. A stopped local container stays
3148
+ `container <name> is not running`.
3149
+
3150
+ **Updating an aggregator (BEY-7140).** A host whose boards all run behind guests has no local container to ship a
3151
+ contract to, and may have no docker daemon of its own for its Lanes user. Two things follow for `--update-only`:
3152
+ the Throttle daemon's container (site.conf's `LANES_THROTTLE_CONTAINER`, else the Throttle tab's) is skipped by the
3153
+ post-commit when its route — its containers.json record, else the catalog board that names it — is `guest:<alias>`
3154
+ (`WARN install-container <c> (skipped: runs behind guest:<alias>: that guest ships its own contract (lanes-site/1))`,
3155
+ a warning, the record `ok`; docker is not asked about it), and a refused `docker info` in the preflight does not stop
3156
+ the update when `lanes sync` recorded no local container with a home volume (`WARN docker info was refused; no local
3157
+ container is recorded (an aggregator): the update goes on without it`). A recorded inspect error or malformed
3158
+ container row refuses this exception: unknown custody is not a missing local container. The daemon post-commit step
3159
+ also retains an unanswered inspect as unknown, rather than skipping it as gone. A full install, and an update of a
3160
+ host with a local container recorded, still refuse there. `lanes doctor`'s `✗ write transport for <c>` says which remedy applies:
3161
+ `catalog.json names no "transport" for its board` when a board names the container, `no catalog.json board names it`
3162
+ when none does (a registry a runtime hook built from a guest's lanes: give it a board whose manifest names it, with a
3163
+ `"transport"`).
3164
+
3165
+ **The site hook.** `lanes doctor` prints a site hook that replaced `lanes_lib.build_registry` without `strict`
3166
+ (`site_hook_old()`, BEY-6912) as a `⚠` until the O-3 installed witness (W20) — never by release count; site.conf
3167
+ `LANES_SITE_HOOK=refuse` refuses it now (`✗`, exit status 1). The fix is the hook's: forward keyword arguments, or
3168
+ retire it for `guest:` boards.
3169
+
3170
+ **Conformance.** One kit drives any adapter over stdio through the protocol suite (hello, version and epochs, typed
3171
+ errors, the read allowlist, writes refused outside the registered set and over their bounds, malformed intents, exec
3172
+ by template only, no secret-looking key in any reply). Because it exists to catch an adapter that does not conform,
3173
+ it aims every refused write, refused verb, out-of-bound text and exec at an unregistered target, and asks a
3174
+ registered lane one harmless read (`has-session`); a non-conforming adapter fails the check without anything
3175
+ reaching a lane:
3176
+
3177
+ ```sh
3178
+ python3 lanes/site/conformance.py -- ssh -T -o BatchMode=yes rd-work-site
3179
+ python3 lanes/site/conformance.py -- python3 -S -E -B lanes/site/server.py
3180
+ ```
3181
+
3182
+ ## Lanes 2.0 native binaries and flags (`lanes rs`; every flag off)
3183
+
3184
+ Lanes 2.0 moves components to Rust one at a time, each behind a flag (lanes2 Round 1 H2, BEY-6988; the Lanes2
3185
+ architecture specification §7.3, §7.4, §9.3 and decision D9, and the Rust runtime specification §3.1, §3.2, which takes
3186
+ precedence). No release ships a native binary yet, nothing reads a flag yet, and every path below stays the Python
3187
+ one. Measured on the dev container only; no reference machine has run a native component.
3188
+
3189
+ **Flags.** One `site.conf` line per component (`~/.config/lanes/site.conf`, the same `LANES_<KEY>=<value>` grammar as
3190
+ the site facts), AR §7.3's components and the first-party routes:
3191
+
3192
+ | Key | Native binary | Round 1 |
3193
+ | --- | --- | --- |
3194
+ | `LANES_RS_RELAY` | `lanes-terminal` (its `relay` mode, `connection.py`'s arguments) | `on` admitted for a verified binary; read by lane C7's view hook (`view.sh` and `holders/ssh.sh`), not yet |
3195
+ | `LANES_RS_SIDEBAR` | `lanes-terminal` (its `sidebar` mode) | `on` admitted for a verified binary; read by lane C7's sidebar-wrapper hook, not yet |
3196
+ | `LANES_RS_KEY` | `lanes-terminal` (the hot keys, lane C6) | `on` admitted for a verified binary; no reader yet |
3197
+ | `LANES_RS_SIGNAL` | `lanes-hook` (the hook emitter behind `lane-signal`) | `on` admitted for a verified binary; container install is a later round |
3198
+ | `LANES_RS_MCP`, `LANES_RS_AGENTD` | none yet: no lanes crate declares one | refused `binary_absent` |
3199
+ | `LANES_RS_STATUSD`, `VISIBILITY`, `NOTIFY`, `ECONOMY`, `SYNC`, `SITE`, `STORE` | none: duties of the host coordinator, which the throttle-rc Studio Host composes | refused `host_composed`: one host owner per state root, no second daemon beside the Studio host (RT §3.2); the cutover fence (lane H3) activates them in that composition |
3200
+ | `LANES_RS_ROUTES` | none: the first-party docs and enrolment routes in Rust (RT §12.4, lanes2 Round 2 R2-ROUTES; `crates/lanes-runtime/src/http/`), a host duty the throttle-rc Studio Host composes | refused `host_composed` like the duties above; the Rust routes read only the flag files `native.routes` / `native.routes.shadow`, never this line, so `lanes-docsd` and `lanes-enrold` keep answering |
3201
+
3202
+ Values are `off` (the default, also for a missing line), `shadow` and `on`. Any other value reads as `off`, and a
3203
+ `LANES_RS_<X>` that names no component above is ignored (`LANES_RS_MCP_EXCLUDE` is a setting, not a component).
3204
+ `shadow` is refused (`shadow_unsupported`) for a component whose strangler row has no shadow step (relay, sidebar,
3205
+ key, signal).
3206
+
3207
+ **`lanes rs apply`** is the one writer of the flag files: it turns the lines into empty files,
3208
+ `~/.local/state/lanes/flags/native.<component>` for `on` and `native.<component>.shadow` for `shadow`, each only for a
3209
+ mode it admits. Otherwise it prints `! LANES_RS_<C>=<mode> refused, kept off: <reason>` with `host_composed`,
3210
+ `binary_absent` (nothing installed or shipped), `digest_mismatch` (other bytes than the recorded sha256, or a binary
3211
+ the tree ships unlisted), `not_executable`, `shadow_unsupported` or `arch_unsupported` (not x86_64), and exits 3.
3212
+ Every other `native.*` file is removed. `lanes sync` and its timer never write a flag. `lanes rs status` shows, per
3213
+ component, the `site.conf` mode, the flag file and what runs (the binary's path, or `python`). A shell reader never
3214
+ parses `site.conf`: it sources `libexec/native.sh` and tests the flag with `[ -e ]`, then takes the first binary
3215
+ candidate that exists and only if it passes the same structural test `apply` applied (never the next one).
3216
+
3217
+ **Binaries.** Both `apply` and the readers look in the same two places, in this order:
3218
+
3219
+ 1. `lanes rs install --from PATH --sha256 HEX`, for a locally built binary (development and offline). PATH must be a
3220
+ regular executable file named `lanes-terminal` or `lanes-hook`. `--sha256` is required and checked before anything
3221
+ is written; under the lock `~/.local/share/lanes/bin-rs/.lock` the copy is hashed again, placed as
3222
+ `bin-rs/<name>-<sha12>`, recorded in `bin-rs/INSTALLED.json`, and only then is the link `bin-rs/<name>` moved. It
3223
+ changes no flag and restarts nothing. Exit 0 installed, 2 usage, 3 refused (`binary_mismatch`,
3224
+ `installed_malformed`: a record it cannot read is never reset, `busy`).
3225
+ 2. The release tree. The npm payload carries `bin-rs/x86_64-unknown-linux-musl/<name>` and `bin-rs/BINARIES.json`
3226
+ (`name`, `target`, `sha256`, `size`, `commit`) inside `pkg/<version>/`, so the `current` flip that updates or rolls
3227
+ back the Python moves the binaries with it in one rename. `npm/lanes/scripts/build-payload.mjs` ships a binary
3228
+ only from `LANES_RS_ARTIFACTS=<dir>`, built from the same commit (npm/lanes/README.md, Maintainers).
3229
+
3230
+ `lanes rs verify` checks both against their records and prints a `WARN` line for an explicit install that runs
3231
+ instead of a shipped binary with other bytes (exit 0 all match or none exists, 3 a mismatch); `lanes rs verify --tree`
3232
+ checks the release tree alone.
3233
+
3234
+ **Updates.** The server installer's commit phase (`install/host-install.sh`, an update and a full install alike) runs
3235
+ `libexec/native_bin.py verify-tree` on the tree it is about to install, before `current` moves: a binary that is
3236
+ unlisted, not executable or has other bytes than its digest refuses the install (`refused`, exit 3; the installed
3237
+ release keeps running and nothing changes). Then every `native.*` flag that tree cannot serve is removed, and the
3238
+ post-commit checks the tree again as the step `verify bin-rs` (only for a tree that carries binaries). An explicit
3239
+ install is never the update's to judge. While `flags/native.statusd` exists (no verb writes it in Round 1) the
3240
+ post-commit skips statusd's restart with a warning.
3241
+
3242
+ **Rollback.** A behaviour: set the line to `off` (or delete it), run `lanes rs apply`, then `lanes reload-views` once
3243
+ a reader exists. An explicit install: `lanes rs uninstall NAME` removes the link (the placed file and its record stay)
3244
+ so the release tree's binary runs again, and removes each flag the tree cannot serve; `lanes rs status` and `lanes rs
3245
+ verify` show which binary runs. A release: `lanes update --rollback` removes, before its flip, every flag the release
3246
+ it returns to cannot serve (a flag file it cannot remove refuses the rollback). Never stop or start a unit by hand to
3247
+ switch a component: no unit is rendered from a flag in Round 1.
3248
+
2974
3249
  ## Safety rules baked into the code (do not remove)
2975
3250
 
2976
3251
  - tmux is always called with `-N` (`attach-session`, `new-session` and `start-server` on a missing socket start
@@ -3042,3 +3317,156 @@ the relevant view panes when activating a changed supervisor, never the lane.
3042
3317
  Catalog fields are additive to site schema 1. Back up the catalog and running
3043
3318
  checkout before updating the server. Restore those files to roll back; do not
3044
3319
  rebuild device sessions as a rollback shortcut. Previously added tabs remain open.
3320
+
3321
+ ## Lanes 2.0 cutover, per state domain (`libexec/cutover.py`; nothing has cut over)
3322
+
3323
+ Journal readers bind the embedded domain to the requested filename (BEY-7053): a canonical `messages` record in
3324
+ `attention.json` is `record_malformed`, including for status, admission and rollback. It cannot authorize a change to
3325
+ another domain. The Python writer, like Rust `write_all`, completes every byte before fsync and rename; a short write
3326
+ continues, and zero progress refuses as `record_unwritable`, removes the temporary and preserves the previous record.
3327
+ `test_cutover.OldBinary` covers the real-file CLI boundary, short writes and stopped writes. These source repairs do
3328
+ not activate a cutover.
3329
+
3330
+ Plan row H3 (lanes2 Round 1, BEY-6988; the Rust runtime specification §17.1, §16.1 and §16.2; witness QI-15;
3331
+ DM-LANES2-CUTOVER-RECORD, DM-LANES2-CUTOVER-INTAKE). The Rust candidate takes each state domain (attention, receipts,
3332
+ …) from the Python host one at a time, at a recorded epoch, and only through a fence: quiesce the old owner (no new
3333
+ admission, no new effect), drain or reconcile what is in flight, have it seal, import the final cut from where the
3334
+ preparatory snapshot stopped (the mandatory catch-up: work accepted during the snapshot is not lost), then commit the
3335
+ new epoch only when the old owner refuses a probe effect and the verified cut is durable in the candidate's store
3336
+ through the seal, and activate only when every legacy endpoint a live producer may use is kept or forwarded. An effect
3337
+ that was in flight at the cut stays an unknown outcome and is reconciled, never replayed. Today this is source and
3338
+ tests only (`crates/lanes-runtime/src/cutover/**` and this script): no domain has moved, no flag is on and the Python
3339
+ host owns everything. Since lanes2 Round 2 S12 an adopted host holds each domain's initial record (`shadow`, epoch 1,
3340
+ owner `lanes-py`), the one the fence would create on its first open (next section). Measured on the dev container only.
3341
+
3342
+ **One journal of record.** `$LANES_STATE/cutover/<domain>.json` (`lanes.cutover/1`, one canonical JSON line) is the only
3343
+ place ownership is decided: the Rust fence and this script read it and compare-and-swap it under the same flock on
3344
+ `<domain>.lock`. Never edit it by hand and never delete it to recover.
3345
+
3346
+ **Where a domain stands.** `python3 libexec/cutover.py status [DOMAIN…] [--json]`. `check DOMAIN --holder H --schema N
3347
+ [--admit] [--legacy L]` answers for one binary: exit 0 (`ok`, or `no_cutover` when there is no record and H is the
3348
+ legacy owner L, default `lanes-py`), exit 3 with `schema_ahead` (this binary cannot read the domain's active schema — it
3349
+ refuses whoever the record names), `owned_elsewhere` (also: no record and H is not the legacy owner), `fenced` (with
3350
+ `--admit`, between the fence and activation) or `record_malformed` (a record that cannot be read is never treated as
3351
+ absent).
3352
+
3353
+ **A cutover that stopped half-way.** A domain left in `quiesced`, `drained` or `cut_verified` (the candidate crashed, or
3354
+ its final cut is refused every time, for example `cut_provenance_changed` after the old host restarted) admits nothing
3355
+ anywhere until the fence is aborted: `cutover.py rollback DOMAIN --to <the recorded owner> --schema N` writes
3356
+ `rolled_back` at the next epoch with the seal lifted, and the old owner resumes; the candidate never owned anything, and
3357
+ its next step loses the compare-and-swap. Start a new cutover from a fresh snapshot afterwards. `rollback_not_owner`:
3358
+ `--to` must name the recorded (fenced) owner.
3359
+
3360
+ **Rollback of an active domain.** Once the epoch is committed (`epoch_committed`, `active`) the candidate may have
3361
+ accepted and executed work, so a record write never takes the domain back: `cutover.py rollback` refuses
3362
+ (`rollback_needs_fence`, exit 3, nothing written). The rollback is the reverse fence in the Rust runtime
3363
+ (`rollback_plan` with the newest release that reads the active schema, then `DomainFence`): it quiesces, drains and
3364
+ seals the candidate and makes its final cut, unknown outcomes kept, durable in the target's store before the target owns
3365
+ anything (`stale_snapshot` if the store holds less), so nothing accepted is lost and nothing performed is performed
3366
+ again. A release that cannot read the active schema refuses (`no_compatible_runtime`). The lanes and their agents keep
3367
+ running throughout; nothing restarts a native session.
3368
+
3369
+ **Legacy producers.** A lane started before the cutover keeps the hook configuration it started with. A legacy spool
3370
+ endpoint with a live producer is forwarded; a socket or state file is kept and served in place (the forwarder never
3371
+ reads or deletes it); a producer whose endpoint is missing from the inventory refuses the plan
3372
+ (`endpoint_live_not_planned`). `cutover.py forward SPOOL INTAKE --endpoint ID` links each committed envelope into
3373
+ `INTAKE/ID/` without replacing anything, then releases it. Exit 1 on any `conflict`, `refused:*` or `release_failed:*`
3374
+ (each stays in the spool for inspection; a failed release is retried on the next pass as a `duplicate`); a link, fifo or
3375
+ other special file is reported `skipped:not_regular` and does not fail the pass. It runs on every pass while the rollback
3376
+ window is open, not once. `cutover.py retire ENDPOINT --census FILE` retires an endpoint only when no live generation or
3377
+ installed hook configuration in the census names it; an empty endpoint directory proves nothing (a publisher can be
3378
+ paused just before its commit).
3379
+
3380
+ ## Lanes 2.0 runtime signals in `lanes doctor` (`libexec/doctor_lanes2.py`; no host exports them yet)
3381
+
3382
+ Plan slice R2-DOCTOR (lanes2 Round 2, BEY-6988; the Rust runtime specification §16.3, the Lanes–Throttle integration
3383
+ contract §11; DM-LANES2-RT16-SIGNALS). A Lanes 2.0 host keeps one bounded metrics registry
3384
+ (`crates/lanes-runtime/src/signals/`) over every Round-1/2 subsystem: the dispatch loop (RT 14.1 ready-to-dispatch
3385
+ queue ages, outbound waits apart from time behind a peer that does not read, endpoint blockage, age breaches, input
3386
+ stalls, replay gaps, undeliverable answers), permits (live workers apart from waiting callers, refusals, retained
3387
+ bytes, helpers, survivors, unsettled effects), admission refusals, group bytes and the peak resync allocation, the
3388
+ store (mailbox, its own quota, the essential room left, WAL, checkpoints, storage faults, busy groups, the outbox and
3389
+ its oldest entry, the slowest durable acceptance), ingress pressure and fairness, fallback spool collection, hook
3390
+ health records, delivery receipts, effect phases and recovery, the lane sequencer (partial navigation versus uncertain
3391
+ submission, final-check refusals, fences), cutover phases, capacity freshness, protocol negotiation, projection
3392
+ streams and resyncs, directory and inventory freshness, holder reconnects, the host process's RSS, threads and
3393
+ descriptors, adapter subprocess launches and client frame times. The signal set, each signal's kind, unit, closed
3394
+ label set, delay origin, threshold rule and declared unavailable reasons are
3395
+ `docs/contracts/lanes2/manifests/signals.json`; the host resolves the thresholds from its own resource manifest
3396
+ (`resources.<profile>.json`, the G2 admission limits, group peaks and RSS envelope), `benchmark.json` (RT 14.1 maxima,
3397
+ RT 15.3 budgets and frame budgets) and, for the store's quota, the store's own configuration, and exports
3398
+ `$LANES_STATE/signals/lanes2.json` (`lanes2.signals.snapshot/2`) change-only, rewritten at least every 10 s.
3399
+
3400
+ **What doctor prints.** Nothing until that file exists: no host composes the registry before integration gate I1, so
3401
+ today's `lanes doctor` output is unchanged. Once a host exports it, doctor adds after the release checks: a header (the
3402
+ host instance, lanes-runtime version, source revision, installed version, profile and manifest revisions), `✓ lanes2
3403
+ signals snapshot fresh` (or `✗` when it is older than 30 s: the host stopped exporting and the values shown are its
3404
+ last), one `delay origin:` line naming, for each RT 16.3 origin (client rendering, Lanes queueing, storage, holder,
3405
+ network, native harness), its state and the signals that put it there, one `facets:` line (resources, custody, owner
3406
+ sources), then exactly one line per signal: `✗` past an alert bound (doctor exits 1), `⚠` past a warning bound or for
3407
+ a signal the host did not sample, an information line otherwise. A counter shows its total and its increase in the
3408
+ window (`lifecycle 2, +0`), and its bound applies to the increase: a fault that has stopped repeating stops warning in
3409
+ the next window. An origin reads `incomplete` when one of its signals is unobserved (for instance client rendering
3410
+ while no terminal client reports frame times, or Lanes queueing while connections are live, because a running
3411
+ connection's queue ages are not observable until it ends), never `ok`. A signal without a value reads
3412
+ `unavailable (<reason>)`, never zero: `capacity.*` without a capacity source (`owner_contract_inactive`), `client.*`
3413
+ while no client reports frames (`no_client_frame_report`), an empty window (`no_samples`), a refused store read
3414
+ (`store_reader_refused`, with `store.reader_refused` as a warning), and measurements no owner takes yet
3415
+ (`no_input_timing`, `no_ingress_timing`, `no_hook_exit_report`, `no_lock_timing`, `no_open_index_counter`). A snapshot
3416
+ that cannot be read or lacks a field is one `✗ lanes2 signals snapshot readable` line, and doctor goes on to its later
3417
+ checks. No lane, operation or prompt identity and no terminal content is ever in the file.
3418
+
3419
+ **Reading it by hand.** `python3 libexec/doctor_lanes2.py [--snapshot PATH] [--now-ms MS]` prints the same lines (exit 1
3420
+ when one is `✗`, 0 with no snapshot). The file is self-describing (every signal carries its doctor phrase, unit, kind,
3421
+ origin, state and reason, every label its value, increase and resolved bounds), so a reader needs no manifest; a
3422
+ Throttle monitor tab on the same host may read it, but none does yet, and a reader on another host has no transport to
3423
+ it.
3424
+
3425
+ ## Lanes 2.0 adoption (`libexec/adopt.py`; `lanes update` carries it; every flag off)
3426
+
3427
+ Plan row S12 (lanes2 Round 2, BEY-6988; the Rust runtime specification §17.1, the adoption half; P32;
3428
+ DM-LANES2-S12-ADOPTION). An existing 1.x server adopts the Lanes 2.0 state layout without a manual step: the last
3429
+ post-commit step of every `lanes update` (`adopt lanes2`, from the tree it installed) runs `python3 libexec/adopt.py
3430
+ adopt --state <state> --tree <tree>`. For each of the fourteen state domains (owner-epochs, bindings, receipts,
3431
+ attention, effects, inbox-outbox, projects, schedules, connectors, projections, preferences, builds, notify, drafts) it
3432
+ writes the domain's initial cutover record where none exists: `shadow`, epoch 1, owner `lanes-py`, schema 1, exactly
3433
+ the record the Rust fence creates on its first open. A record that exists is never touched (a cutover in progress, a
3434
+ domain the Rust host took). It creates `$LANES_STATE/store/` (0700) and never the store file (the host coordinator's
3435
+ store owner creates and migrates `coordination.sqlite` on its first open), then writes `$LANES_STATE/lanes2/adoption.json`
3436
+ listing every domain whose record it read back from disk; a domain it could not adopt is listed under `refused` with its
3437
+ code and never reported adopted.
3438
+
3439
+ What it never does: write `flags/native.*` or site.conf's `LANES_RS_*` (lane H2; every component stays off), import
3440
+ legacy data (a domain's records move only through its cutover fence), start a unit or run a Rust binary. A Rust host
3441
+ that recovers serves per domain: it checks the record of every domain it serves and writes, or dispatches, only in the
3442
+ domains whose record names it as the admitting owner; a write to a table of any other domain is refused before the
3443
+ store sees it. While every record names `lanes-py`, it comes up fenced and read-only (`owned_elsewhere`).
3444
+
3445
+ **Check it.** `lanes doctor` prints, after the update line, one information line (when, which release, the store, the
3446
+ flags) and one line per domain: `✓` adopted (phase, owner, epoch, where the 1.x owner keeps it), `⚠` not adopted
3447
+ (the refusal's code, or a domain a newer release added: the next update adopts it), `⚠` fenced in `quiesced` …
3448
+ `epoch_committed` (see the cutover section above), `✗` listed as adopted but its record is missing or unreadable
3449
+ (the next update adopts it again). Nothing is printed before the first adoption. `python3 libexec/adopt.py status
3450
+ [--json]` exits 0 only when every domain is adopted and its record verifies.
3451
+
3452
+ **The update step.** Exit 3 (a domain refused, for example a malformed record) and 4 (an I/O failure) are warnings in
3453
+ `update/last.json`, never a `partial` update; `lanes doctor` names the domain. Any other exit is a failure (`partial`),
3454
+ 1 included: the adopter never exits 1 itself, so 1 is Python's own status for a crash (a broken tree, a failed import),
3455
+ and a crash is never recorded as a warning. A damaged `lanes2/adoption.json` (a field of the wrong type) is one `✗` line
3456
+ in `lanes doctor`, never a doctor crash. Run it by hand with the same command; it is idempotent and rewrites nothing
3457
+ that is already in place. A rollback to a tree without `libexec/adopt.py` runs no
3458
+ such step and leaves the records as they are (a `shadow` record owned by `lanes-py` is what no record means).
3459
+
3460
+
3461
+ **Malformed adoption metadata (BEY-7110).** Doctor and status validate the receipt's v1 version, field types, UTF-8
3462
+ encodability of consumed strings and unique domain/refusal lists before using them. Reads are bounded to 64 KiB plus
3463
+ one overflow byte. A malformed,
3464
+ oversized or deeply nested receipt produces one `✗` diagnostic (status exits 3); it cannot suppress the rest of doctor
3465
+ with a type or Unicode encoding error. The next ordinary update rewrites the adoption receipt while preserving
3466
+ existing cutover records.
3467
+
3468
+ **Unwired Rust recovery boundaries (BEY-7111/BEY-7112).** A retained draft can be discarded and retained again with
3469
+ identical text; each new transition binds the observed workspace revision, while a lost reply retries its original
3470
+ key. Draft rows never enqueue a message. Notification routing sends only from a newly committed claim: a replayed or
3471
+ uncertain claim stays held as `sending`/unknown and is never permission to send again. This also applies to overlapping
3472
+ quiet-hours summaries. These modules remain unwired; the installed Python notification service is unchanged.