Revert "fix: preserve spawn cleanup while hardening kill path checks"

This reverts commit 1c9adba947.
This commit is contained in:
Harsh 2026-03-06 14:52:58 +05:30
parent 3f5707f079
commit 51749d7e0a
1 changed files with 4 additions and 8 deletions

View File

@ -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 {