From a7d4e210c24200729d59606475e85d28e08b19fe Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 12 Feb 2026 16:17:45 +0000 Subject: [PATCH] Auto-start stopped/errored apps on push activate Previously, pushing a new version would only restart apps that were already running. Apps in stopped or invalid state (e.g. due to a previous startup error) were left unchanged, requiring a manual start. Now the activate endpoint calls startApp() for stopped/invalid apps, so pushing a code fix automatically attempts to start the app. https://claude.ai/code/session_014UvBEvHbnhaoMLebdRFzm6 --- src/server/api/sync.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/server/api/sync.ts b/src/server/api/sync.ts index 2689503..2d99a44 100644 --- a/src/server/api/sync.ts +++ b/src/server/api/sync.ts @@ -1,4 +1,4 @@ -import { APPS_DIR, allApps, registerApp, removeApp, restartApp } from '$apps' +import { APPS_DIR, allApps, registerApp, removeApp, restartApp, startApp } from '$apps' import { computeHash, generateManifest } from '../sync' import { loadGitignore } from '@gitignore' import { cpSync, existsSync, mkdirSync, readdirSync, readFileSync, realpathSync, renameSync, rmSync, symlinkSync, unlinkSync, watch, writeFileSync } from 'fs' @@ -329,6 +329,9 @@ router.post('/apps/:app/activate', async c => { } catch (e) { return c.json({ error: `Failed to restart app: ${e instanceof Error ? e.message : String(e)}` }, 500) } + } else if (app.state === 'stopped' || app.state === 'invalid') { + // App not running (possibly due to error) - try to start it + startApp(appName) } return c.json({ ok: true })