Skip to content

consolidate the worker into a single-threaded lifecycle owner #717

Description

@zgeoff

Finish making the worker a single-threaded owner of one always-present simulation: continuations become durable start intents, the start chain grows into a lifecycle mailbox, and the null-simulation states collapse. Each piece deletes more code than it adds.

Scope

  • Durable start intent: replace the in-memory pending continuation with a {avatarID, scopeID, scopeType, startKey} record in the worker's preferences store, drained at reconnect and resync entry exactly like the stop intent — idempotent start keys make late or duplicate delivery safe. planResync loses its continue kind and pending-continuation input; the continue apply path and its guards go with it. A pending continuation also stops dying with the worker: today it lives in closure state and a reload loses it.
  • Lifecycle mailbox: resync and continuation flows join the start chain, so lifecycle work runs strictly one flow at a time. Stops stay outside — the local halt must be instant — and their epoch bump is re-checked once at a queued flow's entry instead of after every await. Most per-await stop checks become provably dead and are deleted.
  • Never-null simulation: the worker always holds a simulation ("no run" is an empty one), collapsing today's three idle representations — null, fresh-empty, activity-null — and deleting the null guards, conditional uninstalls, and just-in-case creations that each site grew around them.

Notes

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/gamearea: simulation, aether, game systemsfeaturenew featurerefactor

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions