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(update): emit success after runtime restore
Rahman38034542c1a7
diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.mdindex e9e37144..afc5fc91 100644--- a/docs/CHANGELOG.md+++ b/docs/CHANGELOG.md@@ -13,6 +13,7 @@ this is the *what*, and it is what Settings → About shows as “What's new”.**Fixed**+- `update` emit success after runtime restore- `update` serialize all checkout runtimes- `gateway` reject active named tunnel switches- `gateway` serialize runtime recovery and updatesdiff --git a/scripts/mso-service-update b/scripts/mso-service-updateindex 7ef771b3..d7c3d9c9 100755--- a/scripts/mso-service-update+++ b/scripts/mso-service-update@@ -8,6 +8,7 @@ UPDATE_STATE_DIR_REQUESTED="${MSO_UPDATE_STATE_DIR:-$HOME/.mso/private/update-stLOCAL_URL="${MSO_UPDATE_LOCAL_URL:-${MSO_GATEWAY_LOCAL_URL:-http://127.0.0.1:${MSO_PORT:-4005}}}"GATEWAY="$ROOT/scripts/mso-gateway"SELF_UPDATE="$ROOT/scripts/self-update.sh"+LOG="${MSO_UPDATE_LOG:-$HOME/.mso/self-update.log}"fail() { printf 'mso service update: %s\n' "$*" >&2; exit 1; }[ -x "$GATEWAY" ] || fail "missing gateway lifecycle helper: $GATEWAY"@@ -43,5 +44,8 @@ firuntime_exclusion_releaseupdate_gateway_restore_all+# Settings polls this exact marker. It belongs to the OUTER lifecycle, not the+# inner build/restart stage: fallback restoration is part of update success.+printf 'UPDATE OK\n' >>"$LOG" || fail "could not persist final update success marker"update_lock_releasetrap - EXIT HUP INT TERMdiff --git a/scripts/mso-service-update.test.ts b/scripts/mso-service-update.test.tsindex 459f839f..d0bb43c8 100644--- a/scripts/mso-service-update.test.ts+++ b/scripts/mso-service-update.test.ts@@ -24,7 +24,7 @@ function state(home: string, name: string, root: string, localUrl: string, runtifs.writeFileSync(path.join(dir, "state.json"), `${JSON.stringify({ root, localUrl, runtimeOwned })}\n`, { mode: 0o600 });}-function fixture(delayMs = 0) {+function fixture(delayMs = 0, failRestoreUrl = "") {const base = fs.mkdtempSync(path.join(os.tmpdir(), "mso-service-update-")); roots.push(base);const repo = path.join(base, "repo"), home = path.join(base, "home"), capture = path.join(base, "capture");fs.mkdirSync(path.join(repo, "scripts/lib"), { recursive: true }); fs.mkdirSync(home);@@ -33,7 +33,7 @@ function fixture(delayMs = 0) {fs.writeFileSync(path.join(repo, "scripts/mso-gateway"), `#!/bin/shprintf '%s %s\n' "$1" "\${MSO_GATEWAY_LOCAL_URL:-}" >> ${JSON.stringify(capture)}if [ "$1" = runtime-stop ]; then printf '1\n' > "$MSO_GATEWAY_RECOVERY_MARKER"; chmod 600 "$MSO_GATEWAY_RECOVERY_MARKER"; echo 'runtime: stopped-owned'; exit 0; fi-[ "$1" = local-start ] && exit 0+[ "$1" = local-start ] && { [ "${failRestoreUrl}" = "\${MSO_GATEWAY_LOCAL_URL:-}" ] && exit 31; exit 0; }exit 2`, { mode: 0o755 });fs.writeFileSync(path.join(repo, "scripts/self-update.sh"), `#!/bin/sh@@ -73,6 +73,23 @@ describe("service-active update lifecycle", () => {expect(calls.lastIndexOf("local-start")).toBeGreaterThan(calls.indexOf("self-end"));});+ it("writes UPDATE OK only after every fallback runtime has been restored", () => {+ const f = fixture(); execFileSync(WRAPPER, [], { env: f.env, encoding: "utf8" });+ const log = fs.readFileSync(path.join(f.env.HOME as string, ".mso/self-update.log"), "utf8");+ expect(log).toContain("UPDATE OK");+ const inner = fs.readFileSync(path.join(process.cwd(), "scripts/self-update.sh"), "utf8");+ expect(inner).not.toContain("printf 'UPDATE OK");+ });++ it("does not leave a success marker when fallback restoration fails", () => {+ const f = fixture(0, "http://127.0.0.1:4666");+ const out = spawnSync(WRAPPER, [], { env: f.env, encoding: "utf8" });+ expect(out.status).not.toBe(0);+ expect(out.stderr).toContain("fallback runtime restore failed");+ const log = path.join(f.env.HOME as string, ".mso/self-update.log");+ expect(fs.existsSync(log) ? fs.readFileSync(log, "utf8") : "").not.toContain("UPDATE OK");+ });+it("fails closed on a corrupt persisted gateway restore inventory", () => {const f = fixture();const key = createHash("sha256").update(fs.realpathSync(f.repo)).digest("hex");diff --git a/scripts/self-update.sh b/scripts/self-update.shindex 60754668..2913641e 100755--- a/scripts/self-update.sh+++ b/scripts/self-update.sh@@ -147,5 +147,5 @@ case "$TYPE" in*) die "chunk mismatch: $CSS served as '${TYPE:-nothing}'. Recover with: rm -rf .next && bun run build && sudo systemctl restart mso.service" ;;esac-step "done — now at $(git rev-parse --short HEAD)"-printf 'UPDATE OK\n'+step "inner update stage complete — now at $(git rev-parse --short HEAD)"+printf 'INNER STAGE COMPLETE\n'