🐛 fix(vscode): resume 会话用 resolveWorktreePath 避免误判 worktree 已清理
This commit is contained in:
@@ -84,15 +84,16 @@ export async function handleResumeSession(panel: KanbanWebviewPanel, sessionId:
|
||||
return
|
||||
}
|
||||
const workspaceRoot = workspace.workspaceFolders?.[0]?.uri.fsPath
|
||||
// Implementation sessions live in a worktree; the caller can pass a
|
||||
// workspace-relative `relCwd` so `--resume` runs from the right place.
|
||||
// Implementation sessions live in a worktree; `relCwd` may be absolute /
|
||||
// `~/...` / workspace-relative — must go through resolveWorktreePath
|
||||
// (path.join(workspaceRoot, abs) would mangle absolute paths).
|
||||
// If the worktree has since been cleaned up (typical: drop card to
|
||||
// "完成" → auto `git worktree remove`), fall back to the workspace
|
||||
// root instead of pointing the terminal at a missing directory.
|
||||
let effectiveCwd: string | undefined = workspaceRoot
|
||||
let cwdFallback = false
|
||||
if (relCwd && workspaceRoot) {
|
||||
const resolved = path.join(workspaceRoot, relCwd)
|
||||
const resolved = resolveWorktreePath(relCwd, workspaceRoot)
|
||||
if (fs.existsSync(resolved)) {
|
||||
effectiveCwd = resolved
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user