apps/api/src/signal-handlers.tsShutdown exits after a bounded drain401const naturalFinish = await waitForLiveTurns(CHAT_NATURAL_FINISH_TIMEOUT_MS);
622const result = await waitForRequestsDrained(REQUEST_DRAIN_TIMEOUT_MS);
65logger.warn(`[shutdown] Proceeding with ${result.remaining} requests still active`);
1103await cleanup();
120process.exit(process.exitCode ?? exitCode);
1264process.on('SIGTERM', () => shutdown('SIGTERM', null, 0));
- 1
Wrong registry. This wait knows only about registered chat turns, so an autonomous project-agent run contributes nothing here.
- 2
Bounded request drain. The active pickup remains in the request set, but timeout does not cancel its model loop.
- 3
Process-owned exit. Once cleanup returns, Fimo exits even if the request was still active.
- 4
Trigger. Kubernetes starts this code with SIGTERM. SIGKILL is the later, uncapturable fallback.