Skip to content
Merged
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
16 changes: 4 additions & 12 deletions apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5282,6 +5282,7 @@ interface ActiveClaudeTurnContext {
readonly providerTurnOrdinal: number;
readonly startedAt: DateTime.Utc;
readonly itemOrdinals: Map<string, number>;
readonly planIds: Map<string, OrchestrationV2PlanArtifact["id"]>;
readonly assistant: {
fallbackText: string;
// Result-only replies of steered segments that ended before the current one.
Expand Down Expand Up @@ -6234,9 +6235,6 @@ export const makeClaudeAdapterV2 = Effect.fn("makeClaudeAdapterV2")(function* (
const taskListsByNativeThread = yield* Ref.make(
new Map<string, ClaudeTaskList | undefined>(),
);
const planIdsByNativeItem = yield* Ref.make(
new Map<string, OrchestrationV2PlanArtifact["id"]>(),
);
const providerRetries = yield* Ref.make(
new Map<OrchestrationV2ProviderTurn["id"], ActiveClaudeProviderRetry>(),
);
Expand Down Expand Up @@ -8665,22 +8663,15 @@ export const makeClaudeAdapterV2 = Effect.fn("makeClaudeAdapterV2")(function* (
}) {
const updatedAt = yield* DateTime.now;
const projectionNativeItemId = `${input.kind}:${input.nativeItemId}`;
const planKey = `${input.context.input.threadId}:${projectionNativeItemId}`;
const existingPlanId = (yield* Ref.get(planIdsByNativeItem)).get(planKey);
const existingPlanId = input.context.planIds.get(projectionNativeItemId);
const planId =
existingPlanId ??
(yield* idAllocator.allocate.plan({
threadId: input.context.input.threadId,
runId: input.context.input.runId,
driver: CLAUDE_PROVIDER,
}));
if (existingPlanId === undefined) {
yield* Ref.update(planIdsByNativeItem, (current) => {
const updated = new Map(current);
updated.set(planKey, planId);
return updated;
});
}
input.context.planIds.set(projectionNativeItemId, planId);
const nodeId = idAllocator.derive.nodeFromProviderItem({
driver: CLAUDE_PROVIDER,
nativeItemId: projectionNativeItemId,
Expand Down Expand Up @@ -13831,6 +13822,7 @@ export const makeClaudeAdapterV2 = Effect.fn("makeClaudeAdapterV2")(function* (
providerTurnOrdinal,
startedAt,
itemOrdinals: new Map(),
planIds: new Map(),
assistant: {
fallbackText: "",
earlierFallbackText: "",
Expand Down
Loading