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): wait through systemd restart drain
Rahman32aa70df7da7
diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.mdindex 9164468a..fc81ceae 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` wait through systemd restart drain- `cli` diagnose HTTPS login and add doctor --fix- `mcp` validate browser origins- `security` avoid recovery guard fsync convoydiff --git a/docs/PROGRESS.md b/docs/PROGRESS.mdindex 52103fe6..5da20313 100644--- a/docs/PROGRESS.md+++ b/docs/PROGRESS.md@@ -2,9 +2,9 @@Running log of what shipped each phase. Newest at top.-## 2026-08-31 — MSO terminal agent + provider-backed deployment setup — DONE IN SOURCE+## 2026-08-31 — MSO terminal agent + provider-backed deployment setup — SHIPPED-**Source milestone — ship only after the exact commit passes the repository/security gates and the live health SHA matches.** The standalone deployment-assistance pattern from `rahmanef63/si-coder-agent` is now absorbed into MSO's own architecture instead of spawning a second agent runtime. Installed Hermes and its public CLI were used as interaction references only; MSO has original terminal artwork, its own tool catalog, and its existing auth/audit model.+**Shipped milestone.** The release passed the repository/security gates and the live health endpoint returned the release build SHA before this status was promoted. The standalone deployment-assistance pattern from `rahmanef63/si-coder-agent` is now absorbed into MSO's own architecture instead of spawning a second agent runtime. Installed Hermes and its public CLI were used as interaction references only; MSO has original terminal artwork, its own tool catalog, and its existing auth/audit model.What changed:@@ -20,7 +20,7 @@ What changed:- official `mso-project-deploy` skill documents workflow start → inspect → provider doctor → bounded deployment/DNS operations → runtime/HTTPS verification → finish/cancel;- CLI version for this interaction milestone is **1.5.0**. `docs/INFRASTRUCTURE-PROVIDERS.md`, architecture/install/MCP/ChatGPT connector docs, generated CLI reference and slice catalog are synchronized.-Verification added specifically for this slice covers provider-store symlink/permission/secret behavior, Cloudflare one-record semantics, Hostinger exact RR-set payloads, Owner-only agent/provider routes, exact-payload terminal approval, CLI onboarding/update fixtures, MCP parity/rate limits, and documentation/toolset markers. The final full repository gate passes with **249 test files / 1,901 passing tests** (1 expected fail, 4 skipped), typecheck and dependency audit green, zero value cycles, and zero lint errors (three pre-existing max-lines warnings remain). A targeted Codex Security pass first found two Medium issues in the new infrastructure surface — whole-response buffering before its nominal 1 MiB cap and a stale full-zone Hostinger PUT. Both were fixed; the final infrastructure re-scan completed **1/1 component with 0 findings**. A separate terminal-agent scan found one Medium issue where a truncated approval preview could conceal mutation fields. The terminal now renders the complete canonical tool name + nested input, refuses approval payloads above 32 KiB, removes session-wide mutation grants, and binds the approval SHA-256 to the exact payload that the server independently re-hashes before dispatch; the final terminal-agent re-scan completed **1/1 component with 0 findings**. A parallel-suite-only lifecycle harness race was also removed by holding the fixture lock until the assertion explicitly releases it; the lifecycle file then passed 5 consecutive runs (40/40 checks). Live Dokploy/Cloudflare/Hostinger API success is intentionally not claimed until an owner supplies credentials and `mso provider doctor` checks that provider.+Verification added specifically for this slice covers provider-store symlink/permission/secret behavior, Cloudflare one-record semantics, Hostinger exact RR-set payloads, Owner-only agent/provider routes, exact-payload terminal approval, CLI onboarding/update fixtures, MCP parity/rate limits, and documentation/toolset markers. The final full repository gate passes with **250 test files / 1,903 passing tests** (1 expected fail, 4 skipped), typecheck and dependency audit green, zero value cycles, and zero lint errors (three pre-existing max-lines warnings remain). A targeted Codex Security pass first found two Medium issues in the new infrastructure surface — whole-response buffering before its nominal 1 MiB cap and a stale full-zone Hostinger PUT. Both were fixed; the final infrastructure re-scan completed **1/1 component with 0 findings**. A separate terminal-agent scan found one Medium issue where a truncated approval preview could conceal mutation fields. The terminal now renders the complete canonical tool name + nested input, refuses approval payloads above 32 KiB, removes session-wide mutation grants, and binds the approval SHA-256 to the exact payload that the server independently re-hashes before dispatch; the final terminal-agent re-scan completed **1/1 component with 0 findings**. A parallel-suite-only lifecycle harness race was also removed by holding the fixture lock until the assertion explicitly releases it; the lifecycle file then passed 5 consecutive runs (40/40 checks). The first production handoff also exposed a release-verification false negative: the system unit can spend close to its 90 s `TimeoutStopSec` draining the old npm/Next control group, while the finalizer only waited 40 s for a new MainPID. Production still reached the gated release SHA, and the verifier now uses a bounded 120 s default restart budget (override constrained to 30–300 s) so a valid slow systemd restart is not reported as rollback. Live Dokploy/Cloudflare/Hostinger API success is intentionally not claimed until an owner supplies credentials and `mso provider doctor` checks that provider.## 2026-08-31 — Login-origin diagnosis + `mso doctor --fix` + runtime hardening (SHIPPED)diff --git a/scripts/self-update-restart-wait.test.ts b/scripts/self-update-restart-wait.test.tsnew file mode 100644index 00000000..78ceb3ee--- /dev/null+++ b/scripts/self-update-restart-wait.test.ts@@ -0,0 +1,19 @@+import fs from "node:fs";+import path from "node:path";+import { describe, expect, it } from "vitest";++const source = fs.readFileSync(path.join(process.cwd(), "scripts/self-update.sh"), "utf8");++describe("self-update service restart verification budget", () => {+ it("waits long enough for a normal systemd TimeoutStopSec + RestartSec cycle", () => {+ expect(source).toContain('MSO_SERVICE_RESTART_WAIT_SECONDS:-120');+ expect(source).toContain('RESTART_DEADLINE=$((SECONDS + RESTART_WAIT_SECONDS))');+ expect(source).toContain('[ "$RESTART_WAIT_SECONDS" -ge 30 ]');+ expect(source).toContain('[ "$RESTART_WAIT_SECONDS" -le 300 ]');+ expect(source).not.toContain("for _ in $(seq 1 40); do\n CANDIDATE=");+ });++ it("reports timeout as an unverified release instead of claiming rollback", () => {+ expect(source).toContain("release state is unverified — inspect the system unit before retrying");+ });+});diff --git a/scripts/self-update.sh b/scripts/self-update.shindex d32d59b1..c91c643d 100755--- a/scripts/self-update.sh+++ b/scripts/self-update.sh@@ -47,18 +47,20 @@ HEAD_SHA="$(git rev-parse HEAD 2>/dev/null || true)"[ -n "$HEAD_SHA" ] || die "could not read checkout HEAD"CURRENT_BRANCH="$(git branch --show-current 2>/dev/null || true)"[ "$CURRENT_BRANCH" = main ] || die "updates require checkout to be on main (current: ${CURRENT_BRANCH:-detached HEAD})"-printf 'at %s-' "${HEAD_SHA:0:7}"+printf 'at %s\n' "${HEAD_SHA:0:7}"if [ "$SHIP_FINALIZE" -eq 1 ]; thenEXPECTED_SHA="${MSO_EXPECTED_SHA:-}"- [ "${#EXPECTED_SHA}" -eq 40 ] || die "ship finalizer requires an exact 40-character MSO_EXPECTED_SHA"+ [ "${#EXPECTED_SHA}" -eq 40 ] \+ || die "ship finalizer requires an exact 40-character MSO_EXPECTED_SHA"case "$EXPECTED_SHA" in*[!0-9a-f]*) die "ship finalizer requires an exact 40-character MSO_EXPECTED_SHA" ;;esac[ "$HEAD_SHA" = "$EXPECTED_SHA" ] || die "checkout HEAD changed after the release gates"- [ "$(git rev-parse origin/main 2>/dev/null || true)" = "$EXPECTED_SHA" ] || die "origin/main no longer matches the release SHA"- [ -z "$(git status --porcelain)" ] || die "checkout changed after verification; refusing to build uncommitted bytes"+ [ "$(git rev-parse origin/main 2>/dev/null || true)" = "$EXPECTED_SHA" ] \+ || die "origin/main no longer matches the release SHA"+ [ -z "$(git status --porcelain)" ] \+ || die "checkout changed after verification; refusing to build uncommitted bytes"fiif [ "$REBUILD_ONLY" -eq 0 ]; then@@ -88,7 +90,8 @@ fiif [ "$SHIP_FINALIZE" -eq 1 ]; thenstep "using the exact commit already proven by the pre-push out-of-tree build"- [ "$(git rev-parse HEAD)" = "$EXPECTED_SHA" ] && [ -z "$(git status --porcelain)" ] || die "checkout moved before the in-place build"+ [ "$(git rev-parse HEAD)" = "$EXPECTED_SHA" ] && [ -z "$(git status --porcelain)" ] \+ || die "checkout moved before the in-place build"elsestep "verifying the build out-of-tree (this does not touch the live .next)"bash scripts/verify-build.sh >/dev/null || die "HEAD does not compile — nothing was deployed"@@ -116,8 +119,22 @@ PID_UID="$(stat -c %u "/proc/$OLD_PID" 2>/dev/null || true)"[ "$PID_UID" = "$SELF_UID" ] || die "mso.service MainPID $OLD_PID belongs to uid ${PID_UID:-unknown}, not $SELF_UID"kill -TERM "$OLD_PID" || die "could not signal mso.service MainPID $OLD_PID"+# A system service can legitimately spend close to TimeoutStopSec draining the old+# control group before Restart=always creates the replacement. The installed MSO+# unit currently inherits systemd's 90 s TimeoutStopSec; the old fixed 40 s loop+# could therefore declare failure while systemd was still correctly stopping the+# old Next/npm process, then the new service would appear seconds later. Keep a+# bounded but realistic verification budget. The override is intentionally narrow+# (30..300 s) so a typo cannot make the release finalizer hang forever.+RESTART_WAIT_SECONDS="${MSO_SERVICE_RESTART_WAIT_SECONDS:-120}"+case "$RESTART_WAIT_SECONDS" in+ ""|*[!0-9]*) die "MSO_SERVICE_RESTART_WAIT_SECONDS must be an integer from 30 to 300" ;;+esac+[ "$RESTART_WAIT_SECONDS" -ge 30 ] && [ "$RESTART_WAIT_SECONDS" -le 300 ] \+ || die "MSO_SERVICE_RESTART_WAIT_SECONDS must be an integer from 30 to 300"+RESTART_DEADLINE=$((SECONDS + RESTART_WAIT_SECONDS))NEW_PID=""-for _ in $(seq 1 40); do+while [ "$SECONDS" -lt "$RESTART_DEADLINE" ]; doCANDIDATE="$(systemctl show -p MainPID --value mso.service 2>/dev/null || true)"case "$CANDIDATE" in""|*[!0-9]*) ;;@@ -130,8 +147,9 @@ for _ in $(seq 1 40); doesacsleep 1done-[ -n "$NEW_PID" ] || die "mso.service did not come back with a new MainPID"-printf 'restarted %s -> %s\n' "$OLD_PID" "$NEW_PID"+[ -n "$NEW_PID" ] \+ || die "mso.service did not return with a new MainPID within ${RESTART_WAIT_SECONDS}s; release state is unverified — inspect the system unit before retrying"+printf 'restarted %s -> %s after %ss\n' "$OLD_PID" "$NEW_PID" "$((RESTART_WAIT_SECONDS - (RESTART_DEADLINE - SECONDS)))"# The chunk-mismatch check CLAUDE.md warns about, verified rather than remembered —# the same check scripts/ship.sh ends with. `active` only means npm has started, not