The best way to control Claude Code, Codex and more from any computer or phone
fix(client): project removal counts only listed threads, not side chats or subagents (#29917)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Alex Southwell committed
Nov 3, 2026 at 17:19 UTC
171f78b87918e065427a9d45f5a3f27a6738ae78
2 files changed
+26
-7
apps/web/src/components/settings/ProjectSettingsPanel.logic.test.ts
+19
-5
@@ -1,5 +1,5 @@
1
import { describe, expect, it } from "vite-plus/test";
2
-import { EnvironmentId, ProjectId } from "@t3tools/contracts";
2
+import { EnvironmentId, ProjectId, ThreadId } from "@t3tools/contracts";
3
import { planProjectRemoval } from "@t3tools/client-runtime/state/projects";
4
5
describe("project removal confirmation", () => {
@@ -16,18 +16,32 @@ describe("project removal confirmation", () => {
16
environmentLabel: "Remote",
17
};
18
19
- it("limits a checkout's thread count to its environment and project", () => {
19
+ const parentId = ThreadId.make("parent");
20
+ const listed = { rootThreadId: parentId, parentThreadId: null, relationshipToParent: null };
21
+ const child = { rootThreadId: parentId, parentThreadId: parentId };
22
+
23
+ it("limits a checkout's thread count to its listed threads in that environment and project", () => {
24
const plan = planProjectRemoval({
25
members: [local],
26
groupMemberCount: 2,
27
hasOtherMembers: false,
28
displayName: "Repo",
29
threads: [
26
- { environmentId: local.environmentId, projectId: local.id },
27
- { environmentId: remote.environmentId, projectId: remote.id },
30
+ { environmentId: local.environmentId, projectId: local.id, lineage: listed },
31
+ {
32
+ environmentId: local.environmentId,
33
+ projectId: local.id,
34
+ lineage: { ...child, relationshipToParent: "subagent" },
35
+ },
36
+ {
37
+ environmentId: local.environmentId,
38
+ projectId: local.id,
39
+ lineage: { ...child, relationshipToParent: "fork", sideChat: true },
40
+ },
41
+ { environmentId: remote.environmentId, projectId: remote.id, lineage: listed },
42
],
43
});
30
- expect(plan.projectThreads).toHaveLength(1);
44
+ expect(plan.projectThreads).toHaveLength(3);
45
expect(plan.confirmationMessage).toBe(
46
'Remove checkout "Repo" and delete its 1 thread?\nPath: /work/repo\nEnvironment: Local\nThose threads and any archived threads are deleted from T3 Code. Provider sessions are kept.\nOther entries in this grouped project are unaffected.\nThis action cannot be undone.',
47
);
packages/client-runtime/src/state/projectRemoval.ts
+7
-2
@@ -1,7 +1,9 @@
1
+import { isListedThreadLineage } from "@t3tools/contracts";
2
+
3
import type { EnvironmentProject, EnvironmentThreadShell } from "./models.ts";
4
5
export function planProjectRemoval<
4
- Thread extends Pick<EnvironmentThreadShell, "environmentId" | "projectId">,
6
+ Thread extends Pick<EnvironmentThreadShell, "environmentId" | "projectId" | "lineage">,
7
>(options: {
8
readonly members: ReadonlyArray<
9
Pick<EnvironmentProject, "id" | "environmentId" | "title" | "workspaceRoot"> & {
@@ -20,7 +22,10 @@ export function planProjectRemoval<
22
const projectThreads = threads.filter((thread) =>
23
memberKeys.has(`${thread.environmentId}:${thread.projectId}`),
24
);
23
- const threadCount = projectThreads.length + (options.unloadedThreadCount ?? 0);
25
+ // Side chats and subagents go with their parent but never show in thread lists.
26
+ const threadCount =
27
+ projectThreads.filter((thread) => isListedThreadLineage(thread.lineage)).length +
28
+ (options.unloadedThreadCount ?? 0);
29
const isWholeGroup = members.length === groupMemberCount;
30
const targetKind = hasOtherMembers || !isWholeGroup ? "checkout" : "project";
31
const singleMember = members.length === 1 ? members[0]! : null;