Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): storage cleanup counts a thread's subagents as part of its worktree #16474

ClosedInfo-Cado(GitHub profile, opens in a new tab)wants to merge 3 commits intomain fromrefs/pull/16474/headopened View on GitHub

Showing 3 changed files with 99 additions and 0 deletions (loading 2).

x
0 of 3 viewed, 3 left
99 additions and 0 deletionsapps/server/src/storageCleanup.test.tsModified
View file
@@ -12,6 +12,8 @@
storageCleanupActivityAt,
storageCleanupPullRequestMerged,
storageCleanupThreadIdle,
+ storageCleanupWorktreeActivityAt,
+ storageCleanupWorktreeOwner,
} from "./storageCleanup.ts";
​
const NOW_MS = Date.parse("2026-06-10T12:00:00.000Z");
@@ -196,3 +198,100 @@
expect(storageCleanupPullRequestMerged(pullRequest({ state: "open" }), integrated)).toBe(false);
});
});
+​
+describe("V2 storage cleanup worktree owner", () => {
+ const worktree = { branch: "feature", worktreePath: "/worktrees/feature" } as const;
+ const owner = shell({ ...worktree, id: ThreadId.make("owner") });
+ const subagent = (
+ id: string,
+ creationSource: "provider" | "mcp",
+ overrides: Partial<OrchestrationV2ThreadShell> = {},
+ ) =>
+ shell({
+ id: ThreadId.make(id),
+ worktreePath: worktree.worktreePath,
+ branch: creationSource === "mcp" ? worktree.branch : null,
+ createdBy: "agent",
+ creationSource,
+ lineage: {