fix(lanes): cloning into a deleted workspace's folder re-attaches it instead of failing UNIQUE

A workspace record outlives its folder (deleted from the File Explorer or a
shell). Cloning the same repo into that path again ran `git clone`, then
createLane hit idx_lanes_cwd_tool and answered 500 "UNIQUE constraint failed:
lanes.cwd, lanes.tool", leaving the new clone with no workspace on it.

POST /api/lanes/clone now looks for the caller's own workspace at exactly
that folder and tool and answers 200 { lane, created: false, path }, like
POST /ensure. Another user's workspace there is still refused before the
clone (folderTakenByOther), and a nested path still makes its own workspace.
This commit is contained in:
2026-10-23 16:26:56 +07:00
parent 572d615d4e
commit 65a001dad4
3 changed files with 31 additions and 1 deletions
+1
View File
@@ -405,6 +405,7 @@ closing the dialog then only hides it behind a progress chip (click to reopen)
```
POST /api/lanes/clone Body: { url, parent, name?, title?, tool?, credentials?: { username, password, remember? }, partial?, progressToken? }
→ 201 { lane, created: true, path }
→ 200 { lane, created: false, path } (the user's own workspace already at that folder + tool, its folder deleted since)
GET /api/lanes/clone/progress/:token
→ 200 { state: queued|running|done|failed, position, running, waiting, limit,
phase: remote|receiving|resolving|checkout|other|null, label, percent, detail }