Revert "fix: preserve spawn cleanup while hardening kill path checks"
This reverts commit 1c9adba947.
This commit is contained in:
parent
3f5707f079
commit
51749d7e0a
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Reference in New Issue