@@ -23,6 +23,7 @@ import * as Stream from "effect/Stream";
2323import * as Effect from "effect/Effect" ;
2424import * as FileSystem from "effect/FileSystem" ;
2525import * as Layer from "effect/Layer" ;
26+ import * as Option from "effect/Option" ;
2627import * as Path from "effect/Path" ;
2728import * as Schema from "effect/Schema" ;
2829import * as HttpClient from "effect/http/HttpClient" ;
@@ -471,13 +472,15 @@ describe("AcpRegistryAdapterV2", () => {
471472 const openWithStoredPicks = Effect . fn ( "openWithStoredPicks" ) ( function * ( input : {
472473 readonly setup : unknown ;
473474 readonly pickFrames : ReadonlyArray < Frame > ;
475+ readonly agentId ?: string ;
474476 readonly customModels ?: ReadonlyArray < string > ;
475477 readonly storedModel ?: string ;
476478 readonly storedModePick ?: string ;
477479 readonly turnModels ?: ReadonlyArray < string > ;
478480 readonly rejectedModel ?: string ;
479481 readonly storedOptions ?: ReadonlyArray < { readonly id : string ; readonly value : string } > ;
480482 readonly failsConfiguration ?: boolean ;
483+ readonly liveConfiguration ?: AcpRegistryLiveConfiguration ;
481484 } ) {
482485 const spawner = yield * ChildProcessSpawner . ChildProcessSpawner ;
483486 // Scope release gives the replay agent at most a second to exit, so the status
@@ -524,7 +527,7 @@ describe("AcpRegistryAdapterV2", () => {
524527 selfInvocation : yield * resolveSelfInvocation ( ) ,
525528 instanceId,
526529 settings : yield * decodeAcpRegistryAdapterSettings ( {
527- agentId : "fixture-agent" ,
530+ agentId : input . agentId ?? "fixture-agent" ,
528531 authMethodId : "test" ,
529532 customModels : input . customModels ?? [ ] ,
530533 } ) ,
@@ -545,6 +548,8 @@ describe("AcpRegistryAdapterV2", () => {
545548 layerInjectedRuntimeCatalog ,
546549 Layer . mock ( AcpRegistryRuntimeCoordinator . AcpRegistryRuntimeCoordinator ) ( {
547550 withForegroundStartup : ( _startupKey , effect ) => effect ,
551+ getLiveConfiguration : ( ) =>
552+ Effect . sync ( ( ) => Option . fromUndefinedOr ( published ?? input . liveConfiguration ) ) ,
548553 publishLiveConfiguration : ( _instanceId , configuration ) =>
549554 Effect . sync ( ( ) => {
550555 published = configuration ;
@@ -799,6 +804,85 @@ describe("AcpRegistryAdapterV2", () => {
799804 } ) . pipe ( Effect . provide ( layerTest ) , Effect . scoped ) ,
800805 ) ;
801806
807+ // Copilot's session/new reports its built-in default, not the model it will run
808+ // (github/copilot-cli#5363), so the selected model must be written even when it matches,
809+ // and an unset effort gets the value the composer shows.
810+ it . effect (
811+ "writes the selected Copilot model and the shown effort when session/new reports defaults" ,
812+ ( ) => {
813+ const copilotModel = ( currentValue : string ) => ( {
814+ ...modelOption ( "model" , currentValue ) ,
815+ options : [ "claude-sonnet-5.5" , "claude-haiku-4.5" ] . map ( ( value ) => ( {
816+ value,
817+ name : value ,
818+ } ) ) ,
819+ } ) ;
820+ const effort = ( currentValue : string ) => ( {
821+ id : "reasoning_effort" ,
822+ name : "Reasoning effort" ,
823+ category : "thought_level" ,
824+ type : "select" ,
825+ currentValue,
826+ options : [ "medium" , "xhigh" ] . map ( ( value ) => ( { value, name : value } ) ) ,
827+ } ) ;
828+ return openWithStoredPicks ( {
829+ agentId : "github-copilot-cli" ,
830+ setup : { configOptions : [ copilotModel ( "claude-sonnet-5.5" ) , effort ( "medium" ) ] } ,
831+ storedModel : "claude-sonnet-5.5" ,
832+ liveConfiguration : {
833+ models : [ ] ,
834+ currentModelId : null ,
835+ configOptions : [
836+ {
837+ id : "reasoning_effort" ,
838+ label : "Reasoning effort" ,
839+ type : "select" ,
840+ role : "reasoning" ,
841+ currentValue : "xhigh" ,
842+ options : [
843+ { id : "medium" , label : "medium" } ,
844+ { id : "xhigh" , label : "xhigh" } ,
845+ ] ,
846+ } ,
847+ ] ,
848+ } ,
849+ pickFrames : [
850+ // The new session's own update replaces the shared live configuration.
851+ {
852+ type : "emit_inbound" ,
853+ frame : {
854+ kind : "notification" ,
855+ method : "session/update" ,
856+ params : {
857+ sessionId : "agent-session" ,
858+ update : {
859+ sessionUpdate : "config_option_update" ,
860+ configOptions : [ copilotModel ( "claude-sonnet-5.5" ) , effort ( "medium" ) ] ,
861+ } ,
862+ } ,
863+ } ,
864+ } ,
865+ outbound ( "session/set_config_option" , {
866+ sessionId : "agent-session" ,
867+ configId : "model" ,
868+ value : "claude-sonnet-5.5" ,
869+ } ) ,
870+ answer ( "session/set_config_option" , {
871+ configOptions : [ copilotModel ( "claude-sonnet-5.5" ) , effort ( "medium" ) ] ,
872+ } ) ,
873+ outbound ( "session/set_config_option" , {
874+ sessionId : "agent-session" ,
875+ configId : "reasoning_effort" ,
876+ value : "xhigh" ,
877+ } ) ,
878+ answer ( "session/set_config_option" , {
879+ configOptions : [ copilotModel ( "claude-sonnet-5.5" ) , effort ( "xhigh" ) ] ,
880+ } ) ,
881+ ] ,
882+ } ) . pipe ( Effect . provide ( layerTest ) , Effect . scoped ) ;
883+ } ,
884+ ) ;
885+
802886 it . effect . each ( [
803887 "config" ,
804888 "legacy" ,
0 commit comments