feat: add copilotHome option for configurable data directory#1191
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a first-class copilotHome / copilot_home / CopilotHome option across the Node/TS, Python, Go, and .NET SDKs to control where the spawned Copilot CLI stores its data by setting COPILOT_HOME.
Changes:
- Added a new client option in each SDK to set
COPILOT_HOMEon the spawned CLI process. - Updated spawn/launch code paths to apply the environment variable during CLI startup.
- Updated SDK READMEs to document the new option and its behavior.
Show a summary per file
| File | Description |
|---|---|
| python/copilot/client.py | Adds copilot_home to SubprocessConfig and applies it to the CLI subprocess environment. |
| python/README.md | Documents copilot_home option behavior and intended use cases. |
| nodejs/src/types.ts | Adds copilotHome?: string to CopilotClientOptions. |
| nodejs/src/client.ts | Plumbs copilotHome through options normalization and sets COPILOT_HOME in spawn env. |
| nodejs/README.md | Documents copilotHome option behavior and when it’s ignored. |
| go/types.go | Adds CopilotHome string to ClientOptions with behavior documentation. |
| go/internal/embeddedcli/embeddedcli.go | Uses COPILOT_HOME (process env) to influence embedded CLI install/cache directory fallback. |
| go/client.go | Plumbs CopilotHome and appends COPILOT_HOME=... to CLI subprocess env. |
| go/README.md | Documents CopilotHome, including embedded CLI cache implications. |
| dotnet/src/Types.cs | Adds CopilotHome to CopilotClientOptions. |
| dotnet/src/Client.cs | Sets COPILOT_HOME in ProcessStartInfo.Environment when spawning the CLI. |
| dotnet/README.md | Documents CopilotHome option behavior and use cases. |
Copilot's findings
- Files reviewed: 12/12 changed files
- Comments generated: 6
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Generated by SDK Consistency Review Agent for issue #1191 · ● 288.9K
This comment has been minimized.
This comment has been minimized.
Add a first-class option to CopilotClientOptions in all four SDKs (Node/TS, Python, Go, .NET) that sets the COPILOT_HOME environment variable on the spawned CLI process, allowing users to control where the CLI stores session state, config, and other data files. This addresses environments with restricted write access (e.g., M365 B2 service where only specific directories like D:\data are writable). - Node/TS: copilotHome?: string - Python: copilot_home: str | None - Go: CopilotHome string (also used as fallback for embedded CLI cache) - .NET: CopilotHome: string? The explicit option takes priority over any COPILOT_HOME set in the raw env option. The option is ignored when connecting to an external server via cliUrl. Closes github/copilot-sdk-partners#29 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Add unit tests for copilotHome option in all 4 SDKs - Fix Python README: add missing 'Ignored when using ExternalServerConfig' caveat - Fix Go README: clarify that CopilotHome option controls CLI subprocess env, not embedded binary cache (use COPILOT_HOME env var or embeddedcli.Config.Dir for that) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
9678a79 to
625ddeb
Compare
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Generated by SDK Consistency Review Agent for issue #1191 · ● 879.9K
Clarify that ClientOptions.CopilotHome configures the spawned CLI process only, while embedded CLI extraction remains controlled by embeddedcli.Config.Dir. Also make Go env overrides deterministic by replacing duplicate SDK-managed entries before spawning the CLI, and cover COPILOT_HOME precedence in the Go client-options E2E test. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Extend the existing client-options E2E suites in Node, Python, and .NET to capture COPILOT_HOME and assert that the explicit client option overrides any raw environment value passed into the subprocess. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Cross-SDK Consistency Review ✅This PR adds
Behavioral parity confirmed:
Go-specific nuance (appropriate): The Go SDK also reads No inconsistencies found. 🎉
|
Summary
Adds a first-class
copilotHomeoption toCopilotClientOptionsin all four SDKs (Node/TS, Python, Go, .NET) that sets theCOPILOT_HOMEenvironment variable on the spawned CLI process. This allows users to control where the CLI stores session state, config, and other data files.Motivation
Addresses github/copilot-sdk-partners#29 — a team reported that the SDK writes temp/internal files to AppData which is not writable (only
D:\datais allowed). There was no discoverable option to override the data directory.Changes
copilotHome?: stringtypes.ts,client.tscopilot_home: str | Noneclient.pyCopilotHome stringtypes.go,client.go,embeddedcli.goCopilotHome: string?Types.cs,Client.csAll four SDK READMEs are updated with documentation for the new option.
Behavior
COPILOT_HOMEenv var on the spawned CLI processCOPILOT_HOMEset in the rawenvoptioncliUrlCOPILOT_HOME/cache/copilot-sdkas a fallback directoryUsage example (Node)
Testing
Related issues
Closes https://github.com/github/copilot-sdk-partners/issues/29