TypeScript
fix(server): Steer on a queued message keeps the model picked for it (#23240)
Victor Vogela732caa7d2cb
diff --git a/apps/server/src/orchestration-v2/Orchestrator.ts b/apps/server/src/orchestration-v2/Orchestrator.tsindex 5f9c6ea3993..d1838e7d10f 100644--- a/apps/server/src/orchestration-v2/Orchestrator.ts+++ b/apps/server/src/orchestration-v2/Orchestrator.ts@@ -9440,7 +9440,7 @@ const makeOrchestrator = Effect.fn("orchestrationV2.Orchestrator.layer")(functioevents,effects,projection,- modelSelection: projection.thread.modelSelection,+ modelSelection: queuedRun.modelSelection,targetRunId: command.targetRunId,messageId: queuedMessage.id,text: queuedMessage.text,diff --git a/apps/server/src/orchestration-v2/SteeringCompletion.integration.test.ts b/apps/server/src/orchestration-v2/SteeringCompletion.integration.test.tsindex d4867a264ec..c09b7401df7 100644--- a/apps/server/src/orchestration-v2/SteeringCompletion.integration.test.ts+++ b/apps/server/src/orchestration-v2/SteeringCompletion.integration.test.ts@@ -1132,6 +1132,48 @@ it.effect("keeps a held commentary draft before the steer when turn end flushes),);+it.effect("steers a promoted queued message with the selection it was queued with", () =>+ Effect.scoped(+ Effect.gen(function* () {+ const { started, steered, layer, startFirstTurn } = yield* nextTurnSelectionHarness(+ "promote-queued-selection",+ );+ yield* Effect.gen(function* () {+ const orchestrator = yield* Orchestrator.OrchestratorV2;+ const worker = yield* EffectWorker.OrchestrationEffectWorkerV2;+ const threadId = yield* startFirstTurn;+ yield* orchestrator.dispatch({+ type: "message.dispatch",+ commandId: CommandId.make("queued"),+ threadId,+ messageId: MessageId.make("message:queued"),+ text: "queued",+ attachments: [],+ modelSelection: composerSelection,+ dispatchMode: { type: "queue_after_active" },+ createdBy: "user",+ creationSource: "web",+ });+ const queuedRun = (yield* orchestrator.getThreadProjection(threadId)).runs.find(+ (run) => run.status === "queued",+ )!;+ yield* orchestrator.dispatch({+ type: "queued-message.promote-to-steer",+ commandId: CommandId.make("promote"),+ threadId,+ queuedRunId: queuedRun.id,+ targetRunId: started[0]!.runId,+ });+ yield* worker.drain();++ const projection = yield* orchestrator.getThreadProjection(threadId);+ assert.deepEqual(steered, ["queued"]);+ assert.deepEqual(projection.thread.modelSelection, composerSelection);+ }).pipe(Effect.provide(layer));+ }),+ ),+);+it.effect("keeps a queued message queued when promoted into a run that Stop reached", () =>Effect.scoped(Effect.gen(function* () {