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
{{ message }}
Repository navigation
[Bug]: No project scratch folders with any file never expire unless the global keep rule also deletes untracked files in worktrees #39374
🤖 Claude Opus 5.5 responding on behalf of ryoppippi
Before submitting
I searched existing issues and did not find a duplicate.
I included enough detail to reproduce or investigate the problem.
Area
apps/server
Steps to reproduce
Keep the default worktree keep rule (worktreeKeepWhen: "uncommitted-changes") and set worktreeAfterDays: 7.
Use No project threads; the agent writes any file into its ~/.t3/scratch/<name> folder.
Leave the threads idle well past 7 days and let the sweep run.
Expected behavior
Idle scratch folders expire after a retention of their own, without changing how worktrees are kept — for example a separate scratchAfterDays (and its own keep rule), still respecting threads with enabled scheduled tasks as #36369 does.
Actual behavior
Since #36369, scratchKeepReason keeps every scratch folder holding anything besides node_modules unless worktreeKeepWhen is "tracked-changes". Nearly every No project thread writes a file, so in practice the folders never expire: here 31 folders from the past month remain (8.5 GiB), and the sweep has removed a single folder.
The only way to expire them is switching the global keep rule to "Edited tracked files", which also lets cleanup delete untracked files in real worktrees. Scratch and worktrees need different rules: a worktree's untracked files are often in-progress work, while a scratch folder is throwaway by design.
Impact
Minor bug or occasional failure. Disk use grows without bound for heavy No project users, with no safe setting to stop it.
🤖 Claude Opus 5.5 responding on behalf of ryoppippi
Closing: there is a safe setting after all. No project can be selected under Settings → Worktrees → Cleanup and set to Custom, and cleanWorktrees resolves rules per thread via resolveWorktreeCleanup(serverSettings, thread.projectId), so scratch folders can use Edited tracked files with their own retention while every other project keeps Uncommitted changes.
I missed that the per-project override also covers the scratch project; docs/user/project-settings.md does not mention it, which may be worth a line there.
Activity
ryoppippi commentedon Nov 19, 2026
Note
🤖 Claude Opus 5.5 responding on behalf of ryoppippi
Closing: there is a safe setting after all. No project can be selected under Settings → Worktrees → Cleanup and set to Custom, and
cleanWorktreesresolves rules per thread viaresolveWorktreeCleanup(serverSettings, thread.projectId), so scratch folders can use Edited tracked files with their own retention while every other project keeps Uncommitted changes.I missed that the per-project override also covers the scratch project;
docs/user/project-settings.mddoes not mention it, which may be worth a line there.