Routing for actor lifecycle and user-facing work inside rivetkit-core. Captures the current ActorTask + DispatchCommand wiring — expect this to evolve as the ActorTask migration completes.
RegistryDispatcherstores per-actorActorTaskHandles, but startup still runs throughActorLifecycle::startupbeforeLifecycleCommand::Start. Later migration stories own moving startup fully insideActorTask.ActorContext::restart_run_handler()enqueuesLifecycleEvent::RestartRunHandleronceActorTaskis configured. Only pre-task startup uses the legacy fallback.
DispatchCommand::Action— spawns aUserTaskKind::Actionchild inActorTask.children. Reply flows from that child task. Action children must remain concurrent; do not reintroduce a per-actor action lock because unblock/finish actions need to run while long-running actions await.DispatchCommand::Http— spawns aUserTaskKind::Httpchild inActorTask.children. Reply flows from that child task.DispatchCommand::OpenWebSocket— spawns aUserTaskKind::WebSocketLifetimechild. Message/close callbacks stay inline under the WebSocket callback guard.
runis spawned in a detached panic-catching task during startup.- Tracked via the
ActorTaskrun handle; sleep shutdown waits for it before finalize.
- Actor-scoped side tasks from
ActorContextrun throughWorkRegistry.shutdown_tasksso sleep/destroy teardown can drain or abort them. Store explicitJoinHandles only for timers/tasks with their own cancellation slot.
- Engine subprocess supervision lives in
rivetkit-core/src/engine_process.rs.registry.rscallsEngineProcessManageronly from serve / startup / shutdown plumbing.
- Actor runtime Prometheus metrics flow through the shared
ActorContextActorMetrics. UseUserTaskKind/StateMutationReasonmetric labels instead of string literals at call sites.
- Process-global
ActorTasktest hooks (install_shutdown_cleanup_hook, lifecycle-event / reply hooks) must be actor-scoped and serialized in tests or parallelcargo testruns will cross-wire unrelated actors.