feat(FN-1607): add process lifecycle diagnostics and fix resource leaks

- Add process lifecycle diagnostics for dashboard and serve commands
- Add SQLite database health check to diagnostics endpoint
- Add store listener count diagnostics for debugging subscription leaks
- Audit and fix SSE connection management to prevent connection leaks
- Audit and fix timer/interval cleanup in engine and CLI shutdown handlers
- Fix res.on() call guard for test mocks compatibility
- Fix variable declaration ordering in serve.ts
- Update memory with diagnostic findings for future debugging
This commit is contained in:
gsxdsm
2026-04-12 15:27:50 -07:00
parent 1b9421561a
commit 9b20a99bae
5 changed files with 472 additions and 2 deletions

View File

@@ -4206,6 +4206,21 @@ ${stepsSection}`;
return this.db;
}
/**
* Perform a simple database health check.
* Returns true if the database responds correctly, false otherwise.
* Used for periodic health diagnostics.
*/
healthCheck(): boolean {
try {
// Simple query to verify database responsiveness
this.db.prepare("SELECT 1").get();
return true;
} catch {
return false;
}
}
private generateSpecifiedPrompt(task: Task): string {
const deps =
task.dependencies.length > 0