Supervision Tree
Liteskill uses a rest_for_one supervision strategy. If an infrastructure child (like Repo or PubSub) crashes, all children started after it restart too, re-establishing subscriptions and connections.
Child Process Order
The supervision tree starts children in this order:
LiteskillWeb.Telemetry— Telemetry metrics and pollerLiteskill.Desktop.PostgresManager— (Desktop mode only) Starts bundled PostgreSQLLiteskill.Repo— Ecto repository / database connection poolDNSCluster— DNS-based node clusteringPhoenix.PubSub— PubSub server (Liteskill.PubSub)Liteskill.Rag.EmbedQueue— Embedding request queue (skipped in test)Oban— Background job processing (queues:default,rag_ingest,data_sync,agent_runs)- Boot tasks — (non-test) Ensures admin user, system roles, env providers, and settings; auto-provisions admin in single-user mode
Liteskill.OpenRouter.StateStore— OAuth PKCE state storage for OpenRouterLiteskillWeb.Plugs.RateLimiter.Sweeper— Periodic ETS cleanup for rate limiterTask.Supervisor(Liteskill.TaskSupervisor) — For LLM streaming and async workLiteskill.Chat.StreamRegistry— Monitors active LLM stream tasks, triggers recovery on crashRegistry(Liteskill.LlmGateway.GateRegistry) — Per-provider gate registryDynamicSupervisor(Liteskill.LlmGateway.GateSupervisor) — Dynamic circuit breaker gatesLiteskill.LlmGateway.TokenBucket.Sweeper— Periodic ETS cleanup for token bucketsLiteskill.Chat.Projector— Event → projection table updaterLiteskill.Chat.StreamRecovery— Periodic sweep for stuck streaming conversationsLiteskill.Schedules.ScheduleTick— (non-test) Periodic check for due schedulesLiteskillWeb.Endpoint— Phoenix HTTP endpoint (started last)
LLM Gateway
The LLM Gateway provides per-provider concurrency control and circuit breaking:
GateRegistry— Unique registry keyed by provider IDGateSupervisor— Dynamically spawnsGateprocesses per providerTokenBucket— ETS-based rate limiting with periodic sweeper
Stream Registry
Liteskill.Chat.StreamRegistry monitors active LLM streaming tasks. If a streaming task crashes, the registry detects the :DOWN message and triggers stream recovery, preventing conversations from getting stuck in the :streaming state.
Stream Recovery
Liteskill.Chat.StreamRecovery is a periodic sweeper that detects conversations stuck in streaming state for more than 5 minutes and automatically recovers them by failing the stream.