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(jobs): finish retention before releasing runtime
Rahman3de638dd759c
diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.mdindex 6bc70003..5d5e6e6a 100644--- a/docs/CHANGELOG.md+++ b/docs/CHANGELOG.md@@ -8,6 +8,7 @@ this is the *what*, and it is what Settings → About shows as “What's new”.**Fixed**+- `jobs` finish retention before releasing runtime- `runtime` preserve fallback recovery readiness- `runtime` keep service starts on shared exclusion- `settings` hide premature update warningdiff --git a/lib/managed-apps/job-runner.ts b/lib/managed-apps/job-runner.tsindex 6e3bf118..812cc330 100644--- a/lib/managed-apps/job-runner.ts+++ b/lib/managed-apps/job-runner.ts@@ -170,9 +170,12 @@ async function run(rt: Runtime, options: StartManagedAppJobOptions): Promise<voi// finish() already freed the lock (see there). This is the idempotent// backstop for any path that could reach here without one.releaseOperation(rt.record.applicationId);- await flush(rt); // persist the terminal record BEFORE it leaves the live map- live.delete(rt.record.id);+ await flush(rt); // persist the terminal record before retention reads historyawait pruneJobRecords().catch(() => undefined);+ // Keep the terminal record in the live map until retention is also complete.+ // This makes finalization observable and prevents a late prune from resolving+ // storage roots after a caller/test has already moved to another lifecycle.+ live.delete(rt.record.id);}}diff --git a/lib/managed-apps/job-store.test.ts b/lib/managed-apps/job-store.test.tsindex 01d6a9c3..c4394a8c 100644--- a/lib/managed-apps/job-store.test.ts+++ b/lib/managed-apps/job-store.test.ts@@ -12,6 +12,7 @@ vi.mock("server-only", () => ({}));const { isManagedAppJobId, listJobRecords, pruneJobRecords, readJobRecord, writeJobRecord } = await import("./job-store");const { startManagedAppJob } = await import("./jobs");+const { liveRecord } = await import("./job-runner");import type { ManagedAppId, ManagedAppJob, ManagedAppJobStatus } from "./types";let home: string;@@ -102,9 +103,12 @@ describe("a job whose owner is gone is interrupted, not running forever", () =>for (let i = 0; i < 200 && (await readJobRecord(next.id))?.status === "running"; i += 1) {await new Promise((resolve) => setTimeout(resolve, 20));}- // Drain the job's own retention pass: it resolves $HOME when it runs, and- // this suite swaps $HOME per test.- await new Promise((resolve) => setTimeout(resolve, 150));+ // Drain the job's whole finalization, including retention. A fixed sleep was+ // racy under load and let a late prune observe the next test's mocked HOME.+ for (let i = 0; i < 200 && liveRecord(next.id); i += 1) {+ await new Promise((resolve) => setTimeout(resolve, 20));+ }+ expect(liveRecord(next.id)).toBeUndefined();});});