Skip to content
Source
Sign inSign up
pingdotgg/t3code

feat(server): idle threads can move to another project #26139

Closedsome-du6e(GitHub profile, opens in a new tab)wants to merge 6 commits intomain fromrefs/pull/26139/headopened View on GitHub

Showing 3 changed files with 99 additions and 0 deletions.

x
0 of 3 viewed, 3 left
26 additions and 0 deletionsapps/server/src/orchestration-v2/Orchestrator.tsModified
View file
@@ -2941,6 +2941,29 @@
cause: `Thread ${command.threadId} is no longer empty.`,
+ const targetProjectId =
+ command.type === "thread.metadata.update" && command.projectId !== thread.projectId
+ ? command.projectId
+ : undefined;
+ if (targetProjectId !== undefined) {
+ const project = yield* projects.get(targetProjectId).pipe(mapDispatchError(command));
+ const { subagents } = yield* projectionStore
+ .getThreadRecords(command.threadId, ["subagents"])
+ .pipe(mapDispatchError(command));
+ if (
+ Option.isNone(project) ||
+ project.value.deletedAt !== null ||
+ thread.settledAt === null ||
+ thread.lineage.relationshipToParent === "subagent" ||
+ subagents.some((task) => task.childThreadId !== null)
+ ) {
+ return yield* new OrchestratorDispatchError({
+ commandId: command.commandId,
+ commandType: command.type,
+ cause: `Only a settled top-level thread without child threads can move to an existing project.`,
+ });
+ }
+ }
if (command.type === "thread.archive" && thread.archivedAt !== null) {
return yield* new OrchestratorDispatchError({
commandId: command.commandId,