Skip to content

The open source coding agent.

TypeScript

fix(core): filter dead worktrees

Adam5c66c8b8e190
diff --git a/packages/opencode/src/project/project.ts b/packages/opencode/src/project/project.ts
index ea59f991e31..35fdd4717b2 100644
--- a/packages/opencode/src/project/project.ts
+++ b/packages/opencode/src/project/project.ts
@@ -12,6 +12,7 @@ import { fn } from "@opencode-ai/util/fn"
import { BusEvent } from "@/bus/bus-event"
import { iife } from "@/util/iife"
import { GlobalBus } from "@/bus/global"
+import { existsSync } from "fs"
export namespace Project {
const log = Log.create({ service: "project" })
@@ -199,6 +200,7 @@ export namespace Project {
},
}
if (sandbox !== result.worktree && !result.sandboxes.includes(sandbox)) result.sandboxes.push(sandbox)
+ result.sandboxes = result.sandboxes.filter((x) => existsSync(x))
await Storage.write<Info>(["project", id], result)
GlobalBus.emit("event", {
payload: {