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

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -674,6 +674,14 @@ it.effect(
nodeId: rootNodeId,
status: "running",
},
...(["assistant_message", "reasoning", "proposed_plan"] as const).map((type) => ({
id: TurnItemId.make(`turn_item_recovery_cancel_${type}`),
runId,
nodeId: rootNodeId,
type,
status: "running",
streaming: true,
})),
],
} as unknown as OrchestrationV2ThreadProjection;
const layer = ProviderRuntimeRecovery.layer.pipe(
Expand Down Expand Up @@ -727,12 +735,27 @@ it.effect(
["provider-turn.updated", "cancelled"],
["message.updated", null],
["turn-item.updated", "cancelled"],
["turn-item.updated", "cancelled"],
["turn-item.updated", "cancelled"],
["turn-item.updated", "cancelled"],
["provider-thread.updated", "idle"],
["provider-session.updated", "stopped"],
],
);
const messageEvent = events.find((event) => event.type === "message.updated");
assert.isFalse(messageEvent?.type === "message.updated" && messageEvent.payload.streaming);
assert.deepEqual(
events.flatMap((event) =>
event.type === "turn-item.updated" && "streaming" in event.payload
? [[event.payload.type, event.payload.streaming]]
: [],
),
[
["assistant_message", false],
["reasoning", false],
["proposed_plan", false],
],
);
}).pipe(Effect.provide(layer));
},
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,13 @@ const cancelledItem = (
): OrchestrationV2ThreadProjection["turnItems"][number] =>
item.type === "secret_request" && item.secretStatus === "pending"
? { ...item, status: "cancelled", secretStatus: "cancelled", completedAt: now, updatedAt: now }
: { ...item, status: "cancelled", completedAt: now, updatedAt: now };
: {
...item,
...("streaming" in item ? { streaming: false } : {}),
status: "cancelled",
completedAt: now,
updatedAt: now,
};

function latestStartedRun(
projection: ProjectionStore.ProjectionRuntimeRecoveryState,
Expand Down
Loading