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(cli): make updates visible and idempotent
Rahmanf57b00de3b9d
diff --git a/bin/mso b/bin/msoindex bfafca13..8b58ddbc 100755--- a/bin/mso+++ b/bin/mso@@ -126,7 +126,7 @@# Docs: https://github.com/rahmanef63/msoset -euo pipefail-VERSION="1.5.1"+VERSION="1.5.2"ROOT="$(cd "$(dirname "$(readlink -f "$0")")/.." && pwd)"die() { echo "mso: $*" >&2; exit 1; }diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.mdindex 0ea8c880..bd3f6a04 100644--- a/docs/CHANGELOG.md+++ b/docs/CHANGELOG.md@@ -15,6 +15,7 @@ this is the *what*, and it is what Settings → About shows as “What's new”.**Fixed**+- `cli` make updates visible and idempotent- `mcp` preserve app-only workflow status schema## 2026-08-31diff --git a/docs/PROGRESS.md b/docs/PROGRESS.mdindex 61feace4..8e31b112 100644--- a/docs/PROGRESS.md+++ b/docs/PROGRESS.md@@ -20,9 +20,10 @@ What changed:- official `mso-project-deploy` skill documents workflow start → inspect → provider doctor → bounded deployment/DNS operations → runtime/HTTPS verification → finish/cancel;- MSO Agent slash skills are now executable: `/<skill>` selects a trusted global/current-project skill for the next message, `/<skill> <prompt>` runs immediately, `/skill <exact-id>` resolves cross-project ambiguity, and Tab completion only offers skills valid in the current scope; project skills follow the terminal working directory while untrusted instructions remain withheld;- terminal title art now uses a stable two-space gutter so the blue MSO icon is not flush against the terminal edge;-- CLI version for this interaction milestone is **1.5.1**. `docs/INFRASTRUCTURE-PROVIDERS.md`, architecture/install/MCP/ChatGPT connector docs, generated CLI reference and slice catalog are synchronized.+- `mso update` now short-circuits when source and active runtime already match, avoiding redundant production rebuilds; when a real service update is needed, an interactive terminal waits and prints update milestones until the new runtime is verified instead of immediately returning with only a log hint;+- CLI version for this interaction milestone is **1.5.2**. `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 **252 test files / 1,911 passing tests** (1 expected fail, 4 skipped), typecheck and dependency audit green, zero value cycles, and zero lint errors (six 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.+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 **252 test files / 1,912 passing tests** (1 expected fail, 4 skipped), typecheck and dependency audit green, zero value cycles, and zero lint errors (six 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/mso-update b/scripts/mso-updateindex 250266ea..c719993a 100755--- a/scripts/mso-update+++ b/scripts/mso-update@@ -192,17 +192,78 @@ offline_build() {update_with_lock offline_build_locked "$1"}+service_source_matches_runtime() {+ local relation ahead behind head running_sha+ fetch_main+ read -r relation ahead behind < <(update_git_relation "$ROOT") || fail "could not compare HEAD with origin/main"+ [ "$relation" = exact ] || return 1+ head="$(git -C "$ROOT" rev-parse HEAD)"+ running_sha="$(service_build_sha 2>/dev/null || true)"+ [ -n "$running_sha" ] && [[ "$head" = "$running_sha"* ]]+}++update_unit_active() {+ local state+ state="$(systemctl --user show -p ActiveState --value mso-self-update.service 2>/dev/null || true)"+ case "$state" in activating|active|reloading|deactivating) return 0 ;; *) return 1 ;; esac+}++update_stage() {+ [ -f "$LOG" ] || return 0+ sed -n 's/^\[[^]]*\] == / • /p' "$LOG" | tail -1+}++wait_for_service_update() {+ local last='' stage='' loops=0 max_loops=1800+ printf 'Updating MSO…\n'+ while update_unit_active; do+ stage="$(update_stage)"+ if [ -n "$stage" ] && [ "$stage" != "$last" ]; then+ printf '%s\n' "$stage"+ last="$stage"+ fi+ sleep 1+ loops=$((loops + 1))+ [ "$loops" -lt "$max_loops" ] || fail "update is still running after 30 minutes; inspect: mso update log"+ done+ if ! grep -qx 'UPDATE OK' "$LOG" 2>/dev/null; then+ tail -n 40 "$LOG" 2>/dev/null || true+ fail "update did not finish successfully; inspect: mso update log"+ fi+ local head running version+ head="$(git -C "$ROOT" rev-parse HEAD)"+ running="$(service_build_sha 5 2>/dev/null || true)"+ version="$(current_version)"+ if [ -n "$running" ] && [[ "$head" = "$running"* ]]; then+ printf '✓ MSO %s is ready (%s)\n' "${version:-unknown}" "${head:0:7}"+ else+ printf '✓ update finished; verifying runtime may take a moment. Check: mso update status\n'+ fi+}+run_update() {local rebuild_only="$1" arg=""require_checkout[ "$rebuild_only" != 1 ] || arg="--rebuild-only"if service_is_active; thenrequire_service_checkout+ if [ "$rebuild_only" != 1 ] && service_source_matches_runtime; then+ printf 'mso %s is already up to date (%s); no rebuild needed.\n' "$(current_version)" "$(git -C "$ROOT" rev-parse --short HEAD)"+ return 0+ fiif command -v systemd-run >/dev/null 2>&1 && systemctl --user show-environment >/dev/null 2>&1; thenmkdir -p "$(dirname "$LOG")"; chmod 700 "$(dirname "$LOG")" 2>/dev/null || true- systemd-run --user --collect --unit=mso-self-update --property=TimeoutStartSec=3600 \- "--property=WorkingDirectory=$ROOT" "--setenv=MSO_UPDATE_LOG=$LOG" /bin/bash "$ROOT/scripts/mso-service-update" $arg >/dev/null- printf 'update started safely outside mso.service. Follow: mso update log\n'+ if update_unit_active; then+ printf 'an MSO update is already running.\n'+ else+ systemd-run --user --collect --unit=mso-self-update --property=TimeoutStartSec=3600 \+ "--property=WorkingDirectory=$ROOT" "--setenv=MSO_UPDATE_LOG=$LOG" /bin/bash "$ROOT/scripts/mso-service-update" $arg >/dev/null+ fi+ if [ -t 1 ]; then+ wait_for_service_update+ else+ printf 'update started safely outside mso.service. Follow: mso update log\n'+ fielse/bin/bash "$ROOT/scripts/mso-service-update" $argtail -n 30 "$LOG" 2>/dev/null || truediff --git a/scripts/mso-update.test.ts b/scripts/mso-update.test.tsindex 35c5bc1a..97338c44 100644--- a/scripts/mso-update.test.ts+++ b/scripts/mso-update.test.ts@@ -12,7 +12,7 @@ const UPDATE_GATEWAYS = path.join(process.cwd(), "scripts/lib/update-gateway-runconst SERVICE_UPDATE = path.join(process.cwd(), "scripts/mso-service-update");const roots: string[] = [];function git(cwd: string, ...args: string[]) { return execFileSync("git", args, { cwd, encoding: "utf8" }).trim(); }-function fixture(options: { failInstallOnce?: boolean; activeService?: "same" | "other"; installDelayMs?: number } = {}) {+function fixture(options: { failInstallOnce?: boolean; activeService?: "same" | "other"; installDelayMs?: number; serviceBuild?: "old" | "newer" } = {}) {const root = fs.mkdtempSync(path.join(os.tmpdir(), "mso-update-")); roots.push(root);const repo = path.join(root, "repo"), remote = path.join(root, "remote.git"), bin = path.join(root, "bin"), capture = path.join(root, "capture");fs.mkdirSync(path.join(repo, "scripts/lib"), { recursive: true }); fs.mkdirSync(path.join(repo, "bin")); fs.mkdirSync(bin);@@ -60,6 +60,10 @@ if [ "$1" = show ]; then printf '%s\n' "${serviceRoot}"; exit 0; fiif [ "$1" = --user ]; then exit 1; fiexit 3`, { mode: 0o755 });+ if (options.serviceBuild) {+ const build = options.serviceBuild === "newer" ? newer.slice(0, 7) : old.slice(0, 7);+ fs.writeFileSync(path.join(bin, "curl"), `#!/bin/sh\nprintf '%s\n' '{"status":"ok","service":"mso","buildSha":"${build}"}'\n`, { mode: 0o755 });+ }const failOnce = path.join(root, "fail-install-once");fs.writeFileSync(path.join(bin, "bun"), `#!/bin/shprintf 'bun %s\\n' "$*" >> "${capture}"@@ -129,6 +133,16 @@ describe("mso update without a running web API", () => {expect(calls).not.toContain("node node_modules/next/dist/bin/next build");});++ it("does not launch a redundant service rebuild when source and runtime already match", () => {+ const f = fixture({ activeService: "same", serviceBuild: "newer" });+ git(f.repo, "reset", "--hard", "-q", f.newer);+ const out = execFileSync(SCRIPT, [], { env: f.env, encoding: "utf8" });+ expect(out).toContain("is already up to date");+ expect(out).toContain("no rebuild needed");+ expect(fs.existsSync(f.capture)).toBe(false);+ });+it("refuses update handoff when the active mso.service belongs to another checkout", () => {const f = fixture({ activeService: "other" });const out = require("node:child_process").spawnSync(SCRIPT, [], { env: f.env, encoding: "utf8" });