feat: boot timing + dynamic imports for lean daemon mode#966
Open
mistercrunch wants to merge 1 commit into
Open
feat: boot timing + dynamic imports for lean daemon mode#966mistercrunch wants to merge 1 commit into
mistercrunch wants to merge 1 commit into
Conversation
… mode Add performance.now() timing to every major boot phase (config load, DB init, registerServices, registerHooks, registerRoutes, startup sub-steps) so we can identify what's slow. Convert 10 conditionally-registered services from top-level imports to dynamic await import() gated on svcEnabled(): SchedulerService, TerminalsService, gateway (4 modules), boards (3 modules), cards (2 modules), artifacts, leaderboard, and MCP servers. When these services are disabled via config, their modules are never loaded — zero overhead in lean mode. Add lean/headless preset documentation to DaemonServicesConfig and include config-lean.example.yaml with the recommended minimal config for k8s. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Boot timing instrumentation: Added
performance.now()timing to every major boot phase instartDaemon()andstartup()— config load, service tier resolution, DB init, registerServices, registerHooks, registerRoutes, plus sub-step timing for orphan cleanup, health monitor, master secret, app.listen, scheduler init, gateway init, and total boot time. All logged with⏱️ [boot]prefix for easy grep.Dynamic imports for 10+ conditionally-loaded services: Converted top-level
importstatements toawait import()gated onsvcEnabled()for: SchedulerService, TerminalsService, gateway (4 modules), boards (3 modules), cards (2 modules), artifacts, leaderboard, and MCP servers. When disabled via config, these modules are never loaded — zero overhead.Lean mode preset docs + example config: Added documentation to
DaemonServicesConfigdescribing the recommended lean/headless preset, and includedconfig-lean.example.yamlwith the minimal config for k8s deployments.What each gated service does and its boot cost
schedulerterminalsgatewayboardscardsartifactsfile_browserleaderboardmcp_serversstatic_filesLean mode config gains
With
config-lean.example.yaml, the daemon skips:Essential services preserved:
core(sessions/tasks/messages),worktrees,repos,users,mcp_servers.Boot timing output format
Test plan
pnpm checkpasses (typecheck + lint + build)config-lean.example.yaml— verify disabled services are not imported🤖 Generated with Claude Code