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(managed-apps): wait for durable job finalization before cleanup

Abdurrahman Fakhrul1acc14247027
diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md
index a4e931b1..83bd54d9 100644
--- a/docs/CHANGELOG.md
+++ b/docs/CHANGELOG.md
@@ -15,6 +15,7 @@ this is the *what*, and it is what Settings → Account → About shows as “Wh
**Tests**
+- `managed-apps` wait for durable job finalization before cleanup
- `workflows` complete waited receipt fixture schema
- `oauth` receive consent callbacks outside the shell
- `security` exercise webhook admission with explicit proxy trust
diff --git a/lib/managed-apps/update.test.ts b/lib/managed-apps/update.test.ts
index b2578ccc..69951574 100644
--- a/lib/managed-apps/update.test.ts
+++ b/lib/managed-apps/update.test.ts
@@ -21,6 +21,7 @@ delete process.env.OPENCLAW_HOME;
const { checkUpdate, setChannel, startRollback, startUninstall, startUpdate } = await import("./update");
const { readManagedAppJob, listManagedAppJobs } = await import("./jobs");
+const { liveRecord } = await import("./job-runner");
const { listBackups } = await import("./backups");
let home: string;
@@ -67,7 +68,8 @@ async function settle(job: ManagedAppJob): Promise<ManagedAppJob> {
expect(job.argv[0] ?? bin).toContain(bin);
for (let i = 0; i < 400; i += 1) {
const current = await readManagedAppJob(job.id);
- if (current && current.status !== "queued" && current.status !== "running") return current;
+ // Finish the durable flush before the fixture changes or deletes its temporary home.
+ if (current && current.status !== "queued" && current.status !== "running" && !liveRecord(job.id)) return current;
await new Promise((resolve) => setTimeout(resolve, 20));
}
throw new Error("job never reached a terminal status");