-
Notifications
You must be signed in to change notification settings - Fork 28
Open
Labels
externalUpstream bug or dependency issueUpstream bug or dependency issue
Description
External: github/copilot-sdk
Problem
CopilotClientOptions.Environment silently clears and replaces the child process environment rather than merging with the inherited environment. Decompiled from GitHub.Copilot.SDK v0.2.0:
if (options.Environment != null)
{
processStartInfo.Environment.Clear();
foreach (var (key, value) in options.Environment)
{
processStartInfo.Environment[key] = value;
}
}Any embedder that sets Environment to augment PATH (the obvious use case — MAUI apps don't inherit terminal PATH) will unknowingly strip critical platform variables (COMSPEC, SystemRoot, TEMP, LOCALAPPDATA, etc.) from the CLI child process.
On Windows this breaks ConPTY shell spawning entirely — the CLI's PowerShell tool fails with File not found: (empty path) because ConPTY can't resolve the shell executable without these env vars.
Expected behavior
Either:
- Merge
options.Environmentwith the inherited environment (set/override only the specified keys), or - Document clearly that
Environmentis a full replacement and embedders must copyEnvironment.GetEnvironmentVariables()first
Workaround
Copy the full system environment before augmenting:
var env = new Dictionary<string, string>(
OperatingSystem.IsWindows() ? StringComparer.OrdinalIgnoreCase : StringComparer.Ordinal);
foreach (DictionaryEntry entry in Environment.GetEnvironmentVariables())
{
if (entry.Key is string key && entry.Value is string val)
env[key] = val;
}
// Now augment PATH, HOME, etc.
options.Environment = env;PolyPilot fix
PR #439
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
externalUpstream bug or dependency issueUpstream bug or dependency issue