@@ -2979,6 +2979,96 @@ describe("OrchestratorMcpService provider resolution", () => {
29792979 } ) ,
29802980 ) ;
29812981
2982+ it . effect ( "accepts the inherited options it reports back as a delegate target" , ( ) =>
2983+ Effect . gen ( function * ( ) {
2984+ // t3_thread_launch keeps a model selection as given, so a thread can hold an option its model lacks.
2985+ const inherited = {
2986+ instanceId : codexInstanceId ,
2987+ model : "gpt-5.4" ,
2988+ options : [
2989+ { id : "reasoningEffort" , value : "low" } ,
2990+ { id : "fastMode" , value : false } ,
2991+ ] ,
2992+ } as const ;
2993+ const commands : Array < { readonly modelSelection ?: unknown } > = [ ] ;
2994+ const task = {
2995+ id : taskId ,
2996+ threadId : parentThreadId ,
2997+ origin : "app_owned" ,
2998+ childThreadId,
2999+ providerInstanceId : codexInstanceId ,
3000+ model : inherited . model ,
3001+ status : "running" ,
3002+ result : null ,
3003+ } ;
3004+ const dependencies = Layer . mergeAll (
3005+ NodeServices . layer ,
3006+ Layer . mock ( ThreadManagementService . ThreadManagementService ) ( {
3007+ hasReceipt : ( ) => Effect . succeed ( false ) ,
3008+ assertProviderInstanceEnabled : ( ) => Effect . void ,
3009+ getThreadRecords : ( threadId ) =>
3010+ Effect . succeed (
3011+ threadId === parentThreadId
3012+ ? parentProjection ( commands . length > 0 ? [ task ] : [ ] , inherited )
3013+ : childProjection ,
3014+ ) ,
3015+ dispatch : ( command ) =>
3016+ Effect . sync ( ( ) => {
3017+ commands . push ( command as { readonly modelSelection ?: unknown } ) ;
3018+ return {
3019+ sequence : 1 ,
3020+ storedEvents : [ { event : { type : "subagent.updated" , payload : task } } ] ,
3021+ } as never ;
3022+ } ) ,
3023+ } ) ,
3024+ ServerSettings . layerTest ( ) ,
3025+ providerRegistryLayer ( [
3026+ {
3027+ ...providerSnapshot ( {
3028+ instanceId : codexInstanceId ,
3029+ driver : ProviderDriverKind . make ( "codex" ) ,
3030+ } ) ,
3031+ models : [
3032+ {
3033+ slug : inherited . model ,
3034+ name : inherited . model ,
3035+ isCustom : false ,
3036+ capabilities : {
3037+ optionDescriptors : [
3038+ {
3039+ id : "reasoningEffort" ,
3040+ label : "Reasoning" ,
3041+ type : "select" ,
3042+ options : [ { id : "low" , label : "Low" } ] ,
3043+ } ,
3044+ ] ,
3045+ } ,
3046+ } ,
3047+ ] ,
3048+ } ,
3049+ ] ) ,
3050+ adapterRegistryLayer ( [ codexInstanceId ] ) ,
3051+ Layer . mock ( ProjectService . ProjectService ) ( { } ) ,
3052+ Layer . mock ( SecretRequests . SecretRequests ) ( { } ) ,
3053+ Layer . mock ( RemoteDelegation . RemoteDelegation ) ( { } ) ,
3054+ Layer . mock ( ScheduledTaskService . ScheduledTaskService ) ( { } ) ,
3055+ ) ;
3056+ yield * Effect . gen ( function * ( ) {
3057+ const service = yield * OrchestratorMcpService . OrchestratorMcpService ;
3058+ const { inheritedOptions } = yield * service . capabilities ( scope ) ;
3059+ yield * service . delegateTask ( scope , {
3060+ task : "Review the change." ,
3061+ target : yield * decodeTarget ( { options : inheritedOptions } ) ,
3062+ mode : "async" ,
3063+ } ) ;
3064+ assert . deepEqual ( commands [ 0 ] ?. modelSelection , {
3065+ ...inherited ,
3066+ options : [ inherited . options [ 0 ] ] ,
3067+ } ) ;
3068+ } ) . pipe ( Effect . provide ( layerOrchestratorService . pipe ( Layer . provide ( dependencies ) ) ) ) ;
3069+ } ) ,
3070+ ) ;
3071+
29823072 describe ( "resolveRuntimeMode" , ( ) => {
29833073 const muse = {
29843074 modelSelection : { instanceId : ProviderInstanceId . make ( "muse" ) , model : "muse-model" } ,
0 commit comments