Skip to content

Commit a732caa

Browse files
only21milclaude
andauthored
fix(server): Steer on a queued message keeps the model picked for it (#23240)
Co-authored-by: Claude Opus 5.5 <[email protected]>
1 parent 3d74f39 commit a732caa

2 files changed

Lines changed: 43 additions & 1 deletion

File tree

‎apps/server/src/orchestration-v2/Orchestrator.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9440,7 +9440,7 @@ const makeOrchestrator = Effect.fn("orchestrationV2.Orchestrator.layer")(functio
94409440
events,
94419441
effects,
94429442
projection,
9443-
modelSelection: projection.thread.modelSelection,
9443+
modelSelection: queuedRun.modelSelection,
94449444
targetRunId: command.targetRunId,
94459445
messageId: queuedMessage.id,
94469446
text: queuedMessage.text,

‎apps/server/src/orchestration-v2/SteeringCompletion.integration.test.ts‎

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1132,6 +1132,48 @@ it.effect("keeps a held commentary draft before the steer when turn end flushes
11321132
),
11331133
);
11341134

1135+
it.effect("steers a promoted queued message with the selection it was queued with", () =>
1136+
Effect.scoped(
1137+
Effect.gen(function* () {
1138+
const { started, steered, layer, startFirstTurn } = yield* nextTurnSelectionHarness(
1139+
"promote-queued-selection",
1140+
);
1141+
yield* Effect.gen(function* () {
1142+
const orchestrator = yield* Orchestrator.OrchestratorV2;
1143+
const worker = yield* EffectWorker.OrchestrationEffectWorkerV2;
1144+
const threadId = yield* startFirstTurn;
1145+
yield* orchestrator.dispatch({
1146+
type: "message.dispatch",
1147+
commandId: CommandId.make("queued"),
1148+
threadId,
1149+
messageId: MessageId.make("message:queued"),
1150+
text: "queued",
1151+
attachments: [],
1152+
modelSelection: composerSelection,
1153+
dispatchMode: { type: "queue_after_active" },
1154+
createdBy: "user",
1155+
creationSource: "web",
1156+
});
1157+
const queuedRun = (yield* orchestrator.getThreadProjection(threadId)).runs.find(
1158+
(run) => run.status === "queued",
1159+
)!;
1160+
yield* orchestrator.dispatch({
1161+
type: "queued-message.promote-to-steer",
1162+
commandId: CommandId.make("promote"),
1163+
threadId,
1164+
queuedRunId: queuedRun.id,
1165+
targetRunId: started[0]!.runId,
1166+
});
1167+
yield* worker.drain();
1168+
1169+
const projection = yield* orchestrator.getThreadProjection(threadId);
1170+
assert.deepEqual(steered, ["queued"]);
1171+
assert.deepEqual(projection.thread.modelSelection, composerSelection);
1172+
}).pipe(Effect.provide(layer));
1173+
}),
1174+
),
1175+
);
1176+
11351177
it.effect("keeps a queued message queued when promoted into a run that Stop reached", () =>
11361178
Effect.scoped(
11371179
Effect.gen(function* () {

0 commit comments

Comments
 (0)