@@ -52,6 +52,7 @@ import {
5252 buildCodexRoutePolicyPreview ,
5353 buildCodexRoutePolicyRowStates ,
5454 buildCodexRoutingProbeModelOptions ,
55+ buildCodexRoutingProbeRequestInput ,
5556 buildCodexRoutingProbeStreamLines ,
5657 buildOpenAICompatibleModelMappings ,
5758 canEditCodexModelMappings ,
@@ -126,15 +127,14 @@ export default function CodexAccountListFeature({ sidecarStatus }: CodexAccountL
126127 const orderChanged = orderDirty ;
127128 const routingProbeModelOptions = useMemo ( ( ) => buildCodexRoutingProbeModelOptions ( orderedRows ) , [ orderedRows ] ) ;
128129 const requestableRows = useMemo ( ( ) => orderedRows . filter ( ( row ) => row . requestable ) , [ orderedRows ] ) ;
129- const requestableOrderIDs = useMemo ( ( ) => requestableRows . map ( ( row ) => row . id ) , [ requestableRows ] ) ;
130130 const routePolicyDraft = useMemo (
131131 ( ) => ( {
132132 allowAccountIDs : [ ] ,
133133 denyAccountIDs : [ ] ,
134- orderAccountIDs : requestableOrderIDs ,
135- allowFallback : false ,
134+ orderAccountIDs : [ ] ,
135+ allowFallback : true ,
136136 } ) ,
137- [ requestableOrderIDs ] ,
137+ [ ] ,
138138 ) ;
139139 const routePolicyPreviewRows = useMemo (
140140 ( ) => buildCodexRoutePolicyPreview ( orderedRows , routePolicyDraft ) ,
@@ -159,10 +159,6 @@ export default function CodexAccountListFeature({ sidecarStatus }: CodexAccountL
159159 ) ;
160160 const latestRoutingProbeAttempt = routingProbeAttempts [ routingProbeAttempts . length - 1 ] || null ;
161161 const latestRoutingProbeAccountID = latestRoutingProbeAttempt ?. accountID || '' ;
162- const latestRoutingProbeExpectedID = routePolicyPreviewRows [ 0 ] ?. id || '' ;
163- const latestRoutingProbeUsedFallback =
164- Boolean ( latestRoutingProbeAccountID && latestRoutingProbeExpectedID ) &&
165- latestRoutingProbeAccountID !== latestRoutingProbeExpectedID ;
166162 const routingProbeDisabled = ! ready || saving || routingProbeRunning || ! routingProbeModel . trim ( ) ;
167163
168164 async function reload ( messageOverride ?: string ) {
@@ -598,26 +594,31 @@ export default function CodexAccountListFeature({ sidecarStatus }: CodexAccountL
598594 channelOrder : index ,
599595 } ) ) ;
600596 const result = main . ChannelRoutingExplainResult . createFrom ( {
601- channel : 'codex' ,
602- routeMode : nextConfig . routeMode ,
603- selectedAccountID : candidates [ 0 ] ?. id || '' ,
604- candidates,
605- filtered : orderedRows
606- . filter ( ( row ) => ! row . requestable )
607- . map ( ( row ) => ( { id : row . id , reason : row . disabled ? 'account-disabled' : 'account-unrequestable' } ) ) ,
608- steps : [ `mode:${ nextConfig . routeMode } ` , `candidates:${ candidates . length } ` , 'preview:browser' ] ,
609- snapshotVersion : 'preview' ,
610- policyVersion : 'channel-routing-v1' ,
611- shadow : nextConfig . shadowEnabled
612- ? {
613- enabled : true ,
614- routeMode : nextConfig . shadowRouteMode ,
615- selectedAccountID : candidates [ candidates . length - 1 ] ?. id || candidates [ 0 ] ?. id || '' ,
616- diff : Boolean ( candidates . length > 1 ) ,
617- steps : [ `mode:${ nextConfig . shadowRouteMode } ` , `candidates:${ candidates . length } ` , 'preview:shadow' ] ,
597+ channel : 'codex' ,
598+ routeMode : nextConfig . routeMode ,
599+ selectedAccountID : candidates [ 0 ] ?. id || '' ,
600+ candidates,
601+ filtered : orderedRows
602+ . filter ( ( row ) => ! row . requestable )
603+ . map ( ( row ) => ( { id : row . id , reason : row . disabled ? 'account-disabled' : 'account-unrequestable' } ) ) ,
604+ steps : [
605+ `mode:${ nextConfig . routeMode } ` ,
606+ 'legacy:compatibility-mask=blocked' ,
607+ `candidates:${ candidates . length } ` ,
608+ 'preview:browser' ,
609+ ] ,
610+ snapshotVersion : 'preview' ,
611+ policyVersion : 'channel-routing-v1' ,
612+ shadow : nextConfig . shadowEnabled
613+ ? {
614+ enabled : true ,
615+ routeMode : nextConfig . shadowRouteMode ,
616+ selectedAccountID : candidates [ candidates . length - 1 ] ?. id || candidates [ 0 ] ?. id || '' ,
617+ diff : Boolean ( candidates . length > 1 ) ,
618+ steps : [ `mode:${ nextConfig . shadowRouteMode } ` , `candidates:${ candidates . length } ` , 'preview:shadow' ] ,
618619 }
619- : undefined ,
620- } ) ;
620+ : undefined ,
621+ } ) ;
621622 setChannelExplain ( result ) ;
622623 const event = buildPreviewChannelRouteAuditEvent ( { channel : 'codex' , explain : result } ) ;
623624 setChannelRouteEvents ( ( prev ) => ( event ? [ event , ...prev ] . slice ( 0 , 5 ) : prev ) ) ;
@@ -684,14 +685,7 @@ export default function CodexAccountListFeature({ sidecarStatus }: CodexAccountL
684685 try {
685686 const collectedAttempts : CodexRoutingProbeAttemptView [ ] = [ ] ;
686687 for ( let attemptIndex = 0 ; attemptIndex < safeAttempts ; attemptIndex += 1 ) {
687- const routePolicyInput = {
688- model,
689- attempts : 1 ,
690- allowAccountIDs : [ ] ,
691- denyAccountIDs : [ ] ,
692- orderAccountIDs : requestableOrderIDs ,
693- allowFallback : false ,
694- } ;
688+ const routePolicyInput = buildCodexRoutingProbeRequestInput ( model , 1 ) ;
695689 const result = await trackRequest ( 'ProbeCodexAccountRouting' , { ...routePolicyInput , index : attemptIndex + 1 } , ( ) =>
696690 ProbeCodexAccountRouting (
697691 main . ProbeCodexAccountRoutingInput . createFrom ( {
@@ -957,7 +951,6 @@ export default function CodexAccountListFeature({ sidecarStatus }: CodexAccountL
957951 routingProbeDisabled = { routingProbeDisabled || routePolicyPreviewRows . length === 0 }
958952 routePolicyPreviewRows = { routePolicyPreviewRows }
959953 routingProbeStreamLines = { routingProbeStreamLines }
960- latestUsedFallback = { latestRoutingProbeUsedFallback }
961954 onClose = { ( ) => setRouteProbeOpen ( false ) }
962955 onModelChange = { setRoutingProbeModel }
963956 onProbeOnce = { ( ) => void runRoutingProbe ( 1 ) }
0 commit comments