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
address review (round 23): guard SSE res.end() against destroyed socket
Adam Eivydc4cdadf5764
diff --git a/server/routes/ask.js b/server/routes/ask.jsindex 6c7736be64..c20c344e57 100644--- a/server/routes/ask.js+++ b/server/routes/ask.js@@ -254,7 +254,10 @@ router.post('/', asyncHandler(async (req, res) => {await send('error', { error: err?.message || 'internal error' }).catch(() => {});} finally {req.off('close', onClose);- if (!res.writableEnded) res.end();+ // Guard both `writableEnded` AND `destroyed` — if the client disconnected+ // mid-stream the underlying socket may already be torn down, and calling+ // `res.end()` on a destroyed stream throws an unhandled write error.+ if (!res.writableEnded && !res.destroyed) res.end();}}));