@@ -177,6 +177,77 @@ public async Task Should_Omit_EnableSessionTelemetry_When_Not_Set()
177177 await session . DisposeAsync ( ) ;
178178 }
179179
180+ [ Fact ]
181+ public async Task Should_Forward_New_Session_Config_Fields_In_Create_Wire_Request ( )
182+ {
183+ var ( cliPath , capturePath ) = await CreateFakeCliCaptureAsync ( ) ;
184+
185+ await using var client = Ctx . CreateClient ( options : new CopilotClientOptions
186+ {
187+ Connection = RuntimeConnection . ForStdio ( path : cliPath , args : [ "--capture-file" , capturePath ] ) ,
188+ UseLoggedInUser = false ,
189+ } ) ;
190+
191+ await client . StartAsync ( ) ;
192+
193+ var session = await client . CreateSessionAsync ( new SessionConfig
194+ {
195+ SkipEmbeddingRetrieval = false ,
196+ OrganizationCustomInstructions = "Follow org policy." ,
197+ EnableOnDemandInstructionDiscovery = true ,
198+ EnableFileHooks = true ,
199+ EnableHostGitOperations = false ,
200+ EnableSessionStore = true ,
201+ EnableSkills = false ,
202+ OnPermissionRequest = PermissionHandler . ApproveAll ,
203+ } ) ;
204+
205+ using var capture = JsonDocument . Parse ( await File . ReadAllTextAsync ( capturePath ) ) ;
206+ var createRequest = GetCapturedRequestParams ( capture . RootElement , "session.create" ) ;
207+ Assert . False ( createRequest . GetProperty ( "skipEmbeddingRetrieval" ) . GetBoolean ( ) ) ;
208+ Assert . Equal ( "Follow org policy." , createRequest . GetProperty ( "organizationCustomInstructions" ) . GetString ( ) ) ;
209+ Assert . True ( createRequest . GetProperty ( "enableOnDemandInstructionDiscovery" ) . GetBoolean ( ) ) ;
210+ Assert . True ( createRequest . GetProperty ( "enableFileHooks" ) . GetBoolean ( ) ) ;
211+ Assert . False ( createRequest . GetProperty ( "enableHostGitOperations" ) . GetBoolean ( ) ) ;
212+ Assert . True ( createRequest . GetProperty ( "enableSessionStore" ) . GetBoolean ( ) ) ;
213+ Assert . False ( createRequest . GetProperty ( "enableSkills" ) . GetBoolean ( ) ) ;
214+
215+ await session . DisposeAsync ( ) ;
216+ }
217+
218+ [ Fact ]
219+ public async Task Should_Apply_Empty_Mode_Defaults_To_CreateSession_Wire_Request ( )
220+ {
221+ var ( cliPath , capturePath ) = await CreateFakeCliCaptureAsync ( ) ;
222+
223+ await using var client = Ctx . CreateClient ( options : new CopilotClientOptions
224+ {
225+ Connection = RuntimeConnection . ForStdio ( path : cliPath , args : [ "--capture-file" , capturePath ] ) ,
226+ Mode = CopilotClientMode . Empty ,
227+ UseLoggedInUser = false ,
228+ } ) ;
229+
230+ await client . StartAsync ( ) ;
231+
232+ var session = await client . CreateSessionAsync ( new SessionConfig
233+ {
234+ OnPermissionRequest = PermissionHandler . ApproveAll ,
235+ } ) ;
236+
237+ using var capture = JsonDocument . Parse ( await File . ReadAllTextAsync ( capturePath ) ) ;
238+ var createRequest = GetCapturedRequestParams ( capture . RootElement , "session.create" ) ;
239+ Assert . False ( createRequest . GetProperty ( "enableSessionTelemetry" ) . GetBoolean ( ) ) ;
240+ Assert . True ( createRequest . GetProperty ( "skipEmbeddingRetrieval" ) . GetBoolean ( ) ) ;
241+ Assert . False ( createRequest . GetProperty ( "enableOnDemandInstructionDiscovery" ) . GetBoolean ( ) ) ;
242+ Assert . False ( createRequest . GetProperty ( "enableFileHooks" ) . GetBoolean ( ) ) ;
243+ Assert . False ( createRequest . GetProperty ( "enableHostGitOperations" ) . GetBoolean ( ) ) ;
244+ Assert . False ( createRequest . GetProperty ( "enableSessionStore" ) . GetBoolean ( ) ) ;
245+ Assert . False ( createRequest . GetProperty ( "enableSkills" ) . GetBoolean ( ) ) ;
246+ Assert . False ( createRequest . TryGetProperty ( "organizationCustomInstructions" , out _ ) ) ;
247+
248+ await session . DisposeAsync ( ) ;
249+ }
250+
180251 [ Fact ]
181252 public async Task Should_Propagate_Activity_TraceContext_To_Session_Create_And_Send ( )
182253 {
@@ -293,6 +364,77 @@ public async Task Should_Propagate_Activity_TraceContext_To_Session_Resume()
293364 await session . DisposeAsync ( ) ;
294365 }
295366
367+ [ Fact ]
368+ public async Task Should_Forward_New_Session_Config_Fields_In_Resume_Wire_Request ( )
369+ {
370+ var ( cliPath , capturePath ) = await CreateFakeCliCaptureAsync ( ) ;
371+
372+ await using var client = Ctx . CreateClient ( options : new CopilotClientOptions
373+ {
374+ Connection = RuntimeConnection . ForStdio ( path : cliPath , args : [ "--capture-file" , capturePath ] ) ,
375+ UseLoggedInUser = false ,
376+ } ) ;
377+
378+ await client . StartAsync ( ) ;
379+
380+ var session = await client . ResumeSessionAsync ( "resume-session" , new ResumeSessionConfig
381+ {
382+ SkipEmbeddingRetrieval = false ,
383+ OrganizationCustomInstructions = "Resume org policy." ,
384+ EnableOnDemandInstructionDiscovery = true ,
385+ EnableFileHooks = true ,
386+ EnableHostGitOperations = false ,
387+ EnableSessionStore = true ,
388+ EnableSkills = false ,
389+ OnPermissionRequest = PermissionHandler . ApproveAll ,
390+ } ) ;
391+
392+ using var capture = JsonDocument . Parse ( await File . ReadAllTextAsync ( capturePath ) ) ;
393+ var resumeRequest = GetCapturedRequestParams ( capture . RootElement , "session.resume" ) ;
394+ Assert . False ( resumeRequest . GetProperty ( "skipEmbeddingRetrieval" ) . GetBoolean ( ) ) ;
395+ Assert . Equal ( "Resume org policy." , resumeRequest . GetProperty ( "organizationCustomInstructions" ) . GetString ( ) ) ;
396+ Assert . True ( resumeRequest . GetProperty ( "enableOnDemandInstructionDiscovery" ) . GetBoolean ( ) ) ;
397+ Assert . True ( resumeRequest . GetProperty ( "enableFileHooks" ) . GetBoolean ( ) ) ;
398+ Assert . False ( resumeRequest . GetProperty ( "enableHostGitOperations" ) . GetBoolean ( ) ) ;
399+ Assert . True ( resumeRequest . GetProperty ( "enableSessionStore" ) . GetBoolean ( ) ) ;
400+ Assert . False ( resumeRequest . GetProperty ( "enableSkills" ) . GetBoolean ( ) ) ;
401+
402+ await session . DisposeAsync ( ) ;
403+ }
404+
405+ [ Fact ]
406+ public async Task Should_Apply_Empty_Mode_Defaults_To_ResumeSession_Wire_Request ( )
407+ {
408+ var ( cliPath , capturePath ) = await CreateFakeCliCaptureAsync ( ) ;
409+
410+ await using var client = Ctx . CreateClient ( options : new CopilotClientOptions
411+ {
412+ Connection = RuntimeConnection . ForStdio ( path : cliPath , args : [ "--capture-file" , capturePath ] ) ,
413+ Mode = CopilotClientMode . Empty ,
414+ UseLoggedInUser = false ,
415+ } ) ;
416+
417+ await client . StartAsync ( ) ;
418+
419+ var session = await client . ResumeSessionAsync ( "resume-empty-session" , new ResumeSessionConfig
420+ {
421+ OnPermissionRequest = PermissionHandler . ApproveAll ,
422+ } ) ;
423+
424+ using var capture = JsonDocument . Parse ( await File . ReadAllTextAsync ( capturePath ) ) ;
425+ var resumeRequest = GetCapturedRequestParams ( capture . RootElement , "session.resume" ) ;
426+ Assert . False ( resumeRequest . GetProperty ( "enableSessionTelemetry" ) . GetBoolean ( ) ) ;
427+ Assert . True ( resumeRequest . GetProperty ( "skipEmbeddingRetrieval" ) . GetBoolean ( ) ) ;
428+ Assert . False ( resumeRequest . GetProperty ( "enableOnDemandInstructionDiscovery" ) . GetBoolean ( ) ) ;
429+ Assert . False ( resumeRequest . GetProperty ( "enableFileHooks" ) . GetBoolean ( ) ) ;
430+ Assert . False ( resumeRequest . GetProperty ( "enableHostGitOperations" ) . GetBoolean ( ) ) ;
431+ Assert . False ( resumeRequest . GetProperty ( "enableSessionStore" ) . GetBoolean ( ) ) ;
432+ Assert . False ( resumeRequest . GetProperty ( "enableSkills" ) . GetBoolean ( ) ) ;
433+ Assert . False ( resumeRequest . TryGetProperty ( "organizationCustomInstructions" , out _ ) ) ;
434+
435+ await session . DisposeAsync ( ) ;
436+ }
437+
296438 [ Fact ]
297439 public void Should_Accept_GitHubToken_Option ( )
298440 {
0 commit comments