diff --git a/scripts/comfy-host-agent.mjs b/scripts/comfy-host-agent.mjs index 27cc001..88b9634 100644 --- a/scripts/comfy-host-agent.mjs +++ b/scripts/comfy-host-agent.mjs @@ -470,6 +470,8 @@ async function maybeIdleStop(healthyPort) { const killed = await stopComfyProcesses() stoppedByAgent = true lastQueueRunning = 0 + lastHealthyPort = 0 + lastProcessUp = false console.log(JSON.stringify({ src: 'comfy-host-agent', event: 'stopped', reason: 'idle', killed })) } @@ -614,6 +616,7 @@ const server = http.createServer(async (req, res) => { return json(res, 200, { ok: true, started: false, already: true, booting: true, asleep: false }) } await taskkillImage('Comfy Desktop.exe') + stoppedByAgent = false const launched = await startComfy() if (launched.port) { lastProcessUp = true diff --git a/server/utils/comfyLifecycle.ts b/server/utils/comfyLifecycle.ts index 73e014c..8f67b33 100644 --- a/server/utils/comfyLifecycle.ts +++ b/server/utils/comfyLifecycle.ts @@ -350,13 +350,7 @@ async function ensureUnlocked(onStatus: StatusFn, skipBusyWait = false) { onStatus({ state: 'online', message: 'ComfyUI online', host: proxyUrl, processRunning: true }) return } - } - if (remote?.http) { - const localPort = remote.port ? ` Port ${remote.port} is healthy on the desktop.` : '' - throw createError({ - statusCode: 503, - statusMessage: `Comfy is running on the desktop but this server cannot reach ${host}.${localPort} Check COMFY_HOST / the LAN proxy.` - }) + log('http-fail-proxy', { host: proxyUrl, localPort: remote.port || null }) } const running = await processRunning() if (running) {