@vibelord/lanes 1.6.1 → 1.7.1

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.
@@ -380,12 +380,29 @@ lanes studio-host re-key --yes after the owner revoked the Host: a new mac
380
380
 
381
381
  - **A desktop stops accepting keys while SSH stays connected:** reconnect that window's display first (close and
382
382
  reopen the Lanes window, or terminate only its verified SSH display child so `lanes-launch` retries). Do not
383
- restart holders or containers. `lanes attach` now supervises its Zellij client with `libexec/attach.py`: output
384
- waiting to reach the terminal is limited to 1 MiB and an oldest pending chunk age of 5 s. Either bound ends only
385
- that client (TERM, then KILL after 1 s if needed), exits 1, and lets `lanes-launch` reconnect to the existing view.
386
- Idle terminals have no deadline; input, resizing and normal exit codes pass through. A client that cannot drain
387
- its terminal cannot be rescued by SSH keepalives alone (DEF-1965). This guard covers desktop SSH attachments;
388
- Zellij's browser transport does not use it. Already attached desktops pick it up on their next attachment.
383
+ restart holders or containers. `lanes attach` supervises its Zellij client with `libexec/attach.py`, which never
384
+ stops reading the client, so Zellij's 5,000-message queue for it never fills (DEF-1965). Two rules bound the output
385
+ waiting for the terminal:
386
+ - **Shed and repaint (a slow terminal).** When more than 1 MiB (`LANES_DISPLAY_BACKLOG_BYTES`) would be waiting,
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
389
+ terminal, the supervisor asks Zellij for a full repaint: the client's size goes to one row less and, 0.1 s later,
390
+ 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
+ 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.
392
+ The first fall-behind of a session prints `lanes: the display fell behind; dropping stale frames and repainting`,
393
+ and the end of the session sums up the count and the dropped size. Nothing reconnects (BEY-6844).
394
+ - **Stall (a hung terminal).** A terminal that accepts no byte at all for 5 s (`LANES_DISPLAY_STALL_S`) while output
395
+ waits ends only that client (TERM, then KILL after 1 s if needed); the supervisor prints `lanes: display output
396
+ stalled; reconnecting the display.`, exits 1, and `lanes-launch` reconnects to the existing view (BEY-6844: progress,
397
+ not the age of the oldest output, decides).
398
+
399
+ A terminal that keeps taking bytes, however slowly, is never ended. Idle terminals have no deadline; input, resizing
400
+ and normal exit codes pass through. Both limits are read from the environment `lanes attach` runs in (the SSH
401
+ session's, e.g. an sshd `SetEnv` line); a value outside 131072–268435456 bytes or 1–600 s is refused with one line
402
+ and the default kept. Through 1.6.1 the guard also ended a slow but healthy display (over 1 MiB waiting, or a chunk
403
+ waiting 5 s), and each reconnect's repaint refilled it: a window that loops on `display output exceeded its backlog
404
+ limit` runs a server older than this fix. This guard covers desktop SSH attachments; Zellij's browser transport
405
+ does not use it. Already attached desktops pick it up on their next attachment.
389
406
  - **A view's layout looks wrong:** `lanes rebuild mac`. Views are disposable; agents are untouched; the client
390
407
  reconnects. Rebuilding also ends that view's Host tab shell, so prefer a display reconnect for a frozen client.
391
408
  - **A lane was added/renamed/removed in a repo's `.vscode/terminals.json`:** nothing to do. `lanes-sync.timer`
@@ -927,11 +944,12 @@ only normalizes HOW a terminal reaches its lane:
927
944
  tmux lane gets `LANE_ID`/the trace: `lane open` deliberately exports none (DEF-1559 — the first client on a shared
928
945
  board socket would otherwise hand its identity to every later lane there). Both change the file only: a RUNNING
929
946
  lane keeps its environment and gains the identity when it is next created. Before enabling it on a live board,
930
- read DEF-1560: a `lanes/<ws>/<id>` trace makes the whole lane — main session, subagents, fan-out — one proxy
931
- fairness bucket. Applying `--canonicalize --write` or `--identity --write` to a live workspace is an operator gate
947
+ read DEF-1560 (BEY-6299): a Throttle without that fix (source 2026-10-25, unpublished) makes the whole lane — main session,
948
+ subagents, fan-out — one proxy fairness bucket; with it each session/subagent is its own. Applying
949
+ `--canonicalize --write` or `--identity --write` to a live workspace is an operator gate
932
950
  (plan "Operator gates"): it rewrites operator-declared recipes in the repo's `.vscode/terminals.json` (old value kept
933
- as `createPrevious`, file backup under `cursor-sync-backups/<ts>/` as above) and produces the first live `lanes/<ws>/<id>` trace — decide DEF-1560 lane-level
934
- vs per-session fairness first.
951
+ as `createPrevious`, file backup under `cursor-sync-backups/<ts>/` as above) and produces the first live `lanes/<ws>/<id>` trace — DEF-1560 chose per-session
952
+ fairness; confirm the Throttle the lanes route through carries it first.
935
953
  - Size policy "the lanes view wins": lanes-view tmux clients run with `TERM=xterm-lanesview` (a user-level terminfo
936
954
  alias of xterm-256color). While such a client shows a lane, every other client of that lane (Cursor terminals,
937
955
  ad-hoc attaches) is in tmux `ignore-size`; `lanes-statusd` reconciles every few seconds and gives editors the size
@@ -1413,7 +1431,8 @@ host changes: `lanes sync` and `lanes-statusd` keep writing `~/.lz/registry.json
1413
1431
 
1414
1432
  ### What an agent can change through it
1415
1433
 
1416
- Six of lane-mcp's tools write (LNS-35; the user guide's "Agent tools (MCP)" lists them with their refusals). What
1434
+ Nine of lane-mcp's tools write (six of LNS-35, `lanes_publish` of W10 W4, `lanes_message` and `lanes_message_ack` of
1435
+ W15 L4; the user guide's "Agent tools (MCP)" lists them with their refusals). What
1417
1436
  lands where, and how to take it back:
1418
1437
 
1419
1438
  - `lanes_register`, `lanes_unregister`, `lanes_rename` and `lanes_new` edit a repository's `.vscode/terminals.json`
@@ -1440,6 +1459,10 @@ lands where, and how to take it back:
1440
1459
  `~/.lz/state/publish/<lane id>/<id>.json`, naming a file under `/home/coder`; the docs service takes it within
1441
1460
  about 5 s and answers in `<id>.receipt.json` beside it ("Docs service", "Publish pick-up"). `lanes_status` shows the
1442
1461
  newest receipt as `published`. The file is read by the host, never sent by the agent.
1462
+ - `lanes_message` (and `lane message` in a lane's shell) writes a message into the recipient lane's inbox,
1463
+ `~/.lz/state/inbox/<lane id>/<id>.json` with its receipt `<id>.receipt.json`, and types it, queues it with Codex or
1464
+ Throttle, or leaves it waiting ("Messages: inboxes, receipts and the log" below); `lanes_message_ack` takes the text
1465
+ out of a message of the agent's own inbox.
1443
1466
  - Nothing an agent does ends, interrupts or attaches a lane, uploads a file, runs `lanes sync`, `lanes gc` or
1444
1467
  `lanes ensure`, renames a tmux session, or touches a session added with `lanes register` (`registered-sessions.json`
1445
1468
  on the host).
@@ -1461,6 +1484,9 @@ lands where, and how to take it back:
1461
1484
  | A write answers `not_in_container` | The lane belongs to another container. Each container's `lane-mcp` sees only its own lanes | Ask a person, or the agent in that container |
1462
1485
  | A write answered success but the boards do not show it after 15 s | `lanes sync` refused the board (`lanes doctor` shows board errors), or the edited file is not one the registry names, which hot sync does not watch | `lanes doctor` on the host; the 2-minute `lanes-sync.timer` retries. `git diff` the terminals.json in the container to see the edit |
1463
1486
  | `lanes_send` answered `tmux_failed` with `changed` | The text was typed but its Enter failed: it waits at the target's prompt | A person presses Enter in that lane, or clears the line |
1487
+ | `lanes_message` answers `recipient_busy` | The lane's agent is working, delegating or waiting for an approval, its pane shows output, older messages wait in its inbox (they are typed first), another writer held its dispatch lock for 5 s, or no adapter reaches it from here (a named Claude session from a non-Claude sender, a Codex thread without `codex` on PATH) | Pass `queue: true`: it waits in the lane's inbox and `lanes-statusd` types it when the lane is next idle with no terminal attached ("Messages: inboxes, receipts and the log") |
1488
+ | `lanes_message` answers `delivered_by: unknown` | An adapter may have taken it and its answer never came: `codex queue` timed out or exited non-zero, or Throttle's answer was lost after the request went out (`not_confirmed` says which) | Do not send it again. Check the recipient (`lanes_capture`, Codex's thread): if it arrived, the recipient acknowledges it; if it did not, a person runs `~/.lz/bin/lane inbox retry <id> --duplicate-risk --lane <lane id>` — it may then arrive twice |
1489
+ | `lanes_message` answers `handle_ambiguous` or `handle_unavailable` for a Codex lane | Its hooks recorded no thread and its app-server names several threads at the lane's folder, or cannot be asked | Pass `queue: true`; on the host, `lanes hooks install --agent codex --container <name> --write` lets the lane's hooks record its thread |
1464
1490
  | Agents keep being refused | `grep refused= ~/.lz/s/logs/lane-mcp.log` lists every refusal with its code | Each refusal's `human` says what a person does instead |
1465
1491
 
1466
1492
  ### Protocol smoke
@@ -1475,12 +1501,106 @@ printf '%s\n' \
1475
1501
  ```
1476
1502
 
1477
1503
  It prints two frames, one line each, exit 0 and nothing on stderr. Frame `id` 1 carries `protocolVersion`
1478
- `2025-06-18` and `serverInfo` `{"name": "lanes", "version": <~/.lz/VERSION>}`. Frame `id` 2 lists the eleven tools in
1479
- wire order (`lanes_publish`, W10 W4, last), the same tools `lanes/tests/unit/golden/lane-mcp-tools.json` pins. The list is deterministic: run the
1504
+ `2025-06-18` and `serverInfo` `{"name": "lanes", "version": <~/.lz/VERSION>}`. Frame `id` 2 lists the thirteen tools in
1505
+ wire order (`lanes_publish`, W10 W4, then `lanes_message` and `lanes_message_ack`, W15 L4, last), the same tools
1506
+ `lanes/tests/unit/golden/lane-mcp-tools.json` pins. The list is deterministic: run the
1480
1507
  command twice through `sha256sum` and the two digests match. The log gains a `start lane-mcp <version> wire 1` line.
1481
1508
  No output at all means the server could not start, for example because `lane_core.py` is missing beside it; run
1482
1509
  `lanes install-container <container>` on the host. `test_docs.AgentApi` runs this block exactly as printed here.
1483
1510
 
1511
+ ## Messages: inboxes, receipts and the log (W15 L4)
1512
+
1513
+ One message from a lane, or from a person on the server, to one lane (plan
1514
+ `docs/superpowers/plans/2026-10-25-lanes-messaging-bus.md` L4, Linear BEY-6842; ARCHITECTURE "Agent API" has the adapters in their
1515
+ order). Everything lives in the recipient's container, under the container user's `~/.lz/state/inbox/`:
1516
+
1517
+ | Path | What | Written by |
1518
+ | --- | --- | --- |
1519
+ | `<lane id>/<id>.json` (0600; directories 0700) | the message, DM-LANES-MESSAGE `{v, id, from, from_handle, to, at, text, ttl_s}` (+ `origin`, `attempt` `{op, adapter, at, outcome, recipient}` when `codex queue` or the Throttle bus was asked, `retry` after a person's retry) — `text` removed once the recipient acknowledges it (`acked` added) or its ttl passes | `lane_core.message` (`lanes_message`, `lane message`), `lanes message` on the server |
1520
+ | `<lane id>/<id>.receipt.json` (0600) | DM-LANES-MESSAGE-RECEIPT `{v, id, to, delivered_by, expected_within_s, at}` (+ `cleared` once the record holds no text): `peer_socket`, `codex_queue`, `throttle_turn`, `typed`, `queued` (waiting), `inbox` (the recipient took it itself), `expired`, `unknown` (held: an adapter may have taken it) | the sender; `lanes-statusd` when it types a waiting message or its ttl passes; the ack; `lane inbox retry` |
1521
+ | `../dispatch/<lane id>.lock` (0600; `~/.lz/state/dispatch/` 0700) | DM-LANES-DISPATCH-LOCK: the lane's one native-input authority — an exclusive `flock`, never any content | taken (never written) by every writer of the lane's pane: `lane message`, `lanes_message`, `lane-peerd`, `lanes_send`, `lane send`, and `lanes-statusd` through `/proc/<init>/root` |
1522
+ | `log` (+ `log.1` past 1 MiB, 0600) | DM-LANES-MESSAGE-LOG, one line per outcome: `<at> <from> <to> <id> <bytes> <outcome>` (`refused:<code>` with id `-` for a refusal) — never a text | everything above |
1523
+
1524
+ Reading them, in the container as the lane user: `~/.lz/bin/lane inbox [--json]` (this lane's messages, the text
1525
+ until acknowledged: every message not yet settled, and the newest 512 settled ones), `~/.lz/bin/lane inbox ack <id>`,
1526
+ `tail ~/.lz/state/inbox/log`. A held message (receipt `unknown`) is never sent again by Lanes: no other adapter, no
1527
+ drain, after any restart. A person who checked that it did not arrive hands it back with `~/.lz/bin/lane inbox retry
1528
+ <id> --duplicate-risk [--lane <lane id>]` (receipt `queued`, the record's `retry`, log `retried`): it is typed when
1529
+ the lane is next idle — and may arrive twice if it had arrived after all. Without `--duplicate-risk` the verb refuses
1530
+ (`duplicate_risk`); a message that is not held, has lost its text or is past its ttl is `not_held`. Who holds a
1531
+ lane's dispatch lock: `fuser -v ~/.lz/state/dispatch/<lane id>.lock` in the container; a writer waits at most 5 s and
1532
+ then refuses `recipient_busy` (or queues), so a stuck holder only delays typing into that one lane. From the server: `lanes message
1533
+ <lane-id|@address> "<text>"` sends a person's message (`--from <login>`; `host:<the account>` without it) — written
1534
+ through the container's home volume, typed at once when the lane is idle at its prompt, else left waiting; the
1535
+ sidebar's `m` runs it. `lanes-statusd` publishes `inbox: {pending}` on each lane row (the sidebar's `✉`), types at
1536
+ most two waiting messages per pass between cycles — only on an `ok` host, only into a lane observed quiet and idle with
1537
+ no terminal attached (a Claude lane only while its own session file says `idle`; a shell only at its prompt, as a
1538
+ `# …` comment line), each message at most once a minute — and takes the text out of messages whose ttl passed. Its
1539
+ journal says the lane, the id and the outcome: `journalctl --user -u lanes-statusd | grep ' inbox '`.
1540
+
1541
+ The switch: the Throttle bus adapter is off unless the sending lane's environment has `LANES_BUS=throttle`. It then
1542
+ posts `{to, from, text, ttl_s}` (`from` the sender's lane trace) to Throttle's CONTROL listener,
1543
+ `http://127.0.0.1:$LANES_THROTTLE_CONTROL_PORT/v1/lanes/messages` (19181 when unset, the port throttle-pulse asks;
1544
+ never `ANTHROPIC_BASE_URL`, the data plane, which answers `404 lane_bus_control_only`), with the SENDING harness's
1545
+ own client token as the bearer — `throttle client-token <pool>` for its pool (claude, codex, kimi, muse-code, zai;
1546
+ Grok lanes have none), run in an allow-listed environment, sent to that URL only and never shown (BEY-6869). Throttle's
1547
+ bus ships with the Throttle lane's release: leave it off until then; with it on and no endpoint, a message answers
1548
+ `bus_unavailable` (or waits, with `queue`). A request whose answer was lost after it went out is `unknown`, never
1549
+ re-sent.
1550
+ Undo: none needed — deleting `~/.lz/state/inbox/` loses the waiting messages and the receipts, nothing else; a
1551
+ message already typed or queued with Codex stays where it went.
1552
+
1553
+ ## Claude peers
1554
+
1555
+ (W15 L6, Linear BEY-6843; plan `docs/superpowers/plans/2026-10-25-lanes-messaging-bus.md` L6/D3.) Every lane whose
1556
+ agent is not Claude is a Claude peer: `lane-peerd`, one loop per workspace container, registers it so a Claude session's
1557
+ `ListAgents` lists it and its `SendMessage` reaches it, and the `peer_socket` adapter of `lane_core.message` lets any
1558
+ other sender write into a Claude session's own messaging socket. ARCHITECTURE "Agent API" has the delivery order.
1559
+
1560
+ | Path (in the container) | What | Written by |
1561
+ | --- | --- | --- |
1562
+ | `~/.lz/bin/lane-peerd` | the daemon (Python stdlib, ships with the contract) | `lanes install-container` |
1563
+ | `~/.lz/state/peers/` (0700) | `<lane>.sock` (0600; `x-<hash>.sock` when the path would not fit a socket address), `lock`, `peers.json` | `lane-peerd` |
1564
+ | `~/.lz/state/peers/peers.json` | DM-LANES-PEER's state: `{v, at, pid, pin, peers: {<lane>: {name, socket, pid, session, harness, status, tmux}}, blocked: {<lane>: why}, frames}`, renewed at least every 30 s | `lane-peerd` |
1565
+ | `~/.claude/sessions/<pid>.json` | the virtual peer's entry: the keys of a real Claude Code 2.1.310 entry, `pid` the lane's agent process (a shell lane: its pane's process), `name` its address, `messagingSocketPath` its socket | `lane-peerd` (only its own: a file whose socket is elsewhere is never touched) |
1566
+
1567
+ **Running.** `lanes-statusd` starts the loop where `~/.lz/bin/lane-peerd` is installed and `peers.json` is older
1568
+ than 90 s or absent — `docker exec -d -u 1000 -e HOME=/home/coder <container> tmux -L lanes-peers new -d -s peerd
1569
+ ~/.lz/bin/lane-peerd --loop`, at most once per 10 min per container, two containers per pass, never on a critical
1570
+ host — and journals it: `journalctl --user -u lanes-statusd | grep 'lane peerd'`. Its own journal (lane ids, message
1571
+ ids, codes and adapters; never a text) is its tmux pane: `docker exec -u 1000 <container> tmux -L lanes-peers
1572
+ capture-pane -p -t peerd`. A look without serving: `~/.lz/bin/lane-peerd --once` in the container prints the document
1573
+ one cycle would stand on and removes what it registered again (it refuses while a loop holds the lock). Turning it
1574
+ which lanes: `LANES_PEERS=agents` (the default: Codex, Kimi, Grok, Muse and ZCode lanes) or `LANES_PEERS=all` (plain
1575
+ shells and empty lanes too — about 160 more rows in every Claude session's `ListAgents` on a workspace like rd-work);
1576
+ which lanes: `LANES_PEERS=agents` (the default: Codex, Kimi, Grok, Muse and ZCode lanes) or `LANES_PEERS=all` (plain
1577
+ shells and empty lanes too — about 160 more rows in every Claude session's `ListAgents` on a workspace like rd-work);
1578
+ off: `LANES_PEERS=0` in site.conf (statusd then never starts it), then stop the running loop — `docker exec -u 1000
1579
+ <container> tmux -L lanes-peers kill-server`; SIGHUP/SIGTERM remove every entry and socket it made. Undo: none
1580
+ needed beyond that — deleting `~/.lz/state/peers/` while no loop runs is safe; the next loop sweeps any entry an
1581
+ earlier one left.
1582
+
1583
+ **The pin.** `lane_core.PEER_PIN` (`{"claude": "2.1.310", "peerProtocol": 1}`, the same as
1584
+ `lanes/tests/unit/fixtures/peer/pin.json`) is what Lanes measured on 2026-10-25 (plan "Measured 2026-10-25 — M9 and
1585
+ M10"): a line written to a real session whose session file names a newer Claude Code or another `peerProtocol` is
1586
+ refused `peer_pin_failed` and the next adapter serves (the inbox, with `queue`). Virtual peers carry the pin's version
1587
+ and protocol and claim no `peerFeatures`: `notify_idle` (a sender's idle subscription) is not honoured — its frame is
1588
+ unmeasured. Frames that are not protocol-1 `user` lines (another `msgV`, a `control` frame) are ignored and counted
1589
+ in `peers.json` `frames.ignored`.
1590
+
1591
+ **Re-measuring after a Claude Code update** (the operator's call; the measurement reads the real `~/.claude/sessions`
1592
+ and never writes a socket or a session file):
1593
+
1594
+ ```sh
1595
+ LANES_MEASURE_CLAUDE_PEER=1 python3 -m unittest discover -s lanes/tests/unit -p test_claude_peer_contract.py -v
1596
+ ```
1597
+
1598
+ It compares the entry `lane-peerd` writes with the live session files here and the installed `claude --version` with
1599
+ the pin. When it fails, repeat M9 and M10 by hand with a disposable peer (a `sleep` pid, a socket under `/tmp`, a
1600
+ session entry for it, one `SendMessage` from a Claude session you own, and one line from a plain client to that
1601
+ session's socket — the plan's measured section has the steps and what to record), save the frames redacted of socket
1602
+ paths under `lanes/tests/unit/fixtures/peer/`, and only then raise `PEER_PIN` and `pin.json` together.
1603
+
1484
1604
  ## Economy projection (opt-in)
1485
1605
 
1486
1606
  `~/.local/state/lanes/economy.json` is what each lane costs and how hard the fleet is pushing the Throttle pool:
@@ -2681,6 +2801,168 @@ result here:
2681
2801
  every other client, not against a process on this host. If another account or a host-network container exists,
2682
2802
  weigh `lanes enrol mode invite` (which also stops the Docs page) against it.
2683
2803
 
2804
+ ## Addresses, coordinators and name parity (W15)
2805
+
2806
+ Every lane has one registered messaging **address** (plan `docs/superpowers/plans/2026-10-25-lanes-messaging-bus.md`
2807
+ L2–L2d): `<board>.<slug>`, its lane id with the board separator `--` turned into a dot (`worlds--worlds-packages` →
2808
+ `worlds.worlds-packages`; an adopted `<board>--x-…` session → `<board>.x-…`). The lane id never changes. Claude Code
2809
+ 2.1.310 keeps such a name and refuses one holding `--` (MEASURED 2026-10-25: `/rename worlds--worlds-packages` fell back
2810
+ to an auto-generated name), so the address is also the name a Claude lane's session should carry: `ListAgents` and
2811
+ `SendMessage` then show Lanes addresses only.
2812
+
2813
+ Where it is configured (all on the server; unknown keys stay tolerated, site schema 1 is unchanged):
2814
+
2815
+ | Setting | File | Written by |
2816
+ | --- | --- | --- |
2817
+ | `addresses: {<terminal name>: "<board>.<alias>"}` — an address other than the derived one (alias: `a-z 0-9 . _ -`, no `--`); the terminal name carries its repository prefix | `workspaces.<board>.json` | `lanes address set` |
2818
+ | `coordinator: "<terminal name>"` — the board's coordinator (`@<board>` reaches it; only it may message the fleet admin) | `workspaces.<board>.json` | `lanes address set-coordinator`, `lanes migrate addresses` |
2819
+ | `LANES_FLEET_ADMIN=@<address>` — the fleet admin lane | `~/.config/lanes/site.conf` | `lanes migrate addresses` (only when unset) |
2820
+ | `LANES_NAMES_AUTO=0` — statusd stops renaming Claude sessions to their addresses (default on) | `~/.config/lanes/site.conf` | by hand |
2821
+
2822
+ `lanes sync` checks them: an address outside the grammar, one address given to two terminals of a board, or a
2823
+ `coordinator` that names no terminal of its board is a board error (that board keeps its previous lanes, `!` in the
2824
+ sync table, exit 1); two lanes anywhere on the site answering to one address refuse the whole sync, naming both lanes
2825
+ (the previous registry stays published). `lanes rename` changes only the display name, never the address.
2826
+
2827
+ What it publishes: each registry lane carries `address` and `role` (`coordinator`, `fleet-admin` — a coordinator that
2828
+ is also the fleet admin is `fleet-admin` — or null); each container's `~/.lz/registry.json` also gets `boards`
2829
+ (`{<board>: {coordinator, address}}`), `fleet_admin` and `names_auto`; status.json and each container's
2830
+ `~/.lz/status.json` carry `address` and `role` per row, and a Claude lane's `agent{}` carries `messaging`
2831
+ (`{socket_present, name}`: the socket its session file's `messagingSocketPath` names exists — lstat'ed through the
2832
+ container's root, never opened — and its session name) and `name_match` (that name is the address; null for any other
2833
+ harness and for a Claude lane without a session file). The `<pid>.<hash>.key` file Claude keeps beside its session
2834
+ file is never read (DEF-1802 stands).
2835
+
2836
+ The verbs:
2837
+
2838
+ ```
2839
+ lanes address list [<board>] # lane, address, role, name match; fleet admin; boards without a coordinator
2840
+ lanes address set <lane-id> <board>.<alias> # an override (a leading @ is fine); the derived address again removes it
2841
+ lanes address set-coordinator <board> <lane-id>
2842
+ lanes names sync [--board B] [--write] # dry run unless --write
2843
+ lanes migrate addresses [--write] [--board B] # dry run unless --write
2844
+ ```
2845
+
2846
+ `lanes address set` and `set-coordinator` edit only the one member of the manifest (every other byte is kept; the
2847
+ manifest's first write leaves `<manifest>.bak-<UTC>` beside it, like `lanes rename`), then sync. `set` is refused,
2848
+ nothing written, while another lane answers to the address; a sync that refuses the result puts the manifest back and
2849
+ syncs again. An adopted session keeps its derived address (promote it with `P` to name it).
2850
+
2851
+ **Name parity.** `lanes names sync --write` types `/rename <address>` and Enter (two tmux clients 0.5 s apart,
2852
+ DEF-1803) into each Claude lane whose session name is not its address — only into a lane status.json shows observed,
2853
+ idle-like (`needs_input`, `idle`, `done`), not delegating and without output in the last 20 s, and only after reading
2854
+ the lane's session file again: Claude's own word must be `idle` (never `waiting`, a dialog a typed line would answer),
2855
+ its background work must be quiet, and exactly one live session must be bound to a pane of the lane's session **on the
2856
+ lane's own tmux socket** (BEY-6838). A session file names its pane `<session>:@<win>.%<pane>`, a string local to one
2857
+ tmux server, and one container runs many: on 2026-10-26 seven `lanes-shells-<board>` servers of one workspace each held
2858
+ `coordinator:@0.%0` with its own Claude. So the file counts only for the server whose pane of that name has the Claude
2859
+ process (or one of its ancestors, at most 8 steps up) as its root process — one `list-panes -a` of the lane's server,
2860
+ then the container's `/proc/<pid>/stat` parent chain — and statusd binds the same way before it publishes a lane's
2861
+ `agent{}`. The others are listed `deferred` with the reason; exit 1 only when tmux did not take one. While
2862
+ `LANES_NAMES_AUTO` is not `0`, `lanes-statusd` retries between two cycles, never on a host that is not `ok`: at most 2
2863
+ lanes a pass, each at most once per 120 s, and only a lane with no terminal attached (a person may be typing there).
2864
+ Its journal line says what it did, never what is on the screen: `journalctl --user -u lanes-statusd | grep ' names '`.
2865
+
2866
+ **The dispatch lock** (BEY-6838). The name repair (`lanes names sync --write` and statusd's retry, both
2867
+ `lanes_lib.rename_claude`) takes the lane's dispatch lock before it types: an exclusive `flock(2)` on the container file
2868
+ `~/.lz/state/dispatch/<lane id>.lock` (directory 0700, file 0600, created when absent; from the host
2869
+ `/proc/<container init pid>/root/home/coder/.lz/state/dispatch/<lane id>.lock`, walked without following a link),
2870
+ waiting at most 5 s, held across its last check of the recipient, the text and the Enter. Not taken in time, nothing
2871
+ is typed and the lane is `deferred` (`another sender holds the dispatch lock of <lane id>`); a lock path that is a link
2872
+ or not a regular file defers it the same way. Under the lock it checks that the same pid with the same `procStart` is
2873
+ alive, its session file still says `idle` with the same `statusUpdatedAt`, and the pane is still on that socket with
2874
+ the same root process. W15 part 2's senders (`lane_core.message`, lane-peerd, the statusd inbox drain) share this path
2875
+ and these semantics, so two senders never interleave their text and Enter in one lane; `lane send` and lane-mcp's
2876
+ `lanes_send` do not take it in 1.7.0. The file holds nothing; a holder that dies releases it; removing it while nobody
2877
+ holds it changes nothing.
2878
+
2879
+ **The migration** (`lanes migrate addresses`, idempotent). It validates the site the way `lanes sync` does (without
2880
+ publishing) and prints board errors and address clashes; writes `coordinator` into every board manifest that has none —
2881
+ the lane whose slug is the board id, else the first declared lane, each choice printed with the rule — and, without
2882
+ `--board`, appends `LANES_FLEET_ADMIN=@fleet-management.fleet-management` to site.conf when it names no fleet admin
2883
+ (a missing site.conf is not created: add the line by hand). A board with errors is skipped. Dry run by default: the
2884
+ choices and the diffs. `--write` first copies every file it will change to
2885
+ `~/.local/state/lanes/migrations/<UTC stamp>/<NN>-<file name>` (directory 0700, copies 0600) with `receipt.json`
2886
+ (`{v: 1, verb, at, board, files: [{path, backup, change, sha256_before, sha256_after}]}`, DM-LANES-MIGRATIONS), writes
2887
+ them under the registry lock, validates again — a board error or a clash that was not there before puts every file
2888
+ back and exits 1 — and syncs. A second run prints `nothing to change` and exits 0. To undo by hand: copy each `backup`
2889
+ of the receipt back to its `path`, then `lanes sync`.
2890
+
2891
+ The operator's designations of 2026-10-25 for rd-work, after the migration wrote the default rule (check each lane
2892
+ id first with `lanes address list <board>`: these follow from the addresses the plan names):
2893
+
2894
+ ```
2895
+ lanes migrate addresses
2896
+ lanes migrate addresses --write
2897
+ lanes address set <lane-id> <board>.<alias> # e.g. a board lead renamed to <board>.sakio-coordinator
2898
+ lanes address set-coordinator <board> <lane-id> # one row per board of the plan's designation table
2899
+ lanes address set-coordinator worlds worlds--worlds-integration
2900
+ lanes address set worlds--worlds-service-operations worlds.worlds-service
2901
+ lanes address set-coordinator ensemble ensemble--ensemble-project
2902
+ lanes address set-coordinator design-systems design-systems--ds-coord
2903
+ lanes address set-coordinator fleet-management fleet-management--fleet-management
2904
+ lanes address set-coordinator bw-tools bw-tools--coordinator
2905
+ lanes doctor
2906
+ lanes names sync --write
2907
+ ```
2908
+
2909
+ and the same `lanes address set-coordinator <board> <lane-id>` for each of brand-and-design, code, seta, auto-swarm,
2910
+ bw-fabric, connections, rea and groundworks, naming the `<board>--coordinator` lane created that day. `lanes doctor`
2911
+ then shows `coordinators: every board has one (N)` (else `⚠ K of N boards without a coordinator: …`), `✓ lane addresses
2912
+ unique` (`✗` naming both lanes of each clash),
2913
+ the fleet admin (`⚠` unset, or naming no lane), `⚠` for an `addresses` key that names no terminal, and per container
2914
+ `Claude names = addresses: <container> <matching>/<Claude lanes>`.
2915
+
2916
+ ### Codex lanes: thread ids (W15 L3)
2917
+
2918
+ A Codex lane is addressable — a message can reach it with `codex queue --thread <id>` — once Lanes knows its thread
2919
+ id. On 2026-10-25 no container had the Codex hooks, and 0 of the 27 Codex lanes counted that day had one (Linear
2920
+ BEY-6841). Two sources now give it, in this order:
2921
+
2922
+ 1. **The Codex hooks** (the agent's own record). `lanes hooks install --agent codex --container <name>` (a dry run;
2923
+ add `--write`, step 3 of "Installing agent hooks" above) makes Codex run `lane-signal` on its turn events, which
2924
+ records the thread id in the lane's sidecar; statusd publishes it as `agent.session_id`. `lanes install-container
2925
+ <name>` prints this step, gated, for a container whose home has `~/.codex` (`Codex lanes: lanes hooks install
2926
+ --agent codex --container <name> …`), or `Codex hooks: lane-signal installed` once they are; it installs nothing.
2927
+ Codex asks a person to trust new hooks before it runs them.
2928
+ 2. **Codex's own daemon** (an inference, labelled `via: app-server` on the handle). Every Codex TUI here runs its
2929
+ threads on one shared app-server daemon. lane-mcp (and `lane address`) asks it over
2930
+ `~/.codex/app-server-control/app-server-control.sock` — Codex's link to `/tmp/codex-daemon-<uid>/<sha256>`, followed
2931
+ only when it points at a socket of this uid in a 0700 directory of this uid; neither `~/.codex` nor
2932
+ `app-server-control` may be a link — for its live top-level threads (`initialize`, `thread/loaded/list`, then
2933
+ `thread/read` without turns: read-only, 2 s and 1 MiB at most, answered from a 10 s cache). A lane's thread is the
2934
+ one whose `cwd` is its Codex process's (`readlink /proc/<pid>/cwd`; the process found under the lane's tmux pane);
2935
+ several there are told apart by the title Codex draws, which is the thread's name; still several is
2936
+ `handle_ambiguous`, as is a thread two lanes would take. Measured here 2026-10-25: 29 lanes whose agent was Codex, 10
2937
+ of them a Codex that had ended (`shell`); of the 19 live ones, 18 got a thread id this way (10 by cwd alone, 8 by cwd
2938
+ and title) and one did not (`no_match`: its thread was no longer loaded in the daemon).
2939
+
2940
+ `lanes_status` shows the whole handle: `via` for a daemon match; `why` when the daemon placed no thread
2941
+ (`unsafe_socket`, `unreachable`, `timeout`, `too_big`, `protocol`, `truncated`, `no_pid` — no Codex process found under
2942
+ the lane's pane —, `no_match` or `handle_ambiguous`). A container without a Codex daemon (`no_daemon`) answers the
2943
+ handle exactly as before L3. `lanes doctor` prints, per container, `codex lanes addressable: <container> N of M` — M the
2944
+ lanes whose agent is a live Codex, N those with a hook-recorded thread id (the daemon matches are made in the container
2945
+ and not counted there); below M it names the hook step.
2946
+
2947
+ **Re-measuring after a Codex update.** The protocol is pinned by `lanes/tests/unit/test_codex_contract.py` against
2948
+ the exchange recorded in `lanes/tests/unit/fixtures/codex/thread-list.json` (`_measured`: Codex 0.164.0, 2026-10-25,
2949
+ the methods, every thread field; cwd paths, names and previews redacted). Its live leg runs only with the measurement
2950
+ switch, against your own running daemon: `LANES_MEASURE_CODEX=1` (it reads; it never starts a turn or types into a
2951
+ lane). To re-record the fixture after a Codex update — a local read of your own socket, not a test run:
2952
+
2953
+ ```
2954
+ LANES_MEASURE_CODEX=1 python3 -c 'import sys; sys.path.insert(0, "lanes/tests/unit"); import test_codex_contract as T; T.record()'
2955
+ ```
2956
+
2957
+ then run the unit suite in a managed job; a Codex that renamed a method or a field reds the contract's live leg.
2958
+
2959
+ **A site hook written before 1.7.0 (BEY-6912).** A site that replaces `lanes_lib.build_registry` (rd-control's
2960
+ federation hook does, to fold the guests' lanes in) with a callable that has no `strict` parameter would have made
2961
+ `lanes migrate addresses` and `lanes doctor` die on a `TypeError`. Since 1.7.1 `site_check` reads the callable's
2962
+ signature: without `strict` (and without `**kwargs`) it makes the older call and says so once on stderr — two lanes
2963
+ on one address then refuse, as before 1.7.0, instead of being listed — and `lanes doctor` prints the same as a `⚠`.
2964
+ The hook's fix is to forward keyword arguments (`def build_registry(previous=None, **kw)`), after which nothing is said.
2965
+
2684
2966
  ## Safety rules baked into the code (do not remove)
2685
2967
 
2686
2968
  - tmux is always called with `-N` (`attach-session`, `new-session` and `start-server` on a missing socket start