Skip to content
Source
Sign inSign up
pingdotgg/t3code

perf(server): starting a turn on a long thread no longer scans its messages, tasks and transfers #39103

Mergedbrauliobo(GitHub profile, opens in a new tab)merged 5 commits intomain fromrefs/pull/39103/headmerged by juliusmarminge View on GitHub

Showing 6 changed files with 187 additions and 0 deletions (loading 5).

x
0 of 6 viewed, 6 left
187 additions and 0 deletionsapps/server/src/orchestration-v2/ProjectionStore.test.tsModified
View file
@@ -7334,6 +7334,193 @@
+ it.effect(
+ "a turn start reads a long thread's deferred commands, routable tasks and fork by index",
+ () =>
+ Effect.gen(function* () {
+ const projectionStore = yield* ProjectionStore.ProjectionStoreV2;
+ const sql = yield* SqlClient.SqlClient;
+ const threadId = yield* addRolledBackRecoveryCandidate("turn-start-commands");
+ const runId = RunId.make("run:turn-start-commands:rolled-back");
+ const created = yield* DateTime.now;
+ const nowIso = DateTime.formatIso(created);
+ const message = (id: string, role: "user" | "assistant", text: string, minutes: number) =>
+ projectionStore.apply({
+ id: EventId.make(`event:${id}`),
+ type: "message.updated",
+ threadId,
+ occurredAt: created,
+ payload: {
+ id: MessageId.make(id),
+ threadId,
+ runId: null,
+ nodeId: null,
+ role,
+ text,
+ attachments: [],
+ streaming: false,
+ createdBy: "user",