@@ -403,29 +403,7 @@ async Task<Connection> StartCoreAsync(CancellationToken ct)
403403 ffiEnvironment [ "COPILOT_DISABLE_KEYTAR" ] = "1" ;
404404 }
405405
406- var ffiArgs = new List < string > ( ) ;
407- if ( _options . LogLevel is { } logLevel && ! string . IsNullOrEmpty ( logLevel . Value ) )
408- {
409- ffiArgs . AddRange ( [ "--log-level" , logLevel . Value ] ) ;
410- }
411- if ( ! string . IsNullOrEmpty ( _options . GitHubToken ) )
412- {
413- ffiArgs . AddRange ( [ "--auth-token-env" , "COPILOT_SDK_AUTH_TOKEN" ] ) ;
414- }
415- var useLoggedInUser = _options . UseLoggedInUser ?? string . IsNullOrEmpty ( _options . GitHubToken ) ;
416- if ( ! useLoggedInUser )
417- {
418- ffiArgs . Add ( "--no-auto-login" ) ;
419- }
420- if ( _options . SessionIdleTimeoutSeconds is > 0 )
421- {
422- ffiArgs . AddRange ( [ "--session-idle-timeout" , _options . SessionIdleTimeoutSeconds . Value . ToString ( CultureInfo . InvariantCulture ) ] ) ;
423- }
424- if ( _options . EnableRemoteSessions )
425- {
426- ffiArgs . Add ( "--remote" ) ;
427- }
428-
406+ var ffiArgs = BuildInProcessRuntimeArguments ( _options ) ;
429407 var explicitCliPath = System . Environment . GetEnvironmentVariable ( "COPILOT_CLI_PATH" ) ;
430408 if ( string . IsNullOrEmpty ( explicitCliPath ) )
431409 {
@@ -2581,6 +2559,40 @@ private static void ApplyTelemetryEnvironment(IDictionary<string, string?> envir
25812559 return GetBundledNativePath ( OperatingSystem . IsWindows ( ) ? "copilot.exe" : "copilot" , out searchedPath ) ;
25822560 }
25832561
2562+ private static List < string > BuildInProcessRuntimeArguments ( CopilotClientOptions options )
2563+ {
2564+ var args = new List < string > ( ) ;
2565+ if ( options . LogLevel is { } logLevel && ! string . IsNullOrEmpty ( logLevel . Value ) )
2566+ {
2567+ args . AddRange ( [ "--log-level" , logLevel . Value ] ) ;
2568+ }
2569+ if ( ! string . IsNullOrEmpty ( options . GitHubToken ) )
2570+ {
2571+ args . AddRange ( [ "--auth-token-env" , "COPILOT_SDK_AUTH_TOKEN" ] ) ;
2572+ }
2573+ var useLoggedInUser = options . UseLoggedInUser ?? string . IsNullOrEmpty ( options . GitHubToken ) ;
2574+ if ( ! useLoggedInUser )
2575+ {
2576+ args . Add ( "--no-auto-login" ) ;
2577+ }
2578+ if ( options . SessionIdleTimeoutSeconds is > 0 )
2579+ {
2580+ args . AddRange ( [ "--session-idle-timeout" , options . SessionIdleTimeoutSeconds . Value . ToString ( CultureInfo . InvariantCulture ) ] ) ;
2581+ }
2582+ if ( options . EnableRemoteSessions )
2583+ {
2584+ args . Add ( "--remote" ) ;
2585+ }
2586+
2587+ var cliLoginSyncIntegrationId =
2588+ System . Environment . GetEnvironmentVariable ( "GITHUB_COPILOT_INTEGRATION_ID" ) ? . Trim ( ) ;
2589+ if ( ! string . IsNullOrEmpty ( cliLoginSyncIntegrationId ) )
2590+ {
2591+ args . Add ( $ "--cli-login-sync-integration-id={ cliLoginSyncIntegrationId } ") ;
2592+ }
2593+ return args ;
2594+ }
2595+
25842596 private static string ? GetBundledNativePath ( string binaryName , out string searchedPath )
25852597 {
25862598 // Always use portable RID (e.g., linux-x64) to match the build-time placement,
0 commit comments