Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
refactor: simplify crash-loop warning, mirror it in proactiveAlerts
Adam Eivy7f9813b006db
diff --git a/server/routes/systemHealth.js b/server/routes/systemHealth.jsindex dc374d0934..a3b59bffad 100644--- a/server/routes/systemHealth.js+++ b/server/routes/systemHealth.js@@ -80,11 +80,7 @@ router.get('/health/details', asyncHandler(async (req, res) => {totalMemory: pm2Processes.reduce((sum, p) => sum + (p.memory || 0), 0),totalCpu: pm2Processes.reduce((sum, p) => sum + (p.cpu || 0), 0),totalRestarts: pm2Processes.reduce((sum, p) => sum + (p.restarts || 0), 0),- // unstable_restarts is incremented only when a process exits inside its- // min_uptime window — i.e., a real crash loop, not a developer-driven- // restart. We use this for the warning, not totalRestarts.- unstableRestarts: pm2Processes.reduce((sum, p) => sum + (p.unstableRestarts || 0), 0),- crashingProcesses: pm2Processes.filter(p => (p.unstableRestarts || 0) > 0).map(p => p.name)+ unstableRestarts: pm2Processes.reduce((sum, p) => sum + (p.unstableRestarts || 0), 0)};// App status summary@@ -129,10 +125,11 @@ router.get('/health/details', asyncHandler(async (req, res) => {if (processStats.unstableRestarts > 0) {if (overallHealth !== 'critical') overallHealth = 'warning';- const names = processStats.crashingProcesses.join(', ');+ const crashing = pm2Processes.filter(p => (p.unstableRestarts || 0) > 0).map(p => p.name);+ const plural = processStats.unstableRestarts === 1 ? '' : 's';warnings.push({type: 'restarts',- message: `${processStats.unstableRestarts} crash-loop restart${processStats.unstableRestarts === 1 ? '' : 's'}${names ? ` (${names})` : ''}`+ message: `${processStats.unstableRestarts} crash-loop restart${plural} (${crashing.join(', ')})`});}diff --git a/server/services/proactiveAlerts.js b/server/services/proactiveAlerts.jsindex 7539a6ff08..5a7dcc8392 100644--- a/server/services/proactiveAlerts.js+++ b/server/services/proactiveAlerts.js@@ -130,6 +130,19 @@ async function checkSystemHealth() {});}+ const crashing = processes.filter(p => (p.unstableRestarts || 0) > 0);+ if (crashing.length > 0) {+ const total = crashing.reduce((sum, p) => sum + (p.unstableRestarts || 0), 0);+ alerts.push({+ type: 'process_error',+ severity: 'high',+ title: `${crashing.length} process${crashing.length > 1 ? 'es' : ''} in crash loop`,+ detail: `${total} crash-loop restart${total === 1 ? '' : 's'}: ${crashing.map(p => p.name).join(', ')}`,+ link: '/apps',+ metadata: { unstableRestarts: total, names: crashing.map(p => p.name) }+ });+ }+return alerts;}