Skip to content

docs: resident guests (RG1-RG7), clients' guests that stay on arisrvx, with hooks, leases and a gas ledger - #1290

Merged
transfix merged 1 commit into
masterfrom
docs/resident-guests-plan
Nov 18, 2026
Merged

transfix merged 1 commit into
masterfrom
docs/resident-guests-plan

Conversation

@transfix

Copy link
Copy Markdown
Owner

A plan, docs only. Nothing is built. It's the owner's ask after G4's first part (#1283): clients' WebAssembly guests that stay on the server, with hooks, lifetimes past the connection, and a gas ledger that pays for them. The plan is docs/roadmap/ARIADNE_RESIDENT_GUESTS.md. ARIADNE_SCRIPTING_HOSTS.md §8.7 points to it.

The model

A resident is a guest instance the relay keeps, in one room, owned by a principal (by hash).

  • Firings: its hooks fire activations on that one instance. Each firing is a capped run, like a G4 call, and the ledger debits its owner's balance for it.
  • Lease: it ends with its owner's connection by default; or some seconds after its owner was last connected, with a reconnect resetting that; or only when it is closed.
  • Home: it writes its own conf.rooms.<room>.guests.<gid>, under the participant rule, so the room sees it as a headless participant.

Phases

Phase What Size
RG1 Residents bound to the connection: room-guest-start/-stop/-send/-call, room-guests. Hooks on_tick, watch, msg, timer, owner, close. The instance kept across firings, its subtree, gate rule and status, a budget per room step, limits per principal M
RG2 The gas ledger: accounts by salted hash, a grant at first sight, refill as a token bucket, a fee per firing, reserve then settle, starving at zero, (room-gas), a journal store behind an interface. G4's and S3's calls are charged too M
RG3 Leases: linger (10 s grace by default), forever and ttl; the countdown and its reset on reconnect; reattaching by principal; closing reasons; the admin role, and arisrvx's host.guests / host.ledger M
RG4 DSL residents on the same leases, hooks and ledger S
RG5 Hibernation of idle residents, and residents across a relay restart L
RG6 Guests on clients: native on the pool; in the browser, compiled by Promise (no threads, no COOP/COEP), metered in the page, run to their end M
RG7 The Worker backstop (G4's second part) M

Open decisions (§11)

The plan has twelve, each with a recommendation. The ones that shape RG1–RG3 most:

  • D1, D2: a resident writes only its own subtree, and reads what its owner is sent (the owner's S6 read scope).
  • D3, D4: the default lifetime is the connection plus a 10 s reconnect grace. A reconnect stops the countdown, and the next departure starts it again from the full linger.
  • D5, D9: lifetimes past the grace, and grants, need an authenticated principal (S5). A device id is no proof that the same client came back, and grants to unproven ids could be farmed.
  • D6, D7: whenever a ledger is set, G4's one-shot calls and S3's programs pay too. Running out starves a resident instead of killing it.

CI

Docs only. The full matrix is cancelled to spare runners while #1283's checks run, and the required jobs will be re-run before a merge.

…, with hooks, leases and a gas ledger

A plan, nothing built: docs/roadmap/ARIADNE_RESIDENT_GUESTS.md, from the
owner's ask after G4's first part (#1283).

- RG1: a client starts a resident guest that the relay keeps, one
  instance across firings, with hooks (on_tick, watch, msg, timer,
  owner, close). It writes its own conf.rooms.<room>.guests.<gid> under
  the participant rule and reads what its owner is sent.
- RG2: a gas ledger per principal, kept by salted hash: a grant at first
  sight, refill as a token bucket, a fee per firing, reserve then settle,
  starving at zero, a journal store behind an interface.
- RG3: leases past the connection (linger with a reset on reconnect,
  forever, ttl), reattaching by principal, closing reasons, and an admin
  role.
- RG4-RG7: DSL residents, hibernation, guests on clients (a Promise
  compile and the gas pass in the page), and the Worker backstop.

Twelve decisions (D1-D12) are open, each with a recommendation.
ARIADNE_SCRIPTING_HOSTS.md §8.7 points to it.
@transfix
transfix enabled auto-merge (squash) November 16, 2026 01:50
transfix added a commit that referenced this pull request Nov 16, 2026
…view

From the arisrvx session's review, and Joe's answers to both sessions:

- client_registry keeps a client's limits as client_limits (programs and guests as optional
  booleans; steps, time and memory_mb, where 0 is the document's), and limits(pid) returns them
  as an optional. That is what ServerDocument::set_client_limits (#1296) reads.
- concurrency and python are not keys. Programs and guests run one at a time per client, and ID4c
  adds python.
- The doc:
  - #1290's ledger keys on the principal or the verified device tag, never the client id;
  - packaged clients keep their names;
  - #1296's seam as built;
  - client Python needs a WASI CPython, not W5's Emscripten build;
  - parts are named by session;
  - D2 is being confirmed, since Joe answered the two sessions differently.
transfix added a commit that referenced this pull request Nov 16, 2026
…view

From the arisrvx session's review, and Joe's answers to both sessions:

- client_registry keeps a client's limits as client_limits (programs and guests as optional
  booleans; steps, time and memory_mb, where 0 is the document's), and limits(pid) returns them
  as an optional. That is what ServerDocument::set_client_limits (#1296) reads.
- concurrency and python are not keys. Programs and guests run one at a time per client, and ID4c
  adds python.
- The doc:
  - #1290's ledger keys on the principal or the verified device tag, never the client id;
  - packaged clients keep their names;
  - #1296's seam as built;
  - client Python needs a WASI CPython, not W5's Emscripten build;
  - parts are named by session;
  - D2 is being confirmed, since Joe answered the two sessions differently.
@transfix
transfix merged commit 147e9ff into master Nov 18, 2026
29 of 57 checks passed
@transfix
transfix deleted the docs/resident-guests-plan branch November 18, 2026 23:56
transfix added a commit that referenced this pull request Nov 19, 2026
# Conflicts:
#	src/arisrv/main.cpp
#	src/cvc/CMakeLists.txt
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