diff --git a/packages/core/src/session-manager.ts b/packages/core/src/session-manager.ts index 640052f4d..1d60a91f4 100644 --- a/packages/core/src/session-manager.ts +++ b/packages/core/src/session-manager.ts @@ -200,16 +200,12 @@ export function createSessionManager(deps: SessionManagerDeps): SessionManager { project: ProjectConfig | undefined, workspacePath: string, ): boolean { - if (!project) return false; + if (!project) return true; const isProjectPath = normalizePath(workspacePath) === normalizePath(project.path); if (isProjectPath) return false; return isPathInside(workspacePath, getProjectWorktreesDir(project)); } - function shouldDestroySpawnWorkspacePath(project: ProjectConfig, workspacePath: string): boolean { - return normalizePath(workspacePath) !== normalizePath(project.path); - } - /** * List all session files across all projects (or filtered by projectId). * Scans project-specific directories under ~/.agent-orchestrator/{hash}-{projectId}/sessions/ @@ -466,7 +462,7 @@ export function createSessionManager(deps: SessionManagerDeps): SessionManager { try { await plugins.workspace.postCreate(wsInfo, project); } catch (err) { - if (shouldDestroySpawnWorkspacePath(project, workspacePath)) { + if (shouldDestroyWorkspacePath(project, workspacePath)) { try { await plugins.workspace.destroy(workspacePath); } catch { @@ -535,7 +531,7 @@ export function createSessionManager(deps: SessionManagerDeps): SessionManager { }); } catch (err) { // Clean up workspace and reserved ID if agent config or runtime creation failed - if (plugins.workspace && shouldDestroySpawnWorkspacePath(project, workspacePath)) { + if (plugins.workspace && shouldDestroyWorkspacePath(project, workspacePath)) { try { await plugins.workspace.destroy(workspacePath); } catch { @@ -590,7 +586,7 @@ export function createSessionManager(deps: SessionManagerDeps): SessionManager { } catch { /* best effort */ } - if (plugins.workspace && shouldDestroySpawnWorkspacePath(project, workspacePath)) { + if (plugins.workspace && shouldDestroyWorkspacePath(project, workspacePath)) { try { await plugins.workspace.destroy(workspacePath); } catch {