@@ -476,6 +476,8 @@ describe("AcpRegistryAdapterV2", () => {
476476 readonly storedModePick ?: string ;
477477 readonly turnModels ?: ReadonlyArray < string > ;
478478 readonly rejectedModel ?: string ;
479+ readonly storedOptions ?: ReadonlyArray < { readonly id : string ; readonly value : string } > ;
480+ readonly failsConfiguration ?: boolean ;
479481 } ) {
480482 const spawner = yield * ChildProcessSpawner . ChildProcessSpawner ;
481483 // Scope release gives the replay agent at most a second to exit, so the status
@@ -563,6 +565,7 @@ describe("AcpRegistryAdapterV2", () => {
563565 ...( input . storedModePick === undefined
564566 ? { }
565567 : { options : [ { id : ACP_SESSION_MODE_OPTION_ID , value : input . storedModePick } ] } ) ,
568+ ...( input . storedOptions === undefined ? { } : { options : input . storedOptions } ) ,
566569 } ;
567570 const configurations : Array < AcpRegistryLiveConfiguration | undefined > = [ ] ;
568571 yield * Effect . gen ( function * ( ) {
@@ -616,13 +619,17 @@ describe("AcpRegistryAdapterV2", () => {
616619 } ) . pipe (
617620 Effect . match ( {
618621 onFailure : ( error ) => {
622+ if ( input . failsConfiguration === true ) return ;
619623 assert . isDefined ( input . rejectedModel ) ;
620624 assert . equal (
621625 makeProviderFailure ( { cause : error } ) . message ,
622626 `The agent did not accept the model "${ input . rejectedModel } ". Choose another model for this provider, then retry.` ,
623627 ) ;
624628 } ,
625- onSuccess : ( ) => assert . isUndefined ( input . rejectedModel ) ,
629+ onSuccess : ( ) => {
630+ assert . isUndefined ( input . rejectedModel ) ;
631+ assert . notEqual ( input . failsConfiguration , true , "configuration should have failed" ) ;
632+ } ,
626633 } ) ,
627634 Effect . scoped ,
628635 ) ;
@@ -903,6 +910,55 @@ describe("AcpRegistryAdapterV2", () => {
903910 ) ;
904911 } ) . pipe ( Effect . provide ( layerTest ) , Effect . scoped ) ,
905912 ) ;
913+ it . effect (
914+ "fails configuration when an option write errors for a reason other than refusal" ,
915+ ( ) => {
916+ const sessionModel = ( currentValue : string ) => ( {
917+ ...modelOption ( "model" , currentValue ) ,
918+ options : [ "default" , "named" ] . map ( ( value ) => ( { value, name : value } ) ) ,
919+ } ) ;
920+ const thinking = {
921+ id : "thinking" ,
922+ name : "Thinking" ,
923+ category : "thought_level" ,
924+ type : "select" ,
925+ currentValue : "low" ,
926+ options : [ "low" , "high" ] . map ( ( value ) => ( { value, name : value } ) ) ,
927+ } ;
928+ return openWithStoredPicks ( {
929+ setup : { configOptions : [ sessionModel ( "default" ) ] } ,
930+ storedModel : "named" ,
931+ storedOptions : [
932+ { id : "thinking" , value : "high" } ,
933+ { id : "unavailable" , value : "x" } ,
934+ ] ,
935+ failsConfiguration : true ,
936+ pickFrames : [
937+ outbound ( "session/set_config_option" , {
938+ sessionId : "agent-session" ,
939+ configId : "model" ,
940+ value : "named" ,
941+ } ) ,
942+ answer ( "session/set_config_option" , {
943+ configOptions : [ sessionModel ( "named" ) , thinking ] ,
944+ } ) ,
945+ outbound ( "session/set_config_option" , {
946+ sessionId : "agent-session" ,
947+ configId : "thinking" ,
948+ value : "high" ,
949+ } ) ,
950+ {
951+ type : "emit_inbound" ,
952+ frame : {
953+ kind : "response" ,
954+ method : "session/set_config_option" ,
955+ error : { code : - 32603 , message : "Internal error" } ,
956+ } ,
957+ } ,
958+ ] ,
959+ } ) . pipe ( Effect . provide ( layerTest ) , Effect . scoped ) ;
960+ } ,
961+ ) ;
906962 const modelOptions = [
907963 { id : "fast" , name : "Fast" , category : "model" , type : "boolean" , currentValue : false } ,
908964 {
0 commit comments