Skip to content

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

fix: address round 12 review — stale lock re-check on status, fail-fast migrations

Adam Eivy611f727d0e9d
diff --git a/scripts/run-migrations.js b/scripts/run-migrations.js
index 560e59123a..b83b81123f 100644
--- a/scripts/run-migrations.js
+++ b/scripts/run-migrations.js
@@ -21,8 +21,14 @@ async function run() {
return null;
});
if (raw !== null) {
- try { applied = JSON.parse(raw); } catch { applied = []; }
- if (!Array.isArray(applied)) applied = [];
+ let parsed;
+ try { parsed = JSON.parse(raw); } catch (err) {
+ throw new Error(`Corrupted migrations file ${appliedFile} — fix or delete it manually: ${err.message}`);
+ }
+ if (!Array.isArray(parsed)) {
+ throw new Error(`Corrupted migrations file ${appliedFile} — expected array, got ${typeof parsed}`);
+ }
+ applied = parsed;
}
// Scan for migration files (*.js, sorted by filename)
diff --git a/server/routes/update.js b/server/routes/update.js
index 90282b604c..bbcf6a5f0f 100644
--- a/server/routes/update.js
+++ b/server/routes/update.js
@@ -11,8 +11,9 @@ const ignoreSchema = z.object({
version: z.string().min(1, 'version is required')
});
-// GET /api/update/status — returns update state
+// GET /api/update/status — returns update state (also clears stale locks)
router.get('/status', asyncHandler(async (req, res) => {
+ await updateChecker.clearStaleUpdateInProgress();
const status = await updateChecker.getUpdateStatus();
res.json(status);
}));