TypeScript
fix(server): forks no longer inherit pending title regeneration (#24014)
Victor Vogel7f005d4d8d5b
diff --git a/apps/server/src/orchestration-v2/ThreadForkService.test.ts b/apps/server/src/orchestration-v2/ThreadForkService.test.tsindex b6b89758f7b..e1bf75dd128 100644--- a/apps/server/src/orchestration-v2/ThreadForkService.test.ts+++ b/apps/server/src/orchestration-v2/ThreadForkService.test.ts@@ -1,5 +1,6 @@import { assert, it } from "@effect/vitest";import {+ CommandId,ContextTransferId,MessageId,type ModelSelection,@@ -159,6 +160,24 @@ it.effect("keeps a fork awake when its source thread is snoozed", () =>}),);+it.effect("starts a fork without the source thread's pending title regeneration", () =>+ Effect.gen(function* () {+ const sourceRun = makeSourceRun("completed");+ const titleRegeneration = {+ requestId: CommandId.make("command:fork-source-title"),+ startedAt: snoozedAt,+ };+ const sourceProjection = {+ ...makeSourceProjection(sourceRun),+ thread: { ...makeSourceThread(), titleRegeneration },+ };+ const result = yield* planFork(sourceRun, sourceProjection);++ assert.isNull(result.targetThread.titleRegeneration);+ assert.deepEqual(sourceProjection.thread.titleRegeneration, titleRegeneration);+ }),+);+it.effect("preserves pull request context without inheriting any watches", () =>Effect.gen(function* () {const sourceRun = makeSourceRun("completed");diff --git a/apps/server/src/orchestration-v2/ThreadForkService.ts b/apps/server/src/orchestration-v2/ThreadForkService.tsindex a660de9a4e6..71ff9764868 100644--- a/apps/server/src/orchestration-v2/ThreadForkService.ts+++ b/apps/server/src/orchestration-v2/ThreadForkService.ts@@ -90,6 +90,8 @@ export const layer: Layer.Layer<ThreadForkServiceV2> = Layer.succeed(creationSource: input.creationSource,id: input.targetThreadId,title: input.title ?? `${input.sourceProjection.thread.title} fork`,+ // The source's title job completes only on the source thread.+ titleRegeneration: null,activeProviderThreadId: null,lineage: {parentThreadId: input.sourceProjection.thread.id,