Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions apps/server/src/environment/ServerEnvironment.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,7 @@ it.layer(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer))("ServerEnvironmen
expect(second.capabilities.requiredWorktreeBootstrap).toBe(true);
expect(second.capabilities.usagePriceOverrides).toBe(true);
expect(second.capabilities.threadActiveReorder).toBe(true);
expect(second.capabilities.threadFolders).toBe(true);
expect(second.capabilities.threadTitleRegeneration).toBe(true);
expect(second.capabilities.threadPullRequests).toBe(true);
expect(second.capabilities.threadPullRequestLinking).toBe(true);
Expand Down
1 change: 1 addition & 0 deletions apps/server/src/environment/ServerEnvironment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@ export const make = Effect.gen(function* () {
threadPinning: true,
threadPinReorder: true,
threadActiveReorder: true,
threadFolders: true,
threadAutoSettleOptOut: true,
threadProjectFromScratch: true,
threadTitleRegeneration: true,
Expand Down
6 changes: 6 additions & 0 deletions apps/server/src/orchestration-v2/EffectOutbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,11 @@ export const OrchestrationEffectRequestV2 = Schema.Union([
type: Schema.Literal("delegated-tasks.stop"),
reason: Schema.optional(Schema.String),
}),
Schema.Struct({
type: Schema.Literal("fork-folder.place"),
sourceThreadId: ThreadId,
threadId: ThreadId,
}),
]);
export type OrchestrationEffectRequestV2 = typeof OrchestrationEffectRequestV2.Type;

Expand All @@ -156,6 +161,7 @@ export const REPLAY_SAFE_EFFECT_TYPES_AFTER_PROCESS_LOSS = [
"thread-content.purge",
"thread-title.generate",
"delegated-tasks.stop",
"fork-folder.place",
] as const satisfies ReadonlyArray<OrchestrationEffectRequestV2["type"]>;

export const PROCESS_BOUND_EFFECT_TYPES = [
Expand Down
5 changes: 5 additions & 0 deletions apps/server/src/orchestration-v2/EffectWorker.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import * as CheckpointRollbackService from "./CheckpointRollbackService.ts";
import * as CheckpointService from "./CheckpointService.ts";
import * as EffectOutbox from "./EffectOutbox.ts";
import * as EffectWorker from "./EffectWorker.ts";
import * as ForkFolderService from "./ForkFolderService.ts";
import * as ProjectionMaintenance from "./ProjectionMaintenance.ts";
import * as ProjectionStore from "./ProjectionStore.ts";
import * as RunFinalizationService from "./RunFinalizationService.ts";
Expand Down Expand Up @@ -170,6 +171,10 @@ function layerExecutorFor(input: {
execute: () => Effect.void,
}),
),
Layer.succeed(
ForkFolderService.ForkFolderService,
ForkFolderService.ForkFolderService.of({ place: () => Effect.void }),
),
);
return EffectWorker.layerExecutor.pipe(
Layer.provide(
Expand Down
19 changes: 19 additions & 0 deletions apps/server/src/orchestration-v2/EffectWorker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {
import * as RunFinalizationService from "./RunFinalizationService.ts";
import * as ResourceCleanupService from "./ResourceCleanupService.ts";
import * as EffectOutbox from "./EffectOutbox.ts";
import * as ForkFolderService from "./ForkFolderService.ts";
import * as ProjectionMaintenance from "./ProjectionMaintenance.ts";
import * as ProjectionStore from "./ProjectionStore.ts";
import * as CheckpointRollbackService from "./CheckpointRollbackService.ts";
Expand Down Expand Up @@ -100,6 +101,7 @@ export const layerExecutor: Layer.Layer<
| ProviderTurnStartService.ProviderTurnStartServiceV2
| RuntimeRequestService.RuntimeRequestServiceV2
| ThreadTitleRegenerationService.ThreadTitleRegenerationService
| ForkFolderService.ForkFolderService
| ThreadManagementService.ThreadManagementService
| ProjectionStore.ProjectionStoreV2
| ProjectionMaintenance.ProjectionMaintenanceV2
Expand All @@ -116,6 +118,7 @@ export const layerExecutor: Layer.Layer<
const runtimeRequests = yield* RuntimeRequestService.RuntimeRequestServiceV2;
const threadTitleRegeneration =
yield* ThreadTitleRegenerationService.ThreadTitleRegenerationService;
const forkFolders = yield* ForkFolderService.ForkFolderService;
const threads = yield* ThreadManagementService.ThreadManagementService;
const projectionStore = yield* ProjectionStore.ProjectionStoreV2;
const projectionMaintenance = yield* ProjectionMaintenance.ProjectionMaintenanceV2;
Expand Down Expand Up @@ -728,6 +731,22 @@ export const layerExecutor: Layer.Layer<
}),
),
);
case "fork-folder.place":
return forkFolders
.place({
sourceThreadId: effect.request.sourceThreadId,
threadId: effect.request.threadId,
})
.pipe(
Effect.mapError(
(cause) =>
new OrchestrationEffectExecutionError({
effectId: effect.id,
effectType: effect.request.type,
cause,
}),
),
);
}
}),
});
Expand Down
Loading
Loading