openpod

An opencode plugin that spins up a dedicated virtual machine for each session to isolate agent work.
git clone https://unitehenry.com/git/openpod.git
Log | Files | Refs | README

commit 1c6f51a7c89f9a318f314cbf75828e034e3615ea
parent 02d40902d3017dc80c0f99369cd3b6667862ab1f
Author: Henry Unite <unitehenry@gmail.com>
Date:   Sat, 14 Nov 2026 19:10:00 +0000

refactor(opencode): wait for pod removal concurrently

Run the lima instance and openpod directory removal waits as independent loops in parallel inside a private helper.

Diffstat:
Mopencode.test.ts | 30+++++++++++++++++++++---------
1 file changed, 21 insertions(+), 9 deletions(-)

diff --git a/opencode.test.ts b/opencode.test.ts @@ -344,17 +344,29 @@ describe("opencode", () => { // up the lima instance and the openpod directory. await opencode.sessions.remove({ sessionID: session.id }); - let limaGone = false; - let dirGone = false; - for (let i = 0; i < 100; i++) { - limaGone = !limaInstanceExists(session.id); - dirGone = !fs.existsSync(sessionDir); - if (limaGone && dirGone) break; - await new Promise((r) => setTimeout(r, 100)); + // Poll for pod removal with independent waits that run concurrently. + async function waitForPodRemoval(): Promise<{ + limaRemoved: boolean; + dirRemoved: boolean; + }> { + async function waitFor(condition: () => boolean): Promise<boolean> { + for (let i = 0; i < 100; i++) { + if (condition()) return true; + await new Promise((r) => setTimeout(r, 100)); + } + return condition(); + } + + const [limaRemoved, dirRemoved] = await Promise.all([ + waitFor(() => !limaInstanceExists(session.id)), + waitFor(() => !fs.existsSync(sessionDir)), + ]); + return { limaRemoved, dirRemoved }; } - expect(limaGone).toBe(true); - expect(dirGone).toBe(true); + const { limaRemoved, dirRemoved } = await waitForPodRemoval(); + expect(limaRemoved).toBe(true); + expect(dirRemoved).toBe(true); // Clean up await cleanup(session.id, [sessionDir, tempDir, bareDir]);