feat(orchestrator): archive and delete owned subagent subtrees #3878
ClosedPixPMusic(GitHub profile, opens in a new tab)wants to merge 1 commit into
t3code/codex-turn-mapping fromrefs/pull/3878/headopened View on GitHubgithub-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:XXL
PixPMusic(GitHub profile, opens in a new tab) closed this
- @@ -78,3 +79,8 @@7879 if (run === undefined) {7980 return yield* new ProviderTurnStartError({ runId, cause: `Run ${runId} was not found.` });8081 }82+ const providerThread = projection.providerThreads.find(83+ (candidate) => candidate.id === run.providerThreadId,84+ );85+ if (projection.thread.archivedAt !== null || projection.thread.deletedAt !== null) {86+ if (@@ -648,13 +653,4 @@648653 runId: input.run.id,649654 nodeId: input.rootNode.id,650655 event,651- ...(event.type === "provider_thread.updated" &&652- event.providerThread.id === input.providerThread.id653- ? {654- writeIfRunCurrent: {655- runId: input.run.id,656- activeAttemptId: input.attempt.id,657- expectedStatus: "running" as const,658- },659- }660- : {}),656+ writeIfRunCurrent: {@@ -0,0 +27,21 @@27+>()("t3/orchestration-v2/CheckpointCleanupService/CheckpointCleanupServiceV2") {}28+29+export const layer: Layer.Layer<30+ CheckpointCleanupServiceV2,31+ never,32+ CheckpointServiceV2 | ProjectionStoreV233+> = Layer.effect(34+ CheckpointCleanupServiceV2,35+ Effect.gen(function* () {36+ const checkpoints = yield* CheckpointServiceV2;37+ const projections = yield* ProjectionStoreV2;38+39+ const cleanup = Effect.fn("orchestrationV2.checkpointCleanup.cleanup")(function* (40+ threadId: ThreadId,41+ ) {42+ const projection = yield* projections.getThreadProjection(threadId);43+ const throughOrdinal = Math.max(44+ 0,45+ ...projection.runs.map((run) => run.ordinal),46+ ...projection.checkpoints.map((checkpoint) => checkpoint.ordinalWithinScope),47+ );
- @@ -781,0 +859,21 @@859+ command: Extract<860+ OrchestrationV2Command,861+ { readonly type: "thread.archive" | "thread.unarchive" | "thread.delete" }862+ >,863+ rootProjection: OrchestrationV2ThreadProjection,864+ events: Ref.Ref<Array<OrchestrationV2DomainEvent>>,865+ effects: Ref.Ref<Array<PendingOrchestrationEffectV2>>,866+ ) {867+ const shell = yield* projectionStore.getShellSnapshot().pipe(868+ Effect.mapError(869+ (cause) =>870+ new OrchestratorProjectionError({871+ threadId: command.threadId,872+ cause,873+ }),874+ ),875+ );876+ const descendants = ownedSubagentDescendants(command.threadId, [877+ ...shell.threads,878+ ...shell.archivedThreads,879+ ]);
Sign in to join this conversation.


Important
Review skipped#
Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
.coderabbit.yamlfile in this repository. To trigger a single review, invoke the@coderabbitai reviewcommand.⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID:
0078d2e8-d8e2-4542-a264-f2bc45bd60e5You can disable this status message by setting the
reviews.review_statustofalsein the CodeRabbit configuration file.Use the checkbox below for a quick retry:
✨ Finishing Touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
❤️ Share