@@ -1175,6 +1175,55 @@ it.effect("steers a promoted queued message with the selection it was queued wit
11751175 ) ,
11761176) ;
11771177
1178+ it . effect ( "marks the model switch on a promoted message that restarts the turn" , ( ) =>
1179+ Effect . scoped (
1180+ Effect . gen ( function * ( ) {
1181+ const { started, layer, startFirstTurn } = yield * nextTurnSelectionHarness (
1182+ "promote-restart-switch" ,
1183+ true ,
1184+ false ,
1185+ ) ;
1186+ const otherSelection = { ...runSelection , model : "other-model" } ;
1187+ yield * Effect . gen ( function * ( ) {
1188+ const orchestrator = yield * Orchestrator . OrchestratorV2 ;
1189+ const worker = yield * EffectWorker . OrchestrationEffectWorkerV2 ;
1190+ const threadId = yield * startFirstTurn ;
1191+ yield * orchestrator . dispatch ( {
1192+ type : "message.dispatch" ,
1193+ commandId : CommandId . make ( "queued" ) ,
1194+ threadId,
1195+ messageId : MessageId . make ( "message:queued" ) ,
1196+ text : "queued" ,
1197+ attachments : [ ] ,
1198+ modelSelection : otherSelection ,
1199+ dispatchMode : { type : "queue_after_active" } ,
1200+ createdBy : "user" ,
1201+ creationSource : "web" ,
1202+ } ) ;
1203+ const queuedRun = ( yield * orchestrator . getThreadProjection ( threadId ) ) . runs . find (
1204+ ( run ) => run . status === "queued" ,
1205+ ) ! ;
1206+ yield * orchestrator . dispatch ( {
1207+ type : "queued-message.promote-to-steer" ,
1208+ commandId : CommandId . make ( "promote" ) ,
1209+ threadId,
1210+ queuedRunId : queuedRun . id ,
1211+ targetRunId : started [ 0 ] ! . runId ,
1212+ } ) ;
1213+ yield * worker . drain ( ) ;
1214+
1215+ const promoted = ( yield * orchestrator . getThreadProjection ( threadId ) ) . turnItems . find (
1216+ ( item ) => item . type === "user_message" && item . messageId === "message:queued" ,
1217+ ) ;
1218+ assert . deepEqual ( promoted ?. type === "user_message" ? promoted . modelSwitch : undefined , {
1219+ from : runSelection ,
1220+ to : otherSelection ,
1221+ } ) ;
1222+ } ) . pipe ( Effect . provide ( layer ) ) ;
1223+ } ) ,
1224+ ) ,
1225+ ) ;
1226+
11781227it . effect ( "keeps a queued message queued when promoted into a run that Stop reached" , ( ) =>
11791228 Effect . scoped (
11801229 Effect . gen ( function * ( ) {
0 commit comments