@@ -759,6 +759,58 @@ it.effect(
759759 ) ,
760760) ;
761761
762+ it . effect ( "preserves a queued message's model options when promoting it to a steer" , ( ) =>
763+ Effect . scoped (
764+ Effect . gen ( function * ( ) {
765+ const { started, steered, layer, startFirstTurn } = yield * nextTurnSelectionHarness (
766+ "steering-queued-selection" ,
767+ true ,
768+ ) ;
769+ yield * Effect . gen ( function * ( ) {
770+ const orchestrator = yield * Orchestrator . OrchestratorV2 ;
771+ const worker = yield * EffectWorker . OrchestrationEffectWorkerV2 ;
772+ const threadId = yield * startFirstTurn ;
773+ const queuedSelection = {
774+ ...runSelection ,
775+ options : [ { id : "effort" , value : "medium" } ] ,
776+ } ;
777+ yield * orchestrator . dispatch ( {
778+ type : "message.dispatch" ,
779+ commandId : CommandId . make ( "queued" ) ,
780+ threadId,
781+ messageId : MessageId . make ( "message:queued" ) ,
782+ text : "queued with medium effort" ,
783+ attachments : [ ] ,
784+ modelSelection : queuedSelection ,
785+ dispatchMode : { type : "queue_after_active" } ,
786+ createdBy : "user" ,
787+ creationSource : "web" ,
788+ } ) ;
789+ const before = yield * orchestrator . getThreadProjection ( threadId ) ;
790+ const queued = before . runs . find ( ( run ) => run . status === "queued" ) ! ;
791+ assert . deepEqual ( queued . modelSelection , queuedSelection ) ;
792+ assert . deepEqual ( before . thread . modelSelection , runSelection ) ;
793+
794+ yield * orchestrator . dispatch ( {
795+ type : "queued-message.promote-to-steer" ,
796+ commandId : CommandId . make ( "promote" ) ,
797+ threadId,
798+ queuedRunId : queued . id ,
799+ targetRunId : started [ 0 ] ! . runId ,
800+ } ) ;
801+ yield * worker . drain ( ) ;
802+
803+ const after = yield * orchestrator . getThreadProjection ( threadId ) ;
804+ assert . deepEqual ( steered , [ "queued with medium effort" ] ) ;
805+ assert . lengthOf ( started , 1 ) ;
806+ assert . deepEqual ( after . thread . modelSelection , queuedSelection ) ;
807+ assert . deepEqual ( after . runs [ 0 ] ?. modelSelection , runSelection ) ;
808+ assert . equal ( after . runs . find ( ( run ) => run . id === queued . id ) ?. status , "cancelled" ) ;
809+ } ) . pipe ( Effect . provide ( layer ) ) ;
810+ } ) ,
811+ ) ,
812+ ) ;
813+
762814it . effect ( "starts a steer that missed the turn on the saved next-turn selection" , ( ) =>
763815 Effect . scoped (
764816 Effect . gen ( function * ( ) {
0 commit comments