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: preserve home-relative stores and prove tunnel rollback completion
Rahmandd9218365ada
diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.mdindex 0f72dbbd..dee9e1be 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**+- preserve home-relative stores and prove tunnel rollback completion- `security` verify exact branch dispositions and narrow message origins- `security` retain artifact-lock compatibility and require fresh scan evidence- `security` pin store paths and eliminate unsafe file-read patternsdiff --git a/docs/PROGRESS.md b/docs/PROGRESS.mdindex e96706f1..3bbd522d 100644--- a/docs/PROGRESS.md+++ b/docs/PROGRESS.md@@ -1,3 +1,7 @@+## 2026-09-05 — Close final release review regressions++The documented `~/` store override now expands consistently in the shared server/CLI helper before locking, reading or writing; an end-to-end device test proves both interfaces mutate the same private store. A hosted rollback failure was reproduced deterministically by changing a newly spawned tunnel process title before durable state write. Gateway startup now keeps the original PID/start-ticks handshake until commit, uses it for failed-start rollback, treats zombie processes as stopped, and confirms termination instead of assuming SIGKILL delivery. No assertions were weakened or scanners disabled.+## 2026-09-05 — Scope the final security evidence to the scanned revisionThe inventory can now inspect the exact scanned branch after SARIF processing, distinguishes open findings from pre-existing reviewed/closed findings, and rejects a concurrent HEAD change. Reports stream to Actions logs rather than writing remote API content back to files. A newly merged MCP browser fixture now targets the exact widget origin instead of a wildcard; the 17 browser assertions retain their negative-navigation checks. No scanner rule, authentication boundary, or existing disposition is removed by this change.diff --git a/lib/a2a/credentials-inbound.ts b/lib/a2a/credentials-inbound.tsindex 796961ec..689c109a 100644--- a/lib/a2a/credentials-inbound.ts+++ b/lib/a2a/credentials-inbound.ts@@ -1,3 +1,4 @@+import { expandOwnerStorePath } from "@/lib/owner-store-path.js";import {createHash,randomBytes,@@ -17,8 +18,8 @@ import {} from "./credential-private-store";export const A2A_INBOUND_TOKEN_STORE_PATH =- process.env.OS_A2A_INBOUND_TOKEN_STORE ??- path.join(os.homedir(), ".mso", "private", "a2a-inbound-tokens.json");+ expandOwnerStorePath(process.env.OS_A2A_INBOUND_TOKEN_STORE ??+ path.join(os.homedir(), ".mso", "private", "a2a-inbound-tokens.json"));type InboundRecord = A2AInboundTokenSummary & { secretHash: string };type InboundStore = { version: 1; tokens: InboundRecord[] };const isStore = (value: unknown): value is InboundStore =>diff --git a/lib/a2a/credentials-outbound.ts b/lib/a2a/credentials-outbound.tsindex 11c59b58..2e47aa6c 100644--- a/lib/a2a/credentials-outbound.ts+++ b/lib/a2a/credentials-outbound.ts@@ -1,3 +1,4 @@+import { expandOwnerStorePath } from "@/lib/owner-store-path.js";import os from "node:os";import path from "node:path";import { randomUUID } from "node:crypto";@@ -13,8 +14,8 @@ import {const MAX_SECRET_BYTES = 16 * 1024;const HEADER_RE = /^[!#$%&'*+.^_`|~0-9A-Za-z-]{1,80}$/;export const A2A_CREDENTIAL_STORE_PATH =- process.env.OS_A2A_CREDENTIAL_STORE ??- path.join(os.homedir(), ".mso", "private", "a2a-credentials.json");+ expandOwnerStorePath(process.env.OS_A2A_CREDENTIAL_STORE ??+ path.join(os.homedir(), ".mso", "private", "a2a-credentials.json"));type OutboundRecord = A2AOutboundCredentialSummary & { secret: string };type OutboundStore = { version: 1; profiles: OutboundRecord[] };diff --git a/lib/a2a/local-auth.ts b/lib/a2a/local-auth.tsindex b4d1e48e..44740932 100644--- a/lib/a2a/local-auth.ts+++ b/lib/a2a/local-auth.ts@@ -1,3 +1,4 @@+import { expandOwnerStorePath } from "@/lib/owner-store-path.js";import { randomBytes, timingSafeEqual } from "node:crypto";import os from "node:os";import path from "node:path";@@ -13,8 +14,8 @@ import {} from "./network";const STORE =- process.env.OS_A2A_LOCAL_AUTH_STORE ??- path.join(os.homedir(), ".mso", "private", "a2a-local-auth.json");+ expandOwnerStorePath(process.env.OS_A2A_LOCAL_AUTH_STORE ??+ path.join(os.homedir(), ".mso", "private", "a2a-local-auth.json"));type LocalAuthStore = { version: 1; bearer: string; createdAt: string };const isStore = (value: unknown): value is LocalAuthStore =>diff --git a/lib/a2a/store.ts b/lib/a2a/store.tsindex 58d83a72..619a3370 100644--- a/lib/a2a/store.ts+++ b/lib/a2a/store.ts@@ -1,3 +1,4 @@+import { expandOwnerStorePath } from "@/lib/owner-store-path.js";import { createHash, randomUUID } from "node:crypto";import { constants as fsConstants, promises as fs } from "node:fs";import os from "node:os";@@ -8,8 +9,8 @@ import { getA2AOutboundCredential } from "./credentials";import type { A2ADiscoveredAgent, A2ARegisteredAgent } from "./types";export const A2A_STORE_PATH =- process.env.OS_A2A_STORE ??- path.join(os.homedir(), ".mso", "private", "a2a-agents.json");+ expandOwnerStorePath(process.env.OS_A2A_STORE ??+ path.join(os.homedir(), ".mso", "private", "a2a-agents.json"));const MAX_STORE_BYTES = 1024 * 1024;type A2AStore = { version: 1; agents: A2ARegisteredAgent[] };diff --git a/lib/a2a/task-store.ts b/lib/a2a/task-store.tsindex 8abc2b01..d2cd6ea8 100644--- a/lib/a2a/task-store.ts+++ b/lib/a2a/task-store.ts@@ -1,3 +1,4 @@+import { expandOwnerStorePath } from "@/lib/owner-store-path.js";import { randomUUID } from "node:crypto";import { constants as fsConstants, promises as fs } from "node:fs";import os from "node:os";@@ -11,8 +12,8 @@ type Store = { version: 1; tasks: A2ATaskRecord[] };const MAX_STORE_BYTES = 4 * 1024 * 1024;const MAX_TASKS = 200;export const A2A_TASK_STORE_PATH =- process.env.OS_A2A_TASK_STORE ??- path.join(os.homedir(), ".mso", "private", "a2a-tasks.json");+ expandOwnerStorePath(process.env.OS_A2A_TASK_STORE ??+ path.join(os.homedir(), ".mso", "private", "a2a-tasks.json"));async function readUnlocked(): Promise<Store> {let handle: Awaited<ReturnType<typeof fs.open>> | null = null;diff --git a/lib/agent/legacy-owner-memory.ts b/lib/agent/legacy-owner-memory.tsindex f1d8f03d..58a2b4df 100644--- a/lib/agent/legacy-owner-memory.ts+++ b/lib/agent/legacy-owner-memory.ts@@ -1,3 +1,4 @@+import { expandOwnerStorePath } from "@/lib/owner-store-path.js";import { randomUUID } from "node:crypto";import { constants, promises as fs } from "node:fs";import os from "node:os";@@ -7,7 +8,7 @@ import { withSecurityStoreLock } from "@/lib/security-store-lock";// Owner-authenticated facts, persisted as bounded JSON data, never executable source.export interface Memory { id: string; text: string; createdAt: number; }-const FILE = process.env.OS_MEMORY_STORE || path.join(os.homedir(), ".mso", "memory.json");+const FILE = expandOwnerStorePath(process.env.OS_MEMORY_STORE || path.join(os.homedir(), ".mso", "memory.json"));const MAX_BYTES = 2 * 1024 * 1024;const MAX_RECORDS = 1000;diff --git a/lib/agent/local-agent-mailbox.ts b/lib/agent/local-agent-mailbox.tsindex 1113091b..0c242282 100644--- a/lib/agent/local-agent-mailbox.ts+++ b/lib/agent/local-agent-mailbox.ts@@ -1,3 +1,4 @@+import { expandOwnerStorePath } from "@/lib/owner-store-path.js";import { randomUUID } from "node:crypto";import os from "node:os";import path from "node:path";@@ -11,7 +12,7 @@ type MailboxStore = { version: 1; messages: LocalAgentStoredMessage[] };const MAX_STORE_BYTES = 4 * 1024 * 1024;const MAX_MESSAGES = 2000;const RETENTION_MS = 30 * 24 * 60 * 60 * 1000;-const STORE_PATH = process.env.OS_LOCAL_AGENT_MESSAGE_STORE ?? path.join(os.homedir(), ".mso", "private", "local-agent-messages.json");+const STORE_PATH = expandOwnerStorePath(process.env.OS_LOCAL_AGENT_MESSAGE_STORE ?? path.join(os.homedir(), ".mso", "private", "local-agent-messages.json"));const EMPTY: MailboxStore = { version: 1, messages: [] };function validMessage(value: unknown): value is LocalAgentStoredMessage {diff --git a/lib/agent/local-agent-presence.ts b/lib/agent/local-agent-presence.tsindex 67d0d3bf..b786d3fb 100644--- a/lib/agent/local-agent-presence.ts+++ b/lib/agent/local-agent-presence.ts@@ -1,3 +1,4 @@+import { expandOwnerStorePath } from "@/lib/owner-store-path.js";import os from "node:os";import path from "node:path";import { withSecurityStoreLock } from "@/lib/security-store-lock";@@ -10,7 +11,7 @@ type PresenceStore = { version: 1; entries: LocalAgentPresenceRecord[] };const MAX_STORE_BYTES = 512 * 1024;const MAX_ENTRIES = 1000;const OFFLINE_RETENTION_MS = 7 * 24 * 60 * 60 * 1000;-const STORE_PATH = process.env.OS_LOCAL_AGENT_PRESENCE_STORE ?? path.join(os.homedir(), ".mso", "private", "local-agent-presence.json");+const STORE_PATH = expandOwnerStorePath(process.env.OS_LOCAL_AGENT_PRESENCE_STORE ?? path.join(os.homedir(), ".mso", "private", "local-agent-presence.json"));const EMPTY: PresenceStore = { version: 1, entries: [] };function validPresence(value: unknown): value is LocalAgentPresenceRecord {diff --git a/lib/auth/device-store.test.ts b/lib/auth/device-store.test.tsindex b14b99ea..a8fba5cd 100644--- a/lib/auth/device-store.test.ts+++ b/lib/auth/device-store.test.ts@@ -1,3 +1,4 @@+import { execFileSync } from "node:child_process";import { promises as fs } from "fs";import os from "os";import path from "path";@@ -28,6 +29,19 @@ const DEV = "a".repeat(32);const OTHER = "b".repeat(32);describe("device-store — an unreadable file must never look like an empty one", () => {+ it("keeps documented home-relative overrides identical between server and CLI", async () => {+ vi.stubEnv("HOME", dir);+ store = "~/.mso/auth-devices.json";+ const api = await load();+ await api.approveDevice(DEV, "home-relative fixture");+ const command = path.resolve(__dirname, "../../scripts/approve-device.js");+ const listing = execFileSync(process.execPath, [command, "--list"], { env: process.env, encoding: "utf8" });+ expect(listing).toContain(DEV);+ execFileSync(process.execPath, [command, "--revoke", DEV], { env: process.env, encoding: "utf8" });+ expect((await api.listDevices()).approved[DEV]).toBeUndefined();+ expect((await fs.stat(path.join(dir, ".mso/auth-devices.json"))).isFile()).toBe(true);+ });+it("treats a MISSING file as an empty store (legit first run)", async () => {const { listDevices } = await load();await expect(listDevices()).resolves.toEqual({ approved: {}, pending: {} });diff --git a/lib/auth/device-store.ts b/lib/auth/device-store.tsindex efb32f3f..6efe08f5 100644--- a/lib/auth/device-store.ts+++ b/lib/auth/device-store.ts@@ -1,3 +1,4 @@+import { expandOwnerStorePath } from "@/lib/owner-store-path.js";import { promises as fs } from "fs";import os from "os";import path from "path";@@ -40,7 +41,7 @@ const MAX_PENDING = 50;// mso runs as a host process (the deploy user's systemd service) → write our// own file, no agent round-trip. Override with OS_DEVICE_STORE.const STORE_PATH =- process.env.OS_DEVICE_STORE ?? path.join(os.homedir(), ".mso", "auth-devices.json");+ expandOwnerStorePath(process.env.OS_DEVICE_STORE ?? path.join(os.homedir(), ".mso", "auth-devices.json"));// Device ids are client-generated 128-bit+ hex/uuid.const DEVICE_ID_RE = /^[a-f0-9-]{16,128}$/i;diff --git a/lib/config/store.ts b/lib/config/store.tsindex d7336ced..5ffe81e1 100644--- a/lib/config/store.ts+++ b/lib/config/store.ts@@ -1,3 +1,4 @@+import { expandOwnerStorePath } from "@/lib/owner-store-path.js";import { promises as fs } from "fs";import os from "os";import path from "path";@@ -31,7 +32,7 @@ export interface OsConfig {anthropicApiKey?: string;}-const CONFIG_PATH = process.env.OS_CONFIG_STORE ?? path.join(os.homedir(), ".mso", "config.json");+const CONFIG_PATH = expandOwnerStorePath(process.env.OS_CONFIG_STORE ?? path.join(os.homedir(), ".mso", "config.json"));const PROVIDER_ID_RE = /^[a-z0-9][a-z0-9-]{0,63}$/;const RESERVED_RECORD_KEYS = new Set(["__proto__", "prototype", "constructor"]);diff --git a/lib/infra/store.ts b/lib/infra/store.tsindex ff90da53..d891862b 100644--- a/lib/infra/store.ts+++ b/lib/infra/store.ts@@ -1,3 +1,4 @@+import { expandOwnerStorePath } from "@/lib/owner-store-path.js";import { randomUUID } from "node:crypto";import { constants as fsConstants, promises as fs } from "node:fs";import os from "node:os";@@ -6,7 +7,7 @@ import { withSecurityStoreLock } from "@/lib/security-store-lock";import { getInfraProviderDefinition, normalizeInfraValues } from "./catalog";import type { InfraProviderId, InfraProviderSummary, InfraProviderValues, InfraStore } from "./types";-export const INFRA_STORE_PATH = process.env.OS_INFRA_STORE ?? path.join(os.homedir(), ".mso", "private", "infra-providers.json");+export const INFRA_STORE_PATH = expandOwnerStorePath(process.env.OS_INFRA_STORE ?? path.join(os.homedir(), ".mso", "private", "infra-providers.json"));const MAX_STORE_BYTES = 256 * 1024;function mask(value: string): string {diff --git a/lib/mcp/store.ts b/lib/mcp/store.tsindex 3a9d9169..881319d5 100644--- a/lib/mcp/store.ts+++ b/lib/mcp/store.ts@@ -1,3 +1,4 @@+import { expandOwnerStorePath } from "@/lib/owner-store-path.js";import { randomUUID } from "node:crypto";import { promises as fs } from "node:fs";import os from "node:os";@@ -62,7 +63,7 @@ interface Store {refreshTokens: Record<string, McpRefreshToken>;}-const STORE_PATH = process.env.OS_MCP_STORE ?? path.join(os.homedir(), ".mso", "mcp.json");+const STORE_PATH = expandOwnerStorePath(process.env.OS_MCP_STORE ?? path.join(os.homedir(), ".mso", "mcp.json"));export const CODE_TTL_MS = 60_000; // RFC 6749 wants ≤10 min; the exchange is immediateexport const TOKEN_TTL_MS = 90 * 24 * 60 * 60 * 1000; // legacy/manual bearer lifetimediff --git a/lib/owner-store-path.js b/lib/owner-store-path.jsnew file mode 100644index 00000000..f55462d1--- /dev/null+++ b/lib/owner-store-path.js@@ -0,0 +1,11 @@+// Shared by the Node CLI and server stores: expand only the documented current+// user's ~ prefix. This does not authorize a path or relax filesystem guards.+const os = require("node:os");+const path = require("node:path");+function expandOwnerStorePath(value) {+ if (typeof value !== "string" || value.includes("\0")) throw new Error("Invalid owner store path");+ if (value === "~") return os.homedir();+ if (value.startsWith("~/")) return path.join(os.homedir(), value.slice(2));+ return value;+}+module.exports = { expandOwnerStorePath };diff --git a/lib/prefs/store.ts b/lib/prefs/store.tsindex 42efc3b1..864e4690 100644--- a/lib/prefs/store.ts+++ b/lib/prefs/store.ts@@ -1,3 +1,4 @@+import { expandOwnerStorePath } from "@/lib/owner-store-path.js";import { promises as fs } from "fs";import os from "os";import path from "path";@@ -20,7 +21,7 @@ export interface OsPrefs {// Resolved lazily (not module-level) so tests can point OS_PREFS_PATH at a tmp dir.function prefsPath(): string {- return process.env.OS_PREFS_PATH ?? path.join(os.homedir(), ".mso", "prefs.json");+ return expandOwnerStorePath(process.env.OS_PREFS_PATH ?? path.join(os.homedir(), ".mso", "prefs.json"));}export async function readPrefs(): Promise<OsPrefs> {diff --git a/lib/security-store-path.ts b/lib/security-store-path.tsindex 39f34015..35da79a5 100644--- a/lib/security-store-path.ts+++ b/lib/security-store-path.ts@@ -1,6 +1,7 @@import { constants, promises as fs } from "node:fs";import os from "node:os";import path from "node:path";+import { expandOwnerStorePath } from "./owner-store-path.js";// A kernel-pinned parent keeps lock/file operations on one directory even if its// pathname is replaced. Linux /proc/self/fd is the supported VPS/WSL runtime.@@ -12,10 +13,11 @@ const STORE_ENV = ["OS_CONFIG_STORE", "OS_PREFS_PATH", "OS_SKILL_MEMORY_STORE",] as const;const DIRECTORY_ENV = ["OS_TOOL_FORGE_DIR", "OS_AGENT_MEMORY_DIR", "OS_AGENT_SESSIONS_DIR", "OS_PROJECT_AGENT_TASKS_DIR"] as const;-const expand = (value: string) => path.resolve(value.replace(/^~(?=$|\/)/, os.homedir()));+const expand = (value: string) => path.resolve(expandOwnerStorePath(value));export async function pinSecurityStorePath(storePath: string) {if (process.platform !== "linux") throw new Error("Pinned security-store operations require Linux or WSL");+ storePath = expandOwnerStorePath(storePath);if (typeof storePath !== "string" || storePath.includes("\0") || !path.isAbsolute(storePath)) throw new Error("Security store needs an absolute path");const absolute = path.resolve(storePath);const name = path.basename(absolute);diff --git a/scripts/approve-device.js b/scripts/approve-device.jsindex c5a95885..47eb65f4 100755--- a/scripts/approve-device.js+++ b/scripts/approve-device.js@@ -4,6 +4,7 @@// Store = ~/.mso/auth-devices.json unless OS_DEVICE_STORE overrides it; this must// match the path used by the running MSO service.+const { expandOwnerStorePath } = require("../lib/owner-store-path.js");const fs = require("fs");const os = require("os");const path = require("path");@@ -12,7 +13,7 @@ const { spawnSync } = require("child_process");const { approvedExitCode, DEVICE_ROLES, normalizeApproved, parseApprovalArgs, roleOf, setRoleResult } = require("./lib/device-role-cli");const STORE =- process.env.OS_DEVICE_STORE || path.join(os.homedir(), ".mso", "auth-devices.json");+ expandOwnerStorePath(process.env.OS_DEVICE_STORE || path.join(os.homedir(), ".mso", "auth-devices.json"));const DEVICE_ID_RE = /^[a-f0-9-]{16,128}$/i;function read() {diff --git a/scripts/lib/gateway-common.sh b/scripts/lib/gateway-common.shindex d17150c1..b090d67f 100644--- a/scripts/lib/gateway-common.sh+++ b/scripts/lib/gateway-common.sh@@ -63,7 +63,13 @@ gateway_state_read() {fi}-gateway_pid_alive() { [ "${1:-0}" -gt 1 ] 2>/dev/null && kill -0 "$1" 2>/dev/null; }+gateway_pid_alive() {+ local line rest+ [ "${1:-0}" -gt 1 ] 2>/dev/null && kill -0 "$1" 2>/dev/null || return 1+ IFS= read -r line <"/proc/$1/stat" 2>/dev/null || return 1+ rest="${line##*) }"+ case "$rest" in Z*|X*) return 1 ;; *) return 0 ;; esac+}gateway_proc_start_ticks() {local pid="$1" line restdiff --git a/scripts/lib/gateway-pending.sh b/scripts/lib/gateway-pending.shindex 1acdabee..24ab3d5f 100755--- a/scripts/lib/gateway-pending.sh+++ b/scripts/lib/gateway-pending.sh@@ -41,6 +41,13 @@ gateway_stop_pending_tunnel() {donelive="$(gateway_proc_start_ticks "$pid" 2>/dev/null || true)"[ "$live" != "$ticks" ] || kill -KILL "$pid" 2>/dev/null || true+ for i in $(seq 1 20); do+ live="$(gateway_proc_start_ticks "$pid" 2>/dev/null || true)"+ [ "$live" != "$ticks" ] && break+ sleep 0.05+ done+ [ "$live" != "$ticks" ] || { printf 'mso gateway: pending tunnel survived rollback\n' >&2; return 1; }+ wait "$pid" 2>/dev/null || trueTUNNEL_PENDING_PID=0; TUNNEL_PENDING_TICKS=''}diff --git a/scripts/lib/gateway-tunnel.sh b/scripts/lib/gateway-tunnel.shindex 72e05c4d..dc89547b 100644--- a/scripts/lib/gateway-tunnel.sh+++ b/scripts/lib/gateway-tunnel.sh@@ -78,7 +78,7 @@ gateway_spawn_tunnel() {[ -n "$identity" ] || { gateway_stop_pending_tunnel; return 1; }gateway_pending_gate_cleanupTUNNEL_IDENTITY="$identity"- TUNNEL_PENDING_PID=0; TUNNEL_PENDING_TICKS=''+ # Keep our spawned child's lifetime until state commits: argv/exe can still change.GATEWAY_PENDING_CLEANUP=1}@@ -149,8 +149,10 @@ gateway_probe_public() {}gateway_cleanup_failed_start() {- if [ "${TUNNEL_IDENTITY:-null}" != null ]; then gateway_stop_identity "$TUNNEL_IDENTITY"- else gateway_stop_pending_tunnel; fi+ # Until durable commit, the PID/start-ticks handshake proves this is OUR child+ # even if an interpreter exec or process-title update changed its argv identity.+ if [ "${TUNNEL_PENDING_PID:-0}" -gt 1 ] 2>/dev/null; then gateway_stop_pending_tunnel+ elif [ "${TUNNEL_IDENTITY:-null}" != null ]; then gateway_stop_identity "$TUNNEL_IDENTITY"; fiif [ "${RUNTIME_STARTED_NOW:-false}" = true ]; then gateway_stop_identity "$RUNTIME_IDENTITY"else gateway_stop_pending_runtime; fi}@@ -190,6 +192,7 @@ gateway_cmd_start_locked() {gateway_fail "could not persist gateway state; newly launched processes were rolled back"fiGATEWAY_PENDING_CLEANUP=0+ TUNNEL_PENDING_PID=0; TUNNEL_PENDING_TICKS=''gateway_info "gateway started"gateway_info "public: $GATEWAY_PUBLIC_URL"diff --git a/scripts/mso-gateway-lifecycle.test.ts b/scripts/mso-gateway-lifecycle.test.tsindex 33d25f3a..91b5808c 100644--- a/scripts/mso-gateway-lifecycle.test.ts+++ b/scripts/mso-gateway-lifecycle.test.ts@@ -89,14 +89,20 @@ afterEach(() => {describe("mso gateway lifecycle hardening", () => {it("rolls back a tunnel when durable state persistence fails", () => {const f = fixture(), pidFile = f.startFile;+ // Force the startup identity race deterministically before persistence fails.+ fs.appendFileSync(f.cloudflared, "\nprocess.on('SIGUSR1',()=>{process.title='renamed-tunnel-fixture';fs.writeFileSync(process.env.HOME+'/title-changed','1')});\n");const mv = path.join(f.dir, "bin", "mv");fs.writeFileSync(mv, `#!/bin/sh-case "$*" in *mso-private-write*state.json*) exit 1;; esac+case "$*" in *mso-private-write*state.json*)+ kill -USR1 "$(tail -n 1 "$HOME/gateway-fake-starts")"+ for i in $(seq 1 100); do [ ! -f "$HOME/title-changed" ] || break; sleep 0.01; done+ exit 1;; esacexec /bin/mv "$@"`, { mode: 0o700 });const out = spawnSync(GATEWAY, ["start"], { encoding: "utf8",env: f.env });expect(out.status).not.toBe(0); expect(out.stderr).toContain("rolled back");+ expect(fs.existsSync(path.join(f.dir, "title-changed"))).toBe(true);const pid = Number(fs.readFileSync(pidFile, "utf8").trim()); pids.add(pid); expect(alive(pid)).toBe(false);expect(fs.existsSync(path.join(f.state, "state.json"))).toBe(false);});