Skip to content

P5 O11 M6: RL1 and the Machine DO relay - #206

Merged
SSFSKIM merged 6 commits into
masterfrom
p5-o11-m6
Oct 27, 2026
Merged

SSFSKIM merged 6 commits into
masterfrom
p5-o11-m6

Conversation

@SSFSKIM

@SSFSKIM SSFSKIM commented Oct 27, 2026

Copy link
Copy Markdown
Owner

P5 O11 M6: RL1 and the Machine DO relay (docs/doperpowers/plans/2026-10-27-p5-o11-hub-v2.md, M6).

What this lands

  • RL1's shapes in apps/org-protocol (src/relay.ts):
    • the channel multiplex [u8 type][u32 channel][payload] and its u16 close reasons;
    • RL1_MESSAGE_LIMIT (1 MiB) and 64 channels per socket;
    • the text frames: endpoint hello, welcome, hb/hb-ack, listing, endpoint, notify, state, refusal, presence.
  • The relay. The relay is the existing Machine DO class, addressed by ref (<org>:ref:<ref>), with no new class and no migration.
    • It holds the machine's endpoint socket (GET /machine/socket) and the members' app sockets (GET /api/machines/<ref or name>/socket).
    • It carries channels unread both ways, and refuses a message over 1 MiB with 1009.
    • It relays the log plane to the Projects. It stores listings and endpoint records through the Registry, and pushes notify to the listed owners only.
    • Both socket kinds hibernate.
  • Generations, credentials and routing.
    • DX2's name object still holds the one generation counter. An RL1 connection claims its generation there, and a DX2 open supersedes it.
    • The ref object keeps a fence per exact name, and checks it on every socket message.
    • Revocations and supersessions owed to it are stored and retried by alarm until delivered. A revocation fences the revoked credential's own claim, even when another credential holds the newer one.
    • A name or ref routes only through the head's live machines entry or a kept certificate. A ref that another name's binding holds is refused 409 ref-taken, and an unbound machine is refused 409 not-listed.
  • Membership. State notices reach every relay through the Registry's durable announcements. A removed member's app sockets close 4403 removed whether or not an endpoint ever connected.
  • The session plane over RL1. A browser's rpc to an RL1 machine fails unsupported and a subscribe ends with error, while the log fan-out stays. A retry of an RPC that was already sent stays uncertain.
  • The fake endpoint (apps/desk-hub/fake-machine/), its CLI (enroll-v2, endpoint, relay-check) and RelayApp. M8 uses them on staging.
  • The O11 document: M6 is ticked, with its decisions and discoveries.

These RPCs are new in this milestone, and no deployed hub has any of them (production hub@3486527c, master, staging hub@e3694c0b):

  • on Machine: claimGeneration, rl1Check, relaySend, relayClose, relaySupersede, relayRevoke and relayState;
  • on Registry: machineRefOf, machineRefNamed and stateVersion.

During a rollout, a side that lacks one takes the existing lacksMethod path and answers 503 hub-updating.

Validation Evidence

  • Tests. On M6's last fix head, desk-hub passes 838/838 (62 files), org-protocol 34/34 and desk-web 918/918. Typechecks are clean, and eslint is clean on the touched files.
    • Every finding was fixed test-first. test/relay-fences.test.ts holds the reviewers' scenarios.
    • Master, with M5, is merged in; the project.ts conflict was resolved as on M7's branch. CI on the merged head is below.
  • Review. doperpowers:reviewer-high and reviewer-medium ran three fix waves.
    • First review: 4 P1 and 3 P2. These were relay takeover by a posted ref, a claim landing after revocation, a dropped revocation, a removal missing app-only relays, multipart lost to eviction, generations across renames, and session-plane frames answered written.
    • Second review: a credential overlap, a terminal retry, and the fence key's case.
    • Requests for versioned variants of the RPCs above were dismissed with the dispatching session's agreement, since they never shipped.
    • The last re-review, reviewer-high on d7532a9..1eed7c8, came back correct.
  • Staging. Acceptance 3's hub part is proved in the suites. Its staging run (1 000 frames, the deploy clause, the 1 MiB refusal) is part of M8's acceptance run.
  • CI: ci-gate GREEN on a91914e68 (static, unit, probes, e2e:desk-web), with master and M5 merged in: https://github.com/SSFSKIM/MAWS/actions/runs/40451695968

For O13

  • The Project's machines frame doesn't show RL1 machines. Their presence reaches the grid (machines_online) and the relay's presence frame, but not the per-project machines list that a browser draws. O13's app owns that view.

For the architect's tech-debt tracker

  • Revocations and supersessions owed to a ref object retry without a limit, as M4's announcements do. A ref object that keeps throwing would keep a name object's alarm firing once a minute.

Sminos-Session: p5-desk-track-owner#b4948247 (doperpowers on macbook)

A v2 machine holds one WebSocket, /machine/socket, held by a Machine object
addressed by its ref (<org>:ref:<ref>); DX2's name-addressed object stays
the one generation counter, fence and project mailbox for both transports.
RL1 carries DX2's log plane through Project.fromMachine, hb/hb-ack with the
lease, listings, endpoint records and notify (Registry.storeListing,
storeEndpoint, notify), the state notice, and the channel multiplex. Apps
open channels through /api/machines/<ref or name>/socket; frames are
relayed unread. Both socket kinds hibernate; the channel map is rebuilt
from attachments. Session-plane frames on RL1 are refused 422 not-on-rl1;
a message over 1 MiB closes its socket 1009. RL1 uploads push nothing
through the log plane (notify is RL1's push). RL1's frame shapes and the
binary codec live in org-protocol (relay.ts). The fake endpoint, a fake
app and their CLI (enroll-v2, endpoint, relay-check) are in fake-machine/.

Sminos-Session: desk-sminos-orchestrator#b4948247 (doperpowers on macbook)
M4 now carries M3's chain, members and devices, the persisted project
announcements, and Registry.enrolled. The conflicts were in registry.ts
(M4's persisted announcements kept; M6's relay lookups and machine
announcement re-added after them) and worker.ts (M4's machineRetiresCert
and lacksMethod import kept beside M6's RL1 routes). The O11 document is
p5-o11-m4's.

Sminos-Session: p5-desk-track-owner#b4948247 (doperpowers on macbook)
… delivered revocations, relay state announcements

- Routing: /machine/socket and app sockets reach a ref's object only through the head's live `machines` entry or a
  kept certificate; a key posting a ref the state or a certificate gives another name is refused 409 ref-taken, and
  a machine whose ref only its key posted is 409 not-listed.
- Fences: the ref's object numbers its own connections (`conn`) and keeps a per-name generation fence, raised by an
  install, a replacement, a DX2 supersession and a revocation; a claim granted before a fence and arriving after it
  is refused, and a fenced connection carries nothing more.
- The name's object keeps supersessions and revocations owed to the ref's object and retries them by its alarm until
  taken.
- The Registry announces every state to each relay's object (the announcements table, `ref:<ref>`), from its first
  socket on, so a removed member's app sockets close whether or not an endpoint ever connected.
- A part continuing a set lost to an eviction closes the endpoint 4412 parts-lost.
- A session-plane frame for an RL1 connection answers `not-on-rl1`: the RPC fails `unsupported`, the subscription
  ends `error`, and the log fan-out stays.

Sminos-Session: p5-desk-track-owner#b4948247 (doperpowers on macbook)
…tries, exact-name fences

- The name's object keeps each credential's newest RL1 claim and fences a revoked credential's connections up to it,
  even while another credential holds the newest claim, which stays above the fence.
- A retried RPC the hub cannot deliver stays uncertain whatever the transport answers; `unsupported` is a first
  forward's alone.
- A ref's object keys each name's fence by the exact name its generation counter is addressed by, so a name
  enrolled again in another case is not fenced by the old one's counter.

Sminos-Session: p5-desk-track-owner#b4948247 (doperpowers on macbook)
Sminos-Session: p5-desk-track-owner#b4948247 (doperpowers on macbook)
Sminos-Session: p5-desk-track-owner#b4948247 (doperpowers on macbook)
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-27T04:56:58.259061Z a91914e PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@SSFSKIM
SSFSKIM merged commit db987e8 into master Oct 27, 2026
SSFSKIM added a commit that referenced this pull request Oct 27, 2026
…ne list doesn't learn RL1 machines; tracker row for unbounded relay fence retries

Sminos-Session: GUI AI agent workspace charter#37052769 (MAWS on macbook)
SSFSKIM added a commit that referenced this pull request Oct 27, 2026
Sminos-Session: p5-desk-track-owner#b4948247 (doperpowers on macbook)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant