Skip to content

Commit eb1bf01

Browse files
donjor-agent[bot]donjor
authored andcommitted
fix(web): batch thread delete no longer asks to delete Scratch folders (#1481)
## Problem Deleting several threads at once asks "Delete the worktrees too?" and counts Scratch thread folders as worktrees. Upstream's single-thread delete skips Scratch projects, so a Scratch folder is never a removable worktree, but the fork's batch confirmation from `f85dee500fe` predates Scratch projects and still counts them. Nothing is deleted, because the per-thread step refuses Scratch folders; the prompt is wrong. ## Change The batch collector applies upstream's `isScratchProject` exclusion beside its existing missing-project check, reading the environment config once per environment. It stays inline and upstream-native, like the batch confirmation it fixes, so it drops alone with that commit. ## Scope and approval Small fix of a fork bug exposed by the upstream Scratch projects feature in the 2525 sync. Found by the independent review of that sync. ## Verification - `vp run typecheck` in `apps/web` → exit 0 - `vp lint` on the touched files → no new findings - `vp run fork:ci` → exit 0; one earlier run timed out in `scripts/install.test.ts`, unrelated, and passed on rerun - Not checked in a real client: no test covers this hook-bound path, and the release UAT does not exercise Scratch batch deletes 🤖 claude-opus-5-5 via Claude Code in T3 Code ## Fork trailers Fork-Domain: upstream-fixes Fork-Tier: bugfix Fork-Upstreamable: yes Co-authored-by: donjor <[email protected]>
1 parent 0de4eac commit eb1bf01

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

‎apps/web/src/hooks/useThreadActions.ts‎

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -421,17 +421,25 @@ export function useThreadActions() {
421421

422422
const pathKeys = new Set<string>();
423423
for (const [environmentId, threadIds] of threadIdsByEnvironment) {
424-
const environmentSettings = appAtomRegistry
424+
const environmentConfig = appAtomRegistry
425425
.get(environmentServerConfigsAtom)
426-
.get(environmentId)?.settings;
426+
.get(environmentId);
427+
const environmentSettings = environmentConfig?.settings;
427428
const threads = readEnvironmentThreadRefs(environmentId).flatMap((ref) => {
428429
const shell = readThreadShell(ref);
429430
return shell === null ? [] : [shell];
430431
});
432+
// A Scratch folder is not a git worktree, so the batch never asks about one.
433+
const isWorktreeProject = (projectId: (typeof threads)[number]["projectId"]) => {
434+
const project = readProject({ environmentId, projectId });
435+
return (
436+
project !== null && !isScratchProject(project, environmentConfig?.scratchWorkspaceRoot)
437+
);
438+
};
431439
const removableThreadIds = new Set(
432440
threads.flatMap((shell) =>
433441
threadIds.has(shell.id) &&
434-
readProject({ environmentId, projectId: shell.projectId }) !== null &&
442+
isWorktreeProject(shell.projectId) &&
435443
!(environmentSettings
436444
? resolveWorktreeCleanup(environmentSettings, shell.projectId).worktreeOnDelete
437445
: false)

0 commit comments

Comments
 (0)