@@ -679,6 +679,59 @@ describe("POST /v1/sessions/start - V3 format", () => {
679679 ) ;
680680 } ) ;
681681
682+ it ( "should reject invalid Bedrock modelClientOptions on session start" , async ( ) => {
683+ const url = getBaseUrl ( ) ;
684+ const bedrockModelName = "bedrock/us.amazon.nova-pro-v1:0" ;
685+ const cases = [
686+ {
687+ name : "missing region" ,
688+ modelClientOptions : {
689+ apiKey : "bedrock-short-term-api-key" ,
690+ } ,
691+ errorSnippet : "providerOptions.region" ,
692+ } ,
693+ {
694+ name : "mixed auth modes" ,
695+ modelClientOptions : {
696+ apiKey : "bedrock-short-term-api-key" ,
697+ providerOptions : {
698+ region : "us-east-1" ,
699+ accessKeyId : "AKIAIOSFODNN7EXAMPLE" ,
700+ secretAccessKey : "secret" ,
701+ } ,
702+ } ,
703+ errorSnippet : "cannot mix apiKey auth" ,
704+ } ,
705+ ] as const ;
706+
707+ for ( const testCase of cases ) {
708+ const ctx = await fetchWithContext < StartResponse > (
709+ `${ url } /v1/sessions/start` ,
710+ {
711+ method : "POST" ,
712+ headers,
713+ body : JSON . stringify ( {
714+ modelName : bedrockModelName ,
715+ modelClientOptions : testCase . modelClientOptions ,
716+ ...localBrowser ,
717+ } ) ,
718+ } ,
719+ ) ;
720+
721+ assertFetchStatus (
722+ ctx ,
723+ HTTP_BAD_REQUEST ,
724+ `Request should fail with 400 for ${ testCase . name } ` ,
725+ ) ;
726+ assertFetchOk ( ctx . body !== null , "Should have response body" , ctx ) ;
727+ assertFetchOk (
728+ JSON . stringify ( ctx . body ) . includes ( testCase . errorSnippet ) ,
729+ `Error should reference ${ testCase . errorSnippet } for ${ testCase . name } ` ,
730+ ctx ,
731+ ) ;
732+ }
733+ } ) ;
734+
682735 it ( "should start session with extended options (timeouts, verbose)" , async ( ) => {
683736 const url = getBaseUrl ( ) ;
684737
0 commit comments