Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): deleting a thread also deletes its subagent threads #39200

Closedpalermo-git(GitHub profile, opens in a new tab)wants to merge 4 commits intomain fromrefs/pull/39200/headopened View on GitHub

Showing 11 changed files with 140 additions and 17 deletions (loading 9).

x
0 of 11 viewed, 11 left
49 additions and 17 deletionsapps/server/src/orchestration-v2/Orchestrator.tsModified
View file
@@ -1933,6 +1933,16 @@
effect.pipe(Effect.mapError((cause) => new OrchestratorProjectionError({ threadId, cause }))),
+ /**
+ * Subagent threads work for their parent, so deleting the parent takes them too. They are found
+ * by their lineage, not the parent's subagent records: a provider can report a subagent's thread
+ * before its record.
+ */
+ const liveSubagentThreadIds = (threadId: ThreadId) =>
+ projectionStore
+ .listLiveSubagentThreadIds(threadId)
+ .pipe(Effect.mapError((cause) => new OrchestratorProjectionError({ threadId, cause })));
+​
const getProjectionWithPendingEvents =
/* This helper runs for individual orchestration events; the enclosing operation owns the span. */
Effect.fnUntraced(function* (
@@ -15646,7 +15656,7 @@
const dispatchOnce = Effect.fn("orchestrationV2.dispatch.once")(function* (
command: OrchestrationV2ServerCommand,
- sideChatIds: ReadonlyArray<ThreadId>,
+ cascadeIds: ReadonlyArray<ThreadId>,
): Effect.fn.Return<
readonly events: ReadonlyArray<OrchestrationV2DomainEvent>;
@@ -15765,13 +15775,13 @@
return { events: [], effects: [] };