Skip to content

armgit / mso

Public Imported from GitHub
0

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.

test(gateway): reap lock holder fixtures without orphan processes

Rahmanf1db3002eb3d
diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md
index 24edd2e7..0fd10994 100644
--- a/docs/CHANGELOG.md
+++ b/docs/CHANGELOG.md
@@ -37,6 +37,7 @@ this is the *what*, and it is what Settings → About shows as “What's new”.
**Tests**
+- `gateway` reap lock holder fixtures without orphan processes
- `workflows` stabilize repeated artifact inspection journeys
**Docs**
diff --git a/docs/PROGRESS.md b/docs/PROGRESS.md
index 552e363a..13303b26 100644
--- a/docs/PROGRESS.md
+++ b/docs/PROGRESS.md
@@ -1,3 +1,7 @@
+## 2026-09-17 — Lock-fixture cleanup prevents accumulated test processes
+
+The branch/worktree audit found orphaned `mso-lock-holder` shells and `sleep` children from completed gateway boundary tests. The fixture killed only the forking `flock` parent, leaving the command and inherited lock descriptor alive after its temporary directory was removed. The holder now uses `flock --no-fork` with a single Node process; readiness is inside `try/finally`, and the regression asserts exact PID identity, process exit and kernel-lock reacquisition. No gateway/provider runtime behavior or release guard is changed. Historical process cleanup is restricted to verified orphan fixtures from this conversation's worktrees, not other agents or production processes.
+
## 2026-09-17 — Descriptor-pinned Workflow storage hardening
The PR/branch audit exposed default-branch security annotations for Workflow run,
diff --git a/scripts/mso-gateway-boundaries.test.ts b/scripts/mso-gateway-boundaries.test.ts
index 50630568..fb0c09d5 100644
--- a/scripts/mso-gateway-boundaries.test.ts
+++ b/scripts/mso-gateway-boundaries.test.ts
@@ -74,9 +74,13 @@ esac
// `flock ... command` acquires the lock before executing the command. The ready
// file therefore proves ownership; a fixed sleep is not a synchronization primitive
// when the full suite is deliberately running under nice/ionice.
- const holder = spawn("flock", ["-x", lock, "sh", "-c", 'printf ready > "$1"; while :; do sleep 60; done', "mso-lock-holder", ready], { stdio: "ignore" });
- await waitForFile(ready);
+ // --no-fork execs the holder in flock's PID. Killing a forking flock only
+ // stopped its parent and leaked the shell/sleep with the lock still held.
+ const holder = spawn("flock", ["--no-fork", "-x", lock, process.execPath, "-e",
+ "require('node:fs').writeFileSync(process.argv[1], String(process.pid)); setInterval(() => {}, 1000)", ready], { stdio: "ignore" });
try {
+ await waitForFile(ready);
+ expect(Number(fs.readFileSync(ready, "utf8"))).toBe(holder.pid);
const out = spawnSync(GATEWAY, ["local-start"], { encoding: "utf8", env: { ...f.baseEnv,
MSO_RUNTIME_EXCLUSION_DIR: base, MSO_RUNTIME_EXCLUSION_TIMEOUT_SECONDS: "0.1" } });
expect(out.status).not.toBe(0);
@@ -88,6 +92,9 @@ esac
else holder.once("close", () => resolve());
});
}
+ // Prove teardown released the kernel lock and reaped the exact holder.
+ expect(() => process.kill(holder.pid!, 0)).toThrow();
+ expect(spawnSync("flock", ["-n", lock, "true"], { stdio: "ignore" }).status).toBe(0);
});
it("does not silently ignore named-tunnel arguments while another gateway is active", () => {