Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): storage cleanup no longer keeps worktrees whose subagents recorded another branch #44276

Openmanakjiri(GitHub profile, opens in a new tab)wants to merge 2 commits intomain fromrefs/pull/44276/headopened View on GitHub

Showing 2 changed files with 72 additions and 2 deletions.

x
0 of 2 viewed, 2 left
57 additions and 0 deletionsapps/server/src/storageCleanup.test.tsModified
View file
@@ -1745,6 +1745,63 @@
}).pipe(Effect.provide(cleanupTestLayer)),
+ const ownerWithReviewSubagent = (worktreePath: string) => {
+ const root = shell({ branch: "feature", worktreePath, settledAt: at(-20 * DAY_MS) });
+ const child = shell({
+ id: ThreadId.make("child"),
+ branch: "review/pr-1",
+ worktreePath,
+ status: "completed",
+ lineage: {
+ parentThreadId: root.id,
+ rootThreadId: root.lineage.rootThreadId,
+ relationshipToParent: "subagent",
+ },
+ });
+ return [root, child];
+ };
+​
+ it.effect("moves a subagent on another branch to the worktree's branch, then removes it", () =>
+ Effect.gen(function* () {
+ yield* TestClock.setTime(NOW_MS);
+ const fixture = yield* cleanupFixture({
+ ...DEFAULT_SERVER_SETTINGS.storageCleanup,
+ worktreeAfterDays: null,
+ worktreeSettledAfterDays: 8,
+ });
+ fixture.setThreads(ownerWithReviewSubagent(fixture.worktree));
+ expect((yield* fixture.service.runNow).entries[0]).toMatchObject({