@@ -72,6 +72,7 @@ const {
7272 INTERNAL_API_SECRET : 'transport-test-secret-000000000000000000' ,
7373 COPILOT_API_KEY : undefined as string | undefined ,
7474 MSHIP_SYSPROMPT_OVERRIDE : undefined as string | undefined ,
75+ MOTHERSHIP_BENCHMARK_URL : 'https://benchmark.test' ,
7576 } ,
7677} ) )
7778
@@ -280,6 +281,7 @@ describe('runCopilotLifecycle', () => {
280281 setEnvFlags ( {
281282 isHosted : false ,
282283 isCopilotToolPermissionsEnabled : false ,
284+ isMothershipBenchmarkEnabled : false ,
283285 } )
284286 mockGetAutoAllowedTools . mockResolvedValue ( new Set < string > ( ) )
285287 mockGetUserPermissionConfig . mockResolvedValue ( null )
@@ -913,24 +915,30 @@ describe('runCopilotLifecycle', () => {
913915 } )
914916 } )
915917
916- it ( 'stamps server-owned transport over caller claims without exposing the instance secret' , async ( ) => {
917- let captured = ''
918- mockRunStreamLoop . mockImplementationOnce ( async ( _url : string , request : RequestInit ) => {
919- captured = String ( request . body )
920- } )
921- await runCopilotLifecycle (
922- { message : 'hello' , simConnection : { mode : 'direct' } } ,
923- {
924- userId : 'user-1' ,
925- workspaceId : 'ws-1' ,
926- }
927- )
928- expect ( JSON . parse ( captured ) . simConnection ) . toEqual ( {
929- mode : 'checkpoint' ,
930- channelId : expect . stringMatching ( / ^ [ a - f 0 - 9 ] { 64 } $ / ) ,
931- } )
932- expect ( captured ) . not . toContain ( mockEnv . INTERNAL_API_SECRET )
933- } )
918+ it . each ( [ '/api/mothership' , '/api/copilot' , '/api/mothership/execute' ] ) (
919+ 'forces benchmark checkpoint transport over caller claims on %s' ,
920+ async ( goRoute ) => {
921+ setEnvFlags ( { isMothershipBenchmarkEnabled : true } )
922+ let captured = ''
923+ mockRunStreamLoop . mockImplementationOnce ( async ( _url : string , request : RequestInit ) => {
924+ captured = String ( request . body )
925+ } )
926+ await runCopilotLifecycle (
927+ { message : 'hello' , simConnection : { mode : 'direct' } } ,
928+ {
929+ userId : 'user-1' ,
930+ workspaceId : 'ws-1' ,
931+ benchmark : 'distill' ,
932+ goRoute,
933+ }
934+ )
935+ expect ( JSON . parse ( captured ) . simConnection ) . toEqual ( {
936+ mode : 'checkpoint' ,
937+ channelId : expect . stringMatching ( / ^ [ a - f 0 - 9 ] { 64 } $ / ) ,
938+ } )
939+ expect ( captured ) . not . toContain ( mockEnv . INTERNAL_API_SECRET )
940+ }
941+ )
934942
935943 it . each ( [ false , true ] ) (
936944 'attaches BYOK without letting a hidden hosted default override it (advanced=%s)' ,
0 commit comments