Browser-based graphical shell and control plane for a Linux server you own — real terminal, file manager, live metrics and BYOK AI in one mobile-first workspace. Next.js 16 · React 19 · node-pty · Tailwind v4 · shadcn/ui. Public alpha, self-hosted.
TypeScript browser-shellcontrol-planefile-managerhomelabmobile-firstnextjsptyreactself-hostedserver-managementshadcn-uisysadmintailwindcssterminaltypescriptvpsweb-desktopweb-terminal
fix(release): wait for HTTP readiness before validating served assets
Rahman9e2966b8a296
diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.mdindex 1464848a..2d0e862d 100644--- a/docs/CHANGELOG.md+++ b/docs/CHANGELOG.md@@ -12,6 +12,7 @@ this is the *what*, and it is what Settings → About shows as “What's new”.**Fixed**+- `release` wait for HTTP readiness before validating served assets- `mcp` initialize page previews and verify embedded app readiness## 2026-09-04diff --git a/docs/INTEGRATIONS.md b/docs/INTEGRATIONS.mdindex 249c40c8..fb226cf1 100644--- a/docs/INTEGRATIONS.md+++ b/docs/INTEGRATIONS.md@@ -98,3 +98,10 @@ owner-only store permissions, and MCP output separation. Browser fixtures coverdesktop/mobile Page rendering, standards-bridge initialization, failed validationand retry, input clearing, no owner cookies, and no credential in host messages.Real provider authentication still requires the user's own valid credential.++### Deployment verification++The service release lifecycle waits for the root HTTP endpoint after observing a+replacement systemd process, then verifies every referenced JS/CSS asset. A new+process alone is not HTTP readiness. The bounded wait does not waive missing+chunks, incorrect MIME types, or fallback-runtime restoration requirements.diff --git a/scripts/check-served-assets.mjs b/scripts/check-served-assets.mjsindex 9a8fb23a..f3291da0 100755--- a/scripts/check-served-assets.mjs+++ b/scripts/check-served-assets.mjs@@ -1,8 +1,12 @@#!/usr/bin/env node-import { verifyServedStaticAssets } from "./lib/served-assets.mjs";+import { verifyServedStaticAssets, waitForServedRoot } from "./lib/served-assets.mjs";const base = process.argv[2] || "http://127.0.0.1:4005";try {+ if (process.argv[3] !== undefined) {+ if (process.argv[3] !== "--wait-ms" || process.argv.length !== 5) throw new Error("usage: check-served-assets.mjs [origin] [--wait-ms 1..60000]");+ await waitForServedRoot(base, Number(process.argv[4]));+ }const result = await verifyServedStaticAssets(base);console.log(`asset graph OK: ${result.assetCount} referenced JS/CSS assets`);} catch (error) {diff --git a/scripts/lib/served-assets.mjs b/scripts/lib/served-assets.mjsindex c61fb4fe..0e5a1a82 100644--- a/scripts/lib/served-assets.mjs+++ b/scripts/lib/served-assets.mjs@@ -41,3 +41,25 @@ export async function verifyServedStaticAssets(baseUrl) {}return { assetCount: assets.length, assets };}++/** A new systemd MainPID does not imply that Next has started listening yet. */+export async function waitForServedRoot(baseUrl, timeoutMs = 30_000, retryDelayMs = 250) {+ if (!Number.isInteger(timeoutMs) || timeoutMs < 1 || timeoutMs > 60_000 ||+ !Number.isInteger(retryDelayMs) || retryDelayMs < 1 || retryDelayMs > 1_000) {+ throw new Error("HTTP readiness requires a bounded timeout (1..60000ms) and retry delay (1..1000ms)");+ }+ const base = new URL(baseUrl.endsWith("/") ? baseUrl : `${baseUrl}/`);+ if (!["http:", "https:"].includes(base.protocol)) throw new Error("HTTP readiness requires http or https");+ const deadline = Date.now() + timeoutMs;+ while (Date.now() < deadline) {+ try {+ const response = await fetch(base, { cache: "no-store", signal: AbortSignal.timeout(Math.max(1, Math.min(8_000, deadline - Date.now()))) });+ const ready = response.ok;+ await response.body?.cancel();+ if (ready) return;+ } catch { /* Cold start / connection refusal: retry only within the deadline. */ }+ const remaining = deadline - Date.now();+ if (remaining > 0) await new Promise(resolve => setTimeout(resolve, Math.min(retryDelayMs, remaining)));+ }+ throw new Error(`root HTTP did not become ready within ${timeoutMs}ms`);+}diff --git a/scripts/self-update.sh b/scripts/self-update.shindex 75b05ab3..d15a4bb6 100755--- a/scripts/self-update.sh+++ b/scripts/self-update.sh@@ -159,7 +159,9 @@ SERVICE_PORT="$(systemctl show -p Environment --value mso.service 2>/dev/null \| tr ' ' '\n' | sed -n 's/^PORT=//p' | head -1)"PORT="${PORT:-${SERVICE_PORT:-4005}}"ASSET_BASE="http://127.0.0.1:$PORT"-node scripts/check-served-assets.mjs "$ASSET_BASE" \+# MainPID becomes active before Next binds its socket. Wait for HTTP first, then+# still verify every asset; a broken asset graph must never be treated as ready.+node scripts/check-served-assets.mjs "$ASSET_BASE" --wait-ms 30000 \|| die "served static asset graph is inconsistent after replacement; use the supported MSO deploy/rebuild lifecycle and inspect ~/.mso/self-update.log"step "inner update stage complete — now at $(git rev-parse --short HEAD)"diff --git a/scripts/served-assets.test.ts b/scripts/served-assets.test.tsindex 4f3ddbbb..c10100e2 100644--- a/scripts/served-assets.test.ts+++ b/scripts/served-assets.test.ts@@ -1,13 +1,14 @@import { createServer, type Server } from "node:http";import { afterEach, describe, expect, it } from "vitest";-import { referencedStaticAssets, verifyServedStaticAssets } from "./lib/served-assets.mjs";+import { referencedStaticAssets, verifyServedStaticAssets, waitForServedRoot } from "./lib/served-assets.mjs";let server: Server | undefined;afterEach(async () => { if (server) await new Promise<void>((resolve) => server!.close(() => resolve())); server = undefined; });-async function serve(bad = false) {+async function serve(bad = false, rootFailures = 0) {server = createServer((req, res) => {if (req.url === "/") {+ if (rootFailures-- > 0) { res.statusCode = 503; res.end("starting"); return; }res.setHeader("content-type", "text/html");res.end('<script src="/_next/static/chunks/a.js"></script><link rel="stylesheet" href="/_next/static/css/b.css"><script src="/_next/static/chunks/a.js"></script>');return;@@ -34,4 +35,21 @@ describe("served Next asset graph", () => {it("fails on the exact 500 text/plain chunk class that breaks the shell", async () => {const base = await serve(true); await expect(verifyServedStaticAssets(base)).rejects.toThrow(/a\.js: 500 text\/plain/);});+ it("waits through cold-start HTTP failures before checking the complete graph", async () => {+ const base = await serve(false, 2);+ await waitForServedRoot(base, 1_000, 5);+ await expect(verifyServedStaticAssets(base)).resolves.toMatchObject({ assetCount: 2 });+ });+ it("does not turn a broken asset into success after HTTP becomes ready", async () => {+ const base = await serve(true, 1);+ await waitForServedRoot(base, 1_000, 5);+ await expect(verifyServedStaticAssets(base)).rejects.toThrow(/asset graph mismatch/);+ });+ it("refuses endless readiness waits and times out a persistently unavailable root", async () => {+ const base = await serve(false, 1000);+ await expect(waitForServedRoot(base, 40, 5)).rejects.toThrow(/did not become ready/);+ await expect(waitForServedRoot(base, 0)).rejects.toThrow(/bounded timeout/);+ await expect(waitForServedRoot(base, 60001)).rejects.toThrow(/bounded timeout/);+ });+});