You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Implement a coherent redesign of the boundary between client-wide options, out-of-process transports, and the in-process runtime.
These items are planned v2 work carried forward from #1934. Investigation should determine the correct implementation against the current code, not independently decide whether the work is desirable. If current architecture or completed work contradicts an item, document that evidence and ask maintainers to confirm the change in direction.
Why this work exists
Several CopilotClientOptions were originally implemented by lowering them to environment variables on a spawned CLI process. That is coherent for stdio/TCP clients that own an OS process, but not for an in-process FFI runtime loaded into a shared host process. A process has one ambient environment, so independently mutating it for multiple clients does not provide per-client configuration.
The original in-process implementation rejected some unsupported options while silently ignoring others. #1976 added substantial compatible forwarding and validation; preserve that groundwork and verify the current behavior while implementing the intended v2 API boundary.
Original option and behavior inventory
The complete environment-lowered inventory recorded in #1934 was:
The following options were lowered to CLI arguments, but the original FFI host_start arguments were hardcoded to [entrypoint, "--embedded-host"] and did not forward them:
The original workaround was to configure the host process before constructing a client:
set COPILOT_SDK_AUTH_TOKEN for authentication
set COPILOT_HOME for the base directory
set COPILOT_DISABLE_KEYTAR=1 for empty mode
set the corresponding COPILOT_OTEL_* and OTEL_* variables for telemetry
This workaround is historical context, not the desired v2 API.
Required changes
Remove client-level working-directory and environment options across SDKs, leaving process-scoped configuration on the applicable transport.
In Rust, move working_directory, env, env_remove, program, prefix/raw arguments, and extra_args from ClientOptions to the out-of-process transport. These remained on ClientOptions because moving them was breaking and the existing Rust transport units/structs were not declared with the #[non_exhaustive]/Default extensibility needed to add fields compatibly.
Make Rust's supplied process environment semantics consistent with the other SDKs. The intended behavior from [Tracking] In-process (FFI) items to be cleaned up #1934 is that a nonempty supplied environment replaces the inherited environment instead of adding to it.
Rename shared "child process" connection abstractions to "out of process" where they also cover unrelated TCP processes. Unrelated-process TCP should reject path and argument settings at runtime where they do not apply.
Replace settings lowered into environment variables or command-line arguments with coherent first-class runtime/server configuration where needed for stdio, TCP, and in-process operation. Environment variables may remain as compatibility overrides.
Ensure the runtime consumes the host_startenv_json contract for host-side reads so configuration remains per client rather than ambient to the host process.
Validate settings that cannot apply to in-process or unrelated-process TCP connections, avoiding silent no-ops.
The first-class configuration and env_json work may not be possible without runtime changes. If runtime changes are required, file a single follow-up issue describing the complete runtime work and treat implementation of those runtime changes as out of scope for this SDK issue.
Original .NET references in [Tracking] In-process (FFI) items to be cleaned up #1934: dotnet/src/Client.cs (ValidateEnvironmentOptions, in-process startup, child-process environment construction, ApplyTelemetryEnvironment, and auth argument handling) and dotnet/src/FfiRuntimeHost.cs
Completion
Implement and test the required cross-SDK behavior, link the consolidated runtime follow-up where required, and document migration from every removed, moved, renamed, or behaviorally changed API. Any item not implemented requires documented contradictory evidence and explicit maintainer agreement.
Summary
Implement a coherent redesign of the boundary between client-wide options, out-of-process transports, and the in-process runtime.
These items are planned v2 work carried forward from #1934. Investigation should determine the correct implementation against the current code, not independently decide whether the work is desirable. If current architecture or completed work contradicts an item, document that evidence and ask maintainers to confirm the change in direction.
Why this work exists
Several
CopilotClientOptionswere originally implemented by lowering them to environment variables on a spawned CLI process. That is coherent for stdio/TCP clients that own an OS process, but not for an in-process FFI runtime loaded into a shared host process. A process has one ambient environment, so independently mutating it for multiple clients does not provide per-client configuration.The original in-process implementation rejected some unsupported options while silently ignoring others. #1976 added substantial compatible forwarding and validation; preserve that groundwork and verify the current behavior while implementing the intended v2 API boundary.
Original option and behavior inventory
The complete environment-lowered inventory recorded in #1934 was:
EnvironmentTelemetryCOPILOT_OTEL_ENABLED,OTEL_EXPORTER_OTLP_ENDPOINT,OTEL_EXPORTER_OTLP_PROTOCOL,COPILOT_OTEL_FILE_EXPORTER_PATH,COPILOT_OTEL_EXPORTER_TYPE,COPILOT_OTEL_SOURCE_NAME,OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENTGitHubTokenCOPILOT_SDK_AUTH_TOKEN, plus--auth-token-envBaseDirectoryCOPILOT_HOMEMode == EmptyCOPILOT_DISABLE_KEYTAR=1ConnectionTokenCOPILOT_CONNECTION_TOKENThe following options were lowered to CLI arguments, but the original FFI
host_startarguments were hardcoded to[entrypoint, "--embedded-host"]and did not forward them:UseLoggedInUser→--no-auto-loginSessionIdleTimeoutSeconds→--session-idle-timeoutEnableRemoteSessions→--remoteLogLevel→--log-levelThe original workaround was to configure the host process before constructing a client:
COPILOT_SDK_AUTH_TOKENfor authenticationCOPILOT_HOMEfor the base directoryCOPILOT_DISABLE_KEYTAR=1for empty modeCOPILOT_OTEL_*andOTEL_*variables for telemetryThis workaround is historical context, not the desired v2 API.
Required changes
working_directory,env,env_remove,program, prefix/raw arguments, andextra_argsfromClientOptionsto the out-of-process transport. These remained onClientOptionsbecause moving them was breaking and the existing Rust transport units/structs were not declared with the#[non_exhaustive]/Defaultextensibility needed to add fields compatibly.host_startenv_jsoncontract for host-side reads so configuration remains per client rather than ambient to the host process.The first-class configuration and
env_jsonwork may not be possible without runtime changes. If runtime changes are required, file a single follow-up issue describing the complete runtime work and treat implementation of those runtime changes as out of scope for this SDK issue.Implementation preparation
Historical context
dotnet/src/Client.cs(ValidateEnvironmentOptions, in-process startup, child-process environment construction,ApplyTelemetryEnvironment, and auth argument handling) anddotnet/src/FfiRuntimeHost.csCompletion
Implement and test the required cross-SDK behavior, link the consolidated runtime follow-up where required, and document migration from every removed, moved, renamed, or behaviorally changed API. Any item not implemented requires documented contradictory evidence and explicit maintainer agreement.