QM's server entry in src/index.ts hydrates identity and configuration before the listen loop, resolves effective egress enforcement and default models from providers, and classifies Slack integration state before starting the scheduler and shutdown handlers. The startup log reports listening port, org ID, store choices, worker count, and background-work status; both SIGINT and SIGTERM trigger a guarded shutdown that runs only once.
Before accepting requests, src/index.ts calls built.identity.hydrate() and built.config.hydrate?.(), ensuring identity and configuration are fully loaded before the server's listen loop begins.[1] On startup, src/index.ts logs the listening port, org ID, session store, run store, worker count, and background-work status.[1] The scheduler is only started when config.backgroundWorkEnabled is true; otherwise, src/index.ts logs that both the scheduler and runtime loops are suppressed.[1] The postdeploy smoke test in src/deployment/postdeploy-smoke.ts is hardened to catch regressions earlier in the deploy pipeline. The Postgres connection pool in src/persistence/pg-pool.ts includes init-retry behavior to improve reliability during startup.
Egress enforcement passed to createServer in src/index.ts is the result of effectiveEgressEnforcement(built.sandbox.profile, { signingSecret, apiBaseUrl }), which may differ from the egressDeclaredEnforcement stored in the sandbox profile — the two fields are kept separate.[1] The baseModelDefault passed to createServer is resolved by defaultModelForHarness(config.harness, configuredModelForHarness(config, config.harness), baseModelProviders(config)), making provider availability part of default-model selection — the fix for an OpenRouter-only deployment receiving an Anthropic default.[1] Slack environment state is classified as "absent", "configured", or "partial" in src/index.ts: "configured" when both SLACK_BOT_TOKEN and SLACK_APP_TOKEN are fully parsed, "partial" when the tokens are present but the config could not be assembled, and "absent" when neither token is set.[1] At startup, src/index.ts probes Docker daemon availability and injects the result into the deploy provider at construction time via src/wiring.ts, rather than performing the probe inside docker-deploy-provider.ts. When the Docker daemon is unreachable at startup, src/index.ts emits a structured warning log during boot instead of failing silently or deferring the error to the first deployment attempt.
Both SIGINT and SIGTERM invoke the same shutdown() function in src/index.ts, and a boolean guard (shuttingDown) ensures the function body runs at most once even if both signals fire.[1]
Sources