@@ -2563,6 +2563,101 @@ describe("OrchestratorMcpService provider resolution", () => {
25632563 } ) ,
25642564 ) ;
25652565
2566+ it . effect ( "reads a saved Ultracode effort as xhigh with Ultracode on for delegated options" , ( ) =>
2567+ Effect . gen ( function * ( ) {
2568+ const model = "claude-opus-5-5" ;
2569+ const inherited = {
2570+ instanceId : codexInstanceId ,
2571+ model,
2572+ options : [ { id : "effort" , value : "ultracode" } ] ,
2573+ } ;
2574+ const capabilities = {
2575+ optionDescriptors : [
2576+ {
2577+ id : "effort" ,
2578+ label : "Reasoning" ,
2579+ type : "select" as const ,
2580+ options : [
2581+ { id : "high" , label : "High" , isDefault : true } ,
2582+ { id : "xhigh" , label : "Extra High" } ,
2583+ { id : "max" , label : "Max" } ,
2584+ ] ,
2585+ } ,
2586+ { id : "ultracode" , label : "Ultracode" , type : "boolean" as const } ,
2587+ ] ,
2588+ } ;
2589+ const cases = [
2590+ { effort : "max" , expected : "max" } ,
2591+ { effort : "ultracode" , expected : "xhigh" } ,
2592+ ] ;
2593+ for ( const testCase of cases ) {
2594+ const commands : Array < unknown > = [ ] ;
2595+ const task = {
2596+ id : taskId ,
2597+ threadId : parentThreadId ,
2598+ origin : "app_owned" ,
2599+ childThreadId,
2600+ providerInstanceId : codexInstanceId ,
2601+ model,
2602+ status : "running" ,
2603+ result : null ,
2604+ } ;
2605+ const dependencies = Layer . mergeAll (
2606+ NodeServices . layer ,
2607+ Layer . mock ( ThreadManagementService . ThreadManagementService ) ( {
2608+ hasReceipt : ( ) => Effect . succeed ( false ) ,
2609+ assertProviderInstanceEnabled : ( ) => Effect . void ,
2610+ getThreadRecords : ( threadId ) =>
2611+ Effect . succeed (
2612+ threadId === parentThreadId
2613+ ? parentProjection ( commands . length > 0 ? [ task ] : [ ] , inherited )
2614+ : childProjection ,
2615+ ) ,
2616+ dispatch : ( command ) =>
2617+ Effect . sync ( ( ) => {
2618+ commands . push ( command ) ;
2619+ return {
2620+ sequence : 1 ,
2621+ storedEvents : [ { event : { type : "subagent.updated" , payload : task } } ] ,
2622+ } as never ;
2623+ } ) ,
2624+ } ) ,
2625+ ServerSettings . layerTest ( ) ,
2626+ providerRegistryLayer ( [
2627+ {
2628+ ...providerSnapshot ( {
2629+ instanceId : codexInstanceId ,
2630+ driver : ProviderDriverKind . make ( "codex" ) ,
2631+ } ) ,
2632+ models : [ { slug : model , name : model , isCustom : false , capabilities } ] ,
2633+ } ,
2634+ ] ) ,
2635+ adapterRegistryLayer ( [ codexInstanceId ] ) ,
2636+ Layer . mock ( ProjectService . ProjectService ) ( { } ) ,
2637+ Layer . mock ( SecretRequests . SecretRequests ) ( { } ) ,
2638+ Layer . mock ( ScheduledTaskService . ScheduledTaskService ) ( { } ) ,
2639+ ) ;
2640+ yield * Effect . gen ( function * ( ) {
2641+ const service = yield * OrchestratorMcpService . OrchestratorMcpService ;
2642+ yield * service . delegateTask ( scope , {
2643+ task : "Review the change." ,
2644+ target : yield * decodeTarget ( { options : { effort : testCase . effort } } ) ,
2645+ mode : "async" ,
2646+ clientRequestId : testCase . effort ,
2647+ } ) ;
2648+ assert . deepEqual ( ( commands [ 0 ] as { modelSelection : unknown } ) . modelSelection , {
2649+ instanceId : codexInstanceId ,
2650+ model,
2651+ options : [
2652+ { id : "effort" , value : testCase . expected } ,
2653+ { id : "ultracode" , value : true } ,
2654+ ] ,
2655+ } ) ;
2656+ } ) . pipe ( Effect . provide ( layerOrchestratorService . pipe ( Layer . provide ( dependencies ) ) ) ) ;
2657+ }
2658+ } ) ,
2659+ ) ;
2660+
25662661 describe ( "resolveRuntimeMode" , ( ) => {
25672662 const muse = {
25682663 modelSelection : { instanceId : ProviderInstanceId . make ( "muse" ) , model : "muse-model" } ,
0 commit comments