@@ -2615,6 +2615,96 @@ describe("OrchestratorMcpService provider resolution", () => {
26152615 } ) ,
26162616 ) ;
26172617
2618+ it . effect ( "accepts the inherited options it reports back as a delegate target" , ( ) =>
2619+ Effect . gen ( function * ( ) {
2620+ // t3_thread_launch keeps a model selection as given, so a thread can hold an option its model lacks.
2621+ const inherited = {
2622+ instanceId : codexInstanceId ,
2623+ model : "gpt-5.4" ,
2624+ options : [
2625+ { id : "reasoningEffort" , value : "low" } ,
2626+ { id : "fastMode" , value : false } ,
2627+ ] ,
2628+ } as const ;
2629+ const commands : Array < { readonly modelSelection ?: unknown } > = [ ] ;
2630+ const task = {
2631+ id : taskId ,
2632+ threadId : parentThreadId ,
2633+ origin : "app_owned" ,
2634+ childThreadId,
2635+ providerInstanceId : codexInstanceId ,
2636+ model : inherited . model ,
2637+ status : "running" ,
2638+ result : null ,
2639+ } ;
2640+ const dependencies = Layer . mergeAll (
2641+ NodeServices . layer ,
2642+ Layer . mock ( ThreadManagementService . ThreadManagementService ) ( {
2643+ hasReceipt : ( ) => Effect . succeed ( false ) ,
2644+ assertProviderInstanceEnabled : ( ) => Effect . void ,
2645+ getThreadRecords : ( threadId ) =>
2646+ Effect . succeed (
2647+ threadId === parentThreadId
2648+ ? parentProjection ( commands . length > 0 ? [ task ] : [ ] , inherited )
2649+ : childProjection ,
2650+ ) ,
2651+ dispatch : ( command ) =>
2652+ Effect . sync ( ( ) => {
2653+ commands . push ( command as { readonly modelSelection ?: unknown } ) ;
2654+ return {
2655+ sequence : 1 ,
2656+ storedEvents : [ { event : { type : "subagent.updated" , payload : task } } ] ,
2657+ } as never ;
2658+ } ) ,
2659+ } ) ,
2660+ ServerSettings . layerTest ( ) ,
2661+ providerRegistryLayer ( [
2662+ {
2663+ ...providerSnapshot ( {
2664+ instanceId : codexInstanceId ,
2665+ driver : ProviderDriverKind . make ( "codex" ) ,
2666+ } ) ,
2667+ models : [
2668+ {
2669+ slug : inherited . model ,
2670+ name : inherited . model ,
2671+ isCustom : false ,
2672+ capabilities : {
2673+ optionDescriptors : [
2674+ {
2675+ id : "reasoningEffort" ,
2676+ label : "Reasoning" ,
2677+ type : "select" ,
2678+ options : [ { id : "low" , label : "Low" } ] ,
2679+ } ,
2680+ ] ,
2681+ } ,
2682+ } ,
2683+ ] ,
2684+ } ,
2685+ ] ) ,
2686+ adapterRegistryLayer ( [ codexInstanceId ] ) ,
2687+ Layer . mock ( ProjectService . ProjectService ) ( { } ) ,
2688+ Layer . mock ( SecretRequests . SecretRequests ) ( { } ) ,
2689+ Layer . mock ( RemoteDelegation . RemoteDelegation ) ( { } ) ,
2690+ Layer . mock ( ScheduledTaskService . ScheduledTaskService ) ( { } ) ,
2691+ ) ;
2692+ yield * Effect . gen ( function * ( ) {
2693+ const service = yield * OrchestratorMcpService . OrchestratorMcpService ;
2694+ const { inheritedOptions } = yield * service . capabilities ( scope ) ;
2695+ yield * service . delegateTask ( scope , {
2696+ task : "Review the change." ,
2697+ target : yield * decodeTarget ( { options : inheritedOptions } ) ,
2698+ mode : "async" ,
2699+ } ) ;
2700+ assert . deepEqual ( commands [ 0 ] ?. modelSelection , {
2701+ ...inherited ,
2702+ options : [ inherited . options [ 0 ] ] ,
2703+ } ) ;
2704+ } ) . pipe ( Effect . provide ( layerOrchestratorService . pipe ( Layer . provide ( dependencies ) ) ) ) ;
2705+ } ) ,
2706+ ) ;
2707+
26182708 describe ( "resolveRuntimeMode" , ( ) => {
26192709 const muse = {
26202710 modelSelection : { instanceId : ProviderInstanceId . make ( "muse" ) , model : "muse-model" } ,
0 commit comments