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(doctor): respect no-systemd and remote runtimes
Rahmanfa60f4329bc7
diff --git a/bin/mso-doctor.test.ts b/bin/mso-doctor.test.tsindex 904c603d..95c64d57 100644--- a/bin/mso-doctor.test.ts+++ b/bin/mso-doctor.test.ts@@ -6,7 +6,7 @@ import { describe, expect, it } from "vitest";const CLI = path.join(__dirname, "mso");-function fixture() {+function fixture(manager: "active" | "unavailable" | "inactive" = "active") {const root = fs.mkdtempSync(path.join(os.tmpdir(), "mso-doctor-"));const bin = path.join(root, "bin");const envFile = path.join(root, ".env.local");@@ -19,6 +19,9 @@ function fixture() {fs.writeFileSync(store, JSON.stringify({ approved: {}, pending: { [device]: { label: "mso cli", firstSeen: 1, lastSeen: 1, ip: "127.0.0.1", attempts: 1 } } }));fs.writeFileSync(path.join(bin, "curl"), `#!/bin/shcase "$*" in+ *api/health*)+ [ "\${FAKE_HEALTH_DOWN:-0}" != 1 ] || exit 7+ if [ "\${FAKE_HEALTH_OTHER:-0}" = 1 ]; then body='{"status":"ok","service":"other"}'; else body='{"status":"ok","service":"mso"}'; fi ;;*api/auth/login*) body='{"success":true}' ;;*api/auth/me*) body='{"authenticated":true,"role":"owner"}' ;;*) body='{"status":"ok","service":"mso"}' ;;@@ -26,6 +29,14 @@ esaccase "$*" in *'-w '*) printf '%s\n200' "$body" ;; *) printf '%s' "$body" ;; esac`, { mode: 0o700 });fs.writeFileSync(path.join(bin, "systemctl"), `#!/bin/sh+printf '%s\n' "$*" >> '${root}/systemctl-calls.log'+if [ '${manager}' = unavailable ]; then+ printf '%s\n' 'System has not been booted with systemd as init system (PID 1)' >&2+ exit 1+fi+if [ '${manager}' = inactive ]; then+ case "$*" in *is-active*) exit 3 ;; esac+ficase "$*" in*'show -p WorkingDirectory --value mso.service'*) printf '%s\n' '${path.dirname(CLI)}' ;;*'show -p Environment --value mso.service'*) printf 'PORT=4005\n' ;;@@ -64,4 +75,47 @@ describe("mso doctor", () => {expect(parsed.pending[fx.device]).toBeUndefined();} finally { fs.rmSync(fx.root, { recursive: true, force: true }); }});+ it("accepts healthy no-systemd runtime without claiming a system service or exposing probe stderr", () => {+ const fx = fixture("unavailable");+ try {+ const result = spawnSync(CLI, ["doctor", "--fix"], { encoding: "utf8", env: fx.env });+ expect(result.status).toBe(0);+ expect(result.stdout).toContain("systemd manager unavailable");+ expect(result.stdout).not.toContain("FAIL service unit");+ expect(result.stderr).not.toContain("System has not been booted");+ const calls = fs.readFileSync(path.join(fx.root, "systemctl-calls.log"), "utf8");+ expect(calls).not.toMatch(/(?:^|\s)(?:start|restart|enable)(?:\s|$)/);+ } finally { fs.rmSync(fx.root, { recursive: true, force: true }); }+ });++ it("still reports an inactive service when a real systemd manager is available", () => {+ const fx = fixture("inactive");+ try {+ const result = spawnSync(CLI, ["doctor"], { encoding: "utf8", env: fx.env });+ expect(result.status).toBe(1);+ expect(result.stdout).toContain("FAIL service unit");+ } finally { fs.rmSync(fx.root, { recursive: true, force: true }); }+ });++ it("does not inspect this host's service manager for a remote HTTPS base", () => {+ const fx = fixture("unavailable");+ try {+ const result = spawnSync(CLI, ["--base", "https://mso.example.test", "doctor"], { encoding: "utf8", env: fx.env });+ expect(result.status).toBe(0);+ expect(result.stdout).toContain("service unit (skipped: --base is remote)");+ expect(fs.existsSync(path.join(fx.root, "systemctl-calls.log"))).toBe(false);+ } finally { fs.rmSync(fx.root, { recursive: true, force: true }); }+ });++ it.each(["FAKE_HEALTH_DOWN", "FAKE_HEALTH_OTHER"])("fails closed for an unhealthy no-systemd runtime: %s", (flag) => {+ const fx = fixture("unavailable");+ try {+ const result = spawnSync(CLI, ["doctor", "--fix"], { encoding: "utf8", env: { ...fx.env, [flag]: "1" } });+ expect(result.status).toBe(1);+ expect(result.stdout).toContain("FAIL reachable");+ expect(result.stdout).toContain("mso web --local --print");+ expect(result.stdout).not.toContain("FAIL service unit");+ } finally { fs.rmSync(fx.root, { recursive: true, force: true }); }+ });+});diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.mdindex 1abfcb54..779111ba 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**+- `doctor` respect no-systemd and remote runtimes- `hosted` restore updates and Hermes runtime- `update` recover no-systemd container installs- `installer` build node-pty reliably on Codespacesdiff --git a/docs/INSTALL.md b/docs/INSTALL.mdindex 1756ca32..e836aa82 100644--- a/docs/INSTALL.md+++ b/docs/INSTALL.md@@ -620,6 +620,28 @@ restore those fallbacks. `mso service start` and `mso service restart` take thecheckout lock and refuse while an offline update/deploy is mutating `.next`; they also refuse when theinstalled service belongs to another checkout.+### No-systemd and hosted workspaces++The presence of `systemctl` does not mean the host runs systemd. `mso doctor` checks+manager availability before diagnosing a system service; containers with a healthy+MSO runtime are not failures merely because PID 1 is tini or another supervisor.+The health check requires an actual MSO response, not an arbitrary HTTP 200. With+`--base` pointing at a remote server, doctor does not inspect or start local units.++Use `mso web --local --print` to recover an installed, built loopback runtime without+publishing it. `mso update` remains the update path; `mso service` and `mso deploy`+are for installations actually controlled by the corresponding systemd unit.+A detached process surviving a shell exit is not proof of restart persistence: wire+the local startup command into the platform's supported startup configuration and+verify a real workspace/container restart before claiming that guarantee.++Cursor's [environment setup](https://cursor.com/docs/cloud-agent/setup) separates+`install` (disk preparation) from `start`/`terminals` (per-run processes). Use the+existing environment's startup configuration rather than modifying Cursor's private+supervisor. Editor port forwarding is not by itself a verified public HTTPS origin.+Only register a replacement gateway after its health identity and authenticated MCP+work; keep the existing provider until that cutover is verified. See [Gateway](./GATEWAY.md).+### Developer releaseAfter code/docs changes and verification:diff --git a/docs/PROGRESS.md b/docs/PROGRESS.mdindex 3a9c5849..3943fe0d 100644--- a/docs/PROGRESS.md+++ b/docs/PROGRESS.md@@ -1,3 +1,7 @@+## 2026-09-17 — Doctor respects no-systemd and remote runtime boundaries++A live hosted/container audit reproduced a false `mso.service not active` failure while the loopback runtime, public HTTPS and authenticated CLI were healthy. Doctor now probes actual systemd manager availability before diagnosing its service and never inspects this machine's units for a remote `--base`. No-systemd hosts continue through the normal health/auth checks without suppressing real failures: health must be JSON identifying a healthy MSO service, and local probes bypass outbound proxy variables. `--fix` never creates a tunnel, adopts an external supervisor, or claims boot persistence. Added regressions for unavailable managers, inactive real services, remote bases, failed health and unrelated HTTP 200 responses; documented the hosted startup and verified-public-origin boundaries. This changes diagnosis only; no runtime, bind, provider, Node version or existing hosted Hermes/update behavior is replaced.+## 2026-09-17 — Gateway core becomes deployment/provider/supervisor agnosticRefactored the gateway reliability boundary without removing the existing Cloudflare lifecycle or process-ownership protections. The new read-only classifier separates local, public, provider and process health from ownership/supervisor state and reports `managed-running`, `external-running`, `degraded`, `recovering`, `stopped` or `unknown`. A configured public origin is healthy only when its structured MSO health identity matches the selected local runtime, including `buildSha` when present; this fixes the real case where a healthy externally supervised public route was previously displayed as stopped. Added `mso gateway status --json`, capability-based provider metadata, external duplicate-start protection, and provider-neutral non-mutating doctor diagnostics. Cloudflare remains the current managed/default adapter; external reverse proxies/tunnels are detected but never adopted, stopped or restarted. Existing PID/start-ticks/executable/argv/runtime-instance, atomic private state, update locks and recovery markers remain authoritative. No generic `gateway supervise` daemon was added because the current external-supervisor model already covers systemd/s6/container/Kubernetes/PaaS ownership without duplicating supervisor semantics. Added provider-neutral regression coverage and a dedicated `docs/GATEWAY.md` architecture/operations reference.diff --git a/scripts/cli/commands-host.sh b/scripts/cli/commands-host.shindex 2c922d73..3d155572 100755--- a/scripts/cli/commands-host.sh+++ b/scripts/cli/commands-host.sh@@ -114,7 +114,15 @@ case "$cmd" infails=$((fails+1))fi- if ! service_manager_read is-active --quiet mso.service 2>/dev/null; then+ local_runtime=0+ case "$B" in http://127.*:*|http://localhost:*|http://\[::1\]:*) local_runtime=1 ;; esac+ if [ "$local_runtime" = 0 ]; then+ echo " -- service unit (skipped: --base is remote)"+ elif ! service_manager_read show --property=Version --value >/dev/null 2>&1; then+ # A systemctl binary is not proof that this environment runs systemd.+ # Do not start/adopt an external supervisor; health below is authoritative.+ echo " -- service unit (systemd manager unavailable; runtime health checked below)"+ elif ! service_manager_read is-active --quiet mso.service 2>/dev/null; thenif [ "$fix" = 1 ] && service_manager_read show -p WorkingDirectory --value mso.service 2>/dev/null | grep -q .; thenif ( service_start_safe >/dev/null 2>&1 ); then fixed "service unit started"; else printf ' FAIL service unit — automatic start failed; run: mso service logs\n'; fails=$((fails+1)); fielse@@ -124,7 +132,13 @@ case "$cmd" inelseecho " ok service unit"fi- chk "reachable" "curl -fsS --max-time 5 '$B/api/health'" "nothing answering at $B"+ doctor_health_ok() {+ local direct=()+ [ "$local_runtime" = 0 ] || direct=(--noproxy '*')+ curl "${direct[@]}" -fsS --max-time 5 "$B/api/health" \+ | jq -e 'type == "object" and .status == "ok" and .service == "mso"' >/dev/null+ }+ chk "reachable" "doctor_health_ok" "no healthy MSO at $B; for local recovery run: mso web --local --print"d=$(cli_device); device_ready=0case "$B" in