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: fix CDP health check for bind-all hosts and init sync log before listen
Adam Eivy37007e2238d5
diff --git a/server/index.js b/server/index.jsindex 46d40dda6f..76eba9e286 100644--- a/server/index.js+++ b/server/index.js@@ -331,20 +331,28 @@ app.use((req, res) => {// Error middleware (must be last)app.use(errorMiddleware);-// Start server-httpServer.listen(PORT, HOST, () => {- console.log(`🚀 PortOS server running at http://${HOST}:${PORT}`);-- // Set up process error handlers with io instance- setupProcessErrorHandlers(io);-- // Initialize instance identity, sync log, backfill origin tags, start peer polling + sync- ensureSelf()- .then(() => initSyncLog())- .then(() => backfillOriginInstanceId())- .then(() => {- startPolling();- initSyncOrchestrator();- })- .catch(err => console.error(`❌ Instance init failed: ${err.message}`));-});+// Initialize instance identity + sync log before accepting requests to prevent+// race conditions where brain mutations arrive before the sync log is ready+ensureSelf()+ .then(() => initSyncLog())+ .then(() => {+ // Start server only after sync log is initialized+ httpServer.listen(PORT, HOST, () => {+ console.log(`🚀 PortOS server running at http://${HOST}:${PORT}`);++ // Set up process error handlers with io instance+ setupProcessErrorHandlers(io);++ // Backfill origin tags and start peer polling + sync (non-blocking)+ backfillOriginInstanceId()+ .then(() => {+ startPolling();+ initSyncOrchestrator();+ })+ .catch(err => console.error(`❌ Post-startup init failed: ${err.message}`));+ });+ })+ .catch(err => {+ console.error(`❌ Instance init failed: ${err.message}`);+ process.exit(1);+ });diff --git a/server/services/browserService.js b/server/services/browserService.jsindex c21ecab5f8..0125b53a5b 100644--- a/server/services/browserService.js+++ b/server/services/browserService.js@@ -63,7 +63,9 @@ export async function updateConfig(updates) {export async function getHealthStatus() {const config = await loadConfig();- const healthUrl = `http://${config.cdpHost}:${config.healthPort}/health`;+ // Bind-all addresses like 0.0.0.0 or :: are not connectable; use localhost instead+ const connectHost = (config.cdpHost === '0.0.0.0' || config.cdpHost === '::') ? '127.0.0.1' : config.cdpHost;+ const healthUrl = `http://${connectHost}:${config.healthPort}/health`;const controller = new AbortController();const timeout = setTimeout(() => controller.abort(), 3000);