INNER CODE UNIT · TypeScript

server

Beever-AI/beever-atlas · bot/src/index.ts:939

  const server = createServer(async (req: IncomingMessage, res: ServerResponse) => {
    // Health check
    if (req.method === "GET" && req.url === "/health") {
      // RES-286 — return 503 while the chat manager is rebuilding adapters
      // (recycle or sync) so docker healthcheck retries kick the bot only
      // once it's actually wedged, not during legitimate 1-s recycle windows.
      // The full `memory` block lets operators graph RSS between recycles
      // and catch leak regressions early.
      //
      // SECURITY: this endpoint is unauthenticated and exposes
      // `process.memoryUsage()` + uptime. The bot listens on `127.0.0.1:3001`
      // (internal management surface; see docker-compose.yml `bot.ports`).
      // If the bot port is ever exposed beyond loopback, gate this response
      // behind the same `BRIDGE_API_KEY` Bearer auth that `/bridge/*` uses,
      // or move memory/uptime to a separate `/debug/health` route.
      const transitioning = chatManager.isTransitioning();
      jsonResponse(res, transitioning ? 503 : 200, {
        status: transitioning ? "transitioning" : "ok",

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…