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.

fix(heartbeat): preserve relative env paths in cron

rahmanef81c7db77e03a
diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md
index b13f2677..9c1648b1 100644
--- a/docs/CHANGELOG.md
+++ b/docs/CHANGELOG.md
@@ -8,6 +8,7 @@ this is the *what*, and it is what Settings → Account → About shows as “Wh
**Fixed**
+- `heartbeat` preserve relative env paths in cron
- `ux` reuse existing loading and glass styles within the shell budget
- `heartbeat` use parseable multiline shell case statements
- `ux` stack install notice above the update badge without overlap
diff --git a/docs/PROGRESS.md b/docs/PROGRESS.md
index d3f98d3e..48704352 100644
--- a/docs/PROGRESS.md
+++ b/docs/PROGRESS.md
@@ -1,3 +1,7 @@
+## 2026-10-08: Preserve heartbeat configuration across cron working directories
+
+The final audit reproduced a cron check silently becoming disabled when installation used a caller-relative env file. The shared heartbeat entry point now anchors that path to the installation working directory before validating it, preserving symlink rejection. A regression executes the generated cron command from HOME and confirms the enabled health check still runs.
+
## 2026-10-08: Make shell startup and Spotlight feedback reliable
The boot splash now removes itself on hydration on every route, including the standalone Integrations and OAuth pages, and uses the saved theme before hydration. Spotlight reports pending folder searches and retries focus after its deferred mount while retaining first-open lazy loading. Its foreground and placeholder colors remain readable over the desktop wallpaper. The update badge uses the Settings public entry point and sits below the separate install prompt. The release journey checks that the standalone Integrations page has no remaining boot overlay and that install/update notices do not overlap at desktop and 320px mobile widths.
diff --git a/scripts/mso-heartbeat b/scripts/mso-heartbeat
index 96798926..dd7bdff6 100755
--- a/scripts/mso-heartbeat
+++ b/scripts/mso-heartbeat
@@ -4,6 +4,7 @@ set -euo pipefail
umask 077
ROOT="${MSO_GATEWAY_ROOT:-$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)}"
ENVF="${MSO_GATEWAY_ENV:-$ROOT/.env.local}"
+[[ "$ENVF" = /* ]] || ENVF="$PWD/$ENVF"
gateway_fail() { echo "mso heartbeat: $*" >&2; exit 1; }
. "$ROOT/scripts/lib/gateway-config.sh"
if [ "$ENVF" != /dev/null ] && { [ -e "$ENVF" ] || [ -L "$ENVF" ]; }; then
diff --git a/scripts/mso-heartbeat.test.ts b/scripts/mso-heartbeat.test.ts
index cb4c68b7..ca1312a8 100644
--- a/scripts/mso-heartbeat.test.ts
+++ b/scripts/mso-heartbeat.test.ts
@@ -44,7 +44,7 @@ else cat >"$HOME/table"; fi
localHealth: healthy ? "healthy" : "unhealthy", publicHealth: healthy ? "healthy" : "unhealthy", public: null }));
}
state();
- const run = (args: string[] = [], extra = {}) => spawnSync("bash", [path.join(root, "scripts/mso-heartbeat"), ...args], { env: { ...env, ...extra }, encoding: "utf8" });
+ const run = (args: string[] = [], extra = {}, cwd?: string) => spawnSync("bash", [path.join(root, "scripts/mso-heartbeat"), ...args], { env: { ...env, ...extra }, cwd, encoding: "utf8" });
const actions = () => fs.existsSync(path.join(home, "actions")) ? fs.readFileSync(path.join(home, "actions"), "utf8") : "";
return { home, root, config, envFile, observation, env, state, run, actions };
}
@@ -144,6 +144,15 @@ describe("optional one-shot heartbeat", () => {
expect(f.run(["install-cron"]).status).toBe(1);
expect(fs.readFileSync(path.join(f.home, "table"), "utf8")).toContain("/unrelated/job");
});
+ it("preserves a caller-relative env file when cron starts from HOME", () => {
+ const f = fixture(); f.state("mso", true);
+ fs.writeFileSync(f.envFile, "OS_HEARTBEAT_ENABLED=1\n");
+ expect(f.run(["install-cron"], { MSO_GATEWAY_ENV: ".env.local", OS_HEARTBEAT_ENABLED: "0" }, f.root).status).toBe(0);
+ const line = fs.readFileSync(path.join(f.home, "table"), "utf8").split("\n")[0];
+ const command = line.replace(/^\S+ \S+ \S+ \S+ \S+ /, "").replace(/ # mso-heartbeat:.*$/, "").replace(/\\%/g, "%").replace(" >/dev/null", "");
+ const result = spawnSync("sh", ["-c", command], { cwd: f.home, env: { ...f.env, MSO_GATEWAY_ROOT: "", OS_HEARTBEAT_ENABLED: "0" }, encoding: "utf8" });
+ expect(result.status).toBe(0); expect(result.stdout).toContain("healthy");
+ });
it("does not install cron while disabled or with an invalid interval", () => {
const f = fixture(); expect(f.run(["install-cron"], { OS_HEARTBEAT_ENABLED: "0" }).status).toBe(0);
expect(fs.existsSync(path.join(f.home, "table"))).toBe(false);