Repository navigation
reviving references on workerd
Superseded: toybox chose 1f, a kernel with virtual objects. See the dozen designs ending with toybox (#2), where this is design 12.
An idle Durable Object leaves memory within seconds to minutes (10 s to hibernate, 70–140 s to evict). A hibernatable WebSocket stays connected, but the in-memory tables of a Cap'n Web or OCapN session over it don't survive unless the app saves them. So references to and from a DO's objects can break often, not just on a rare crash. This IBIS collects the positions taken so far: in an Oct 27–28, 2026 chat, in cf-fun1's design docs, and in capsite toybox commits.
- 💬 persistence is orthogonal: in OCapN a reference lives as long as its session, and the peer must explicitly share more to reach the object again
- 💬 positions overlap: 1a is the floor the rest build on; 1d can mint 1b-style locators; 1g removes the question for one side's restarts
- 🔶 1a. Fail-stop: references break, and the holder asks again through some explicit entry point.
- ➕ status quo in toybox: imports go when their session does f64dac4
- ➕ fail-stop is the right default; automagic causes bigger problems
- ➕ CapTP federates peers that make different persistence choices on top of live sessions
- ➖ app developers want a platform where these concerns are beneath them
- 💡 1b. Sturdyrefs: the host chooses which objects to root and mints swissnums for them in a supervisor-owned table.
- ➕ rooting becomes an intentional act
- ➕ cf-fun1's counters come back after restarting both workers [counters, Beat 8]
- ➕ guest code can't enliven a string; the supervisor holds the table [swissnum table]
- ➖ each one is a commitment, persisted with its target
- ➖ every app has to decide what to root: explicitness has a cost
- 💡 1b-i. Give each sturdyref an expiry date, as E did.
- ➕ informational only: a hint that it may stop working after that date E SturdyRef
- ➕ an expiry makes the GC question easier
- 💡 1c. Liveref locators: serialize a live reference as an encrypted kernel slot plus salt, fetched directly with no enliven step (MetaMask ocap-kernel).
- ➕ any live reference can outlive its session, not just chosen ones
- ➖ it's implicit, not granted, so GC is the open problem
- ➖ passable only by third-party handoff
- 💡 1d. Formula DAG: a locator names a formula that rebuilds the reference from its dependencies on demand; locators you keep are pinned from a petname (Endo daemon, as described in chat).
- ➕ fits eviction: rebuilding on wake is the normal path, not a recovery path
- ➕ toybox already does a degenerate case: a mount restarts its vat from saved params e5ed407
- ➖ "a vat whose params hold another peer's objects isn't restartable yet" (see 3)
- ➕ workerd already rebuilds a reference from data plus authority:
idFromNameturns a name into an id (data), andget(id)on the namespace binding returns a stub - ➕ in Endo,
endo cancelforces the death and rebirth on demand, and tests check the rebirth endo tests - ➕ a backstop for references that tolerate death and rebirth, not a substitute for orthogonal persistence
- ➖ a rebuilt object is a new incarnation; state not in storage is gone
- ➕ toybox's counter keeps its count in vat storage
- 💬 compare SoulState from Electronic Communities
- 💡 1e. Hoarder GC: never drop anything (Waterken).
- ➕ the GC algorithm is very simple
- ➕ objects need not live in memory: unused ones are never loaded Waterken upgrade; Goblins' sleepy actors do likewise
- ➕ "live fast, die young and leave a good-looking corpse": periodically destructing short-lived vats reclaims the disk Waterken upgrade
- ➖ didn't seem to work well for long-lived assets and rights
- ➖ someone back after a month may find key things effectively deleted, if anything ever expires
- 👍 1f. Kernel plus virtual objects: a swingset-like kernel under the vats; durable objects are virtual and the kernel does the GC.
- ➕ proven in production: a promise resolved after ~56 days, with human processes in the loop
- ➕ ephemeral objects that don't survive a restart simply break their promises
- ➖ swingset's comms vat, for going beyond the kernel, was too messy for production; e.g. no cost recovery for promises
- ➖ within one kernel is one thing; remote, networked refs are where it's tricky
- 💡 1g. A netlayer that survives restart: persist the session's tables, so eviction or restart doesn't end the session.
- ➕ hibernatable WebSockets stay connected while the DO is out of memory DO lifecycle
- ➕ Waterken and swingset sessions never end, and apps on them don't face this question
- ➖ gives up the benefits of ephemeral live sessions
- ➖ imports held by a session that never ends are never released (see 5)
- ➖ only covers this side; the peer's restart still ends the session unless it does the same
Sources: f64dac4, e5ed407 (capsite toybox); counters and swissnum table are cf-fun1/designs/counters-across-workers.md and supervisor-owned-swissnum-table.md in awesome-ocap, branch phase-0-sturdyref-mint (not yet pushed); E SturdyRef; Waterken upgrade: Live fast, die young and leave a good-looking corpse; Pet Dæmon formula graph; SwingSet garbage collection; Goblins #817, persisting remote references; DO lifecycle.
- 💬 toybox's rule: architecture with no story waits
- 💡 2a. S1, the weekly roundup, gets by with fail-stop (1a): a human is in the loop each week.
- 📌 check: does anything in S1 hold a reference across weeks?
- 💡 2b. S2, album to album unattended, needs its subscription to survive eviction: 1b or 1d.
- ➕ nobody is watching to re-establish it
- 💡 2c. ERTP over gnucash needs purses that last: 1b, 1d, or 1f.
- ➕ purses are long-lived rights
- ➖ 1e is out, by Waterken experience
Sources: toybox user stories; ertp-dacct.
- 💬 this is what e5ed407 left open
- 💡 3a. By sturdyref: the formula holds the peer's locator and swissnum, and rebuilding enlivens it.
- ➕ it's the additional information the peer must share (see the comment on 1)
- ➖ only works for objects the peer chose to root (1b)
- 💡 3b. By liveref locator (1c).
- ➖ needs a peer that offers them
- 💡 3c. By the peer's own formula identifier, when both peers run formula daemons.
- ➖ only federates with peers that make the same choice
- 💬 Goblins has distributed equality; reference persistence is a separate matter
- 💬 Workers RPC gives a returning object back as a new stub, never the same object
- 🔶 4a. Compare by swissnum or formula identifier, never by object identity.
- ➕ already the rule in capsite and cf-fun1
- ➖ pushes identity into app code
- 💬 workerd forbids I/O outside a request, so a FinalizationRegistry callback can't send op:gc f64dac4
- 🔶 5a. Imports go when their session does (status quo).
- ➕ no I/O outside a request
- ➖ a long session leaks imports
- 💡 5b. As in Endo: cancelling a pet name ends the live value it designates and those that depend on it; the name and its formula remain, and the next lookup reincarnates the value with fresh state; removing the name lets the formula be collected once nothing else, such as @pins, retains it endo tests.
- 💬 stated in chat, not checked against the code: locators hold weakly, sessions hold strongly until terminated
- ➕ pairs with 1d
- 💡 5c. Hoard (1e).
Sources: endo tests: cancel then lookup reincarnates, at endo-but-for-bots 11e726e.
- 📌 Spike 1d in toybox: restart a vat whose params hold another peer's object, by way of 3a.
- 📌 Read how Endo rebuilds a formula's dependencies, starting at
provideControllerinpackages/daemon/src/manager.js.
Navigation
- Home
- Governance
- Endo / object capabilities
- Retrospectives and source material