You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/experimental/issue-worktree-support.md
+39Lines changed: 39 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -22,6 +22,45 @@ We are intentionally not shipping the UI for this yet. The runtime code remains
22
22
- seeded worktree instances can keep local-encrypted secrets working
23
23
- seeded worktree instances can rebind same-repo project workspace paths onto the current git worktree
24
24
25
+
## Large-repo Worktree Lifecycle Policy
26
+
27
+
Paperclip-owned issue and review worktrees are execution workspaces, not agent-owned scratch directories. The execution workspace record is the source of truth for:
28
+
29
+
- owner: the Paperclip company/project plus the issue linked through `sourceIssueId` and `issues.executionWorkspaceId`
30
+
- linked work: the issue identifier, branch name, base ref, project workspace, and any PR link carried in the issue thread
31
+
- creation and use time: `openedAt`, `createdAt`, and `lastUsedAt`
32
+
- cleanup eligibility: `closedAt`, `cleanupEligibleAt`, `cleanupReason`, and workspace `status`
33
+
- provider ownership: `providerType: "git_worktree"` plus `metadata.createdByRuntime: true` means Paperclip may remove the derived worktree after close-readiness passes
34
+
35
+
Retention defaults for large local worktrees:
36
+
37
+
- active or linked to open issue: keep; report size and readiness only
38
+
- clean, idle, Paperclip-created issue worktree: eligible for cleanup after 24 hours
39
+
- in review: keep for 7 days unless a reviewer explicitly archives the workspace earlier
40
+
-`cleanup_failed`: keep until an operator resolves the reported reason
41
+
- shared/project-primary workspace: never delete the underlying project checkout; archive only the execution workspace record
42
+
43
+
Close and cleanup must use the execution workspace close-readiness report before deleting anything. The report includes linked open issues, runtime services, git dirty state, untracked files, ahead/behind counts, merge status, and planned cleanup actions. Destructive archive is blocked for isolated git worktrees when:
44
+
45
+
- the workspace is linked to any non-terminal issue
46
+
- tracked files are modified
47
+
- untracked files are present
48
+
- commits are ahead of the base ref and not merged
49
+
- git status cannot be inspected
50
+
51
+
The lower-level cleanup helper also refuses to remove a git worktree when `git status --porcelain --untracked-files=all` is non-empty, so direct callers report dirty worktrees instead of deleting them. If a worktree is clean and Paperclip owns it, cleanup removes the git worktree and then attempts to delete the runtime-created branch with `git branch -d`; unmerged branches are reported and kept.
52
+
53
+
Safe stale-worktree reporting should list, but not delete, candidate `/tmp` worktrees matching all of:
54
+
55
+
- provider is `git_worktree`
56
+
- workspace path resolves under `/tmp` or the platform temp directory
57
+
- status is `idle`, `in_review`, or `cleanup_failed`, or `lastUsedAt` is older than the retention window
58
+
- close-readiness is not `ready`
59
+
60
+
Each row should include workspace id, issue identifier, owner agent if known, path, branch, base ref, opened/last-used time, approximate path size, readiness state, blocking reasons, and planned actions. Deletion is only allowed by the archive/close path after readiness returns `ready` or `ready_with_warnings`; blocked rows remain report-only.
61
+
62
+
Successful release/completion behavior: when a Paperclip-owned isolated worktree is closed, the server archives the execution workspace record, stops attached runtime services, runs configured cleanup/teardown commands, removes the clean git worktree, and records any cleanup warning in `cleanupReason`. If release/completion does not explicitly archive the workspace, the stale-worktree report is the follow-up mechanism that makes the retention breach visible before manual or scheduled archive.
63
+
25
64
## Hidden UI entrypoints
26
65
27
66
These are the current user-facing UI surfaces for the feature, now intentionally disabled:
0 commit comments