Self-improving AI Employees for everyone
Python ai-agentsai-employeeai-employeesassistantautonomous-agentsco-employeescompanygrok-botinstinctloop-agentsmuseown-your-datapersonalself-hosted
fix: start Temporal server before worker, worker retry on connect
trohitga1782473fdf8
diff --git a/scripts/dev.js b/scripts/dev.jsindex 0ec30b18..d76bfa86 100644--- a/scripts/dev.js+++ b/scripts/dev.js@@ -87,7 +87,10 @@ async function main() {}services.push(isDaemonMode ? 'npm:python:daemon' : 'npm:python:start');if (!skipWhatsApp) services.push('npm:whatsapp:api');- if (config.temporalEnabled) services.push('npm:temporal:worker');+ if (config.temporalEnabled) {+ services.push('npm:temporal:start');+ services.push('npm:temporal:worker');+ }// Ready-detection patterns for each serviceconst readyPatterns = [diff --git a/scripts/start.js b/scripts/start.jsindex cdbe3b94..38b2681c 100755--- a/scripts/start.js+++ b/scripts/start.js@@ -60,7 +60,10 @@ async function main() {services.push(`"node ${resolve(ROOT, 'scripts', 'serve-client.js').replace(/\\/g, '/')}"`);services.push((isWindows || isWSL) ? 'npm:python:start' : 'npm:python:daemon');if (!skipWhatsApp) services.push('npm:whatsapp:api');- if (config.temporalEnabled) services.push('npm:temporal:worker');+ if (config.temporalEnabled) {+ services.push('npm:temporal:start');+ services.push('npm:temporal:worker');+ }// Ready-detection patterns for each serviceconst readyPatterns = [@@ -113,7 +116,10 @@ async function main() {const serviceNames = ['client', 'server'];if (!skipWhatsApp) serviceNames.push('whatsapp');- if (config.temporalEnabled) serviceNames.push('temporal');+ if (config.temporalEnabled) {+ serviceNames.push('temporal-server');+ serviceNames.push('temporal-worker');+ }const proc = spawn('npx', ['concurrently', '--kill-others',diff --git a/server/services/temporal/worker.py b/server/services/temporal/worker.pyindex 25d4e3ec..b20e7e0f 100644--- a/server/services/temporal/worker.py+++ b/server/services/temporal/worker.py@@ -180,7 +180,23 @@ async def run_standalone_worker(# Use custom runtime with heartbeating disabled to avoid warning on older serversruntime = create_runtime()- client = await Client.connect(server_address, namespace=namespace, runtime=runtime)++ # Connect with retries (server may still be starting)+ client = None+ for attempt in range(1, 6):+ try:+ logger.info(f"Connecting to Temporal server (attempt {attempt}/5)")+ client = await Client.connect(server_address, namespace=namespace, runtime=runtime)+ logger.info("Connected to Temporal server")+ break+ except Exception as e:+ logger.warning(f"Temporal connection attempt {attempt}/5 failed: {e}")+ if attempt < 5:+ await asyncio.sleep(3.0)++ if client is None:+ logger.error(f"Could not connect to Temporal server at {server_address} after 5 attempts")+ return# Create shared session and activitiessession = await create_shared_session(pool_size)