Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): avoid message ordering scans during recovery and settlement #30582

MergedYash-Singh1(GitHub profile, opens in a new tab)merged 3 commits intomain fromrefs/pull/30582/headmerged by Yash-Singh1(GitHub profile, opens in a new tab) View on GitHub

Showing 6 changed files with 87 additions and 7 deletions (loading 3).

x
0 of 6 viewed, 6 left
10 additions and 7 deletionsapps/server/src/orchestration-v2/Orchestrator.tsModified
View file
@@ -3331,16 +3331,19 @@
if (command.type === "thread.settle") {
- const projection = yield* loadProjectionForCommand(
- command,
- ["runs", "runtimeRequests", "messages"],
- { turnItemTypes: [], messageRoles: ["user"] },
- );
+ const projection = yield* loadProjectionForCommand(command, ["runs", "runtimeRequests"]);
+ const queuedMessages = yield* projectionStore
+ .getMessagesById(
+ command.threadId,
+ projection.runs.filter((run) => run.status === "queued").map((run) => run.userMessageId),
+ )
+ .pipe(mapDispatchError(command));
const automaticMessageIds = new Set(
- projection.messages
+ [...queuedMessages.values()]
.filter(
(message) =>
- message.notification !== undefined || message.delegatedCompletion !== undefined,
+ message.role === "user" &&
+ (message.notification !== undefined || message.delegatedCompletion !== undefined),
.map((message) => message.id),
52 additions and 0 deletionsapps/server/src/orchestration-v2/ProjectionStore.test.tsModified
View file