Skip to content

feat: add copilotHome option for configurable data directory#1191

Merged
SteveSandersonMS merged 4 commits into
mainfrom
configurable-copilot-home
May 4, 2026
Merged

feat: add copilotHome option for configurable data directory#1191
SteveSandersonMS merged 4 commits into
mainfrom
configurable-copilot-home

Conversation

@patniko
Copy link
Copy Markdown
Contributor

@patniko patniko commented May 4, 2026

Summary

Adds a first-class copilotHome option to CopilotClientOptions in all four SDKs (Node/TS, Python, Go, .NET) that sets the COPILOT_HOME environment 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:\data is allowed). There was no discoverable option to override the data directory.

Changes

SDK Option Files
Node/TS copilotHome?: string types.ts, client.ts
Python copilot_home: str | None client.py
Go CopilotHome string types.go, client.go, embeddedcli.go
.NET CopilotHome: string? Types.cs, Client.cs

All four SDK READMEs are updated with documentation for the new option.

Behavior

  • Sets COPILOT_HOME env var on the spawned CLI process
  • Takes priority over any COPILOT_HOME set in the raw env option
  • Ignored when connecting to an external server via cliUrl
  • Go: embedded CLI binary cache also respects COPILOT_HOME/cache/copilot-sdk as a fallback directory

Usage example (Node)

const client = new CopilotClient({
  copilotHome: "D:\\data\\copilot",
});

Testing

  • ✅ TypeScript type check
  • ✅ Node client tests (71 passed)
  • ✅ Go build + tests
  • ✅ .NET build + unit tests (62 passed)
  • ✅ Python smoke test

Related issues

Closes https://github.com/github/copilot-sdk-partners/issues/29

Copilot AI review requested due to automatic review settings May 4, 2026 02:56
@patniko patniko requested a review from a team as a code owner May 4, 2026 02:56
@patniko patniko requested a review from SteveSandersonMS May 4, 2026 02:59
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_HOME on 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

Comment thread go/client.go Outdated
Comment thread go/internal/embeddedcli/embeddedcli.go
Comment thread go/README.md Outdated
Comment thread nodejs/src/client.ts Outdated
Comment thread python/copilot/client.py Outdated
Comment thread dotnet/src/Client.cs Outdated
@github-actions

This comment has been minimized.

Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generated by SDK Consistency Review Agent for issue #1191 · ● 288.9K

Comment thread python/README.md
Comment thread go/internal/embeddedcli/embeddedcli.go
@github-actions

This comment has been minimized.

patniko and others added 2 commits May 4, 2026 12:23
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>
@SteveSandersonMS SteveSandersonMS force-pushed the configurable-copilot-home branch from 9678a79 to 625ddeb Compare May 4, 2026 11:26
@github-actions

This comment has been minimized.

Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generated by SDK Consistency Review Agent for issue #1191 · ● 879.9K

Comment thread nodejs/test/client.test.ts
Comment thread python/test_client.py
Comment thread go/client_test.go
Comment thread dotnet/test/Unit/CloneTests.cs
SteveSandersonMS and others added 2 commits May 4, 2026 12:39
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>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 4, 2026

Cross-SDK Consistency Review ✅

This PR adds copilotHome / copilot_home / CopilotHome to all four SDK implementations simultaneously. Cross-SDK consistency looks excellent:

SDK Option name Convention
Node.js/TypeScript copilotHome?: string camelCase ✅
Python copilot_home: str | None snake_case ✅
Go CopilotHome string PascalCase ✅
.NET CopilotHome: string? PascalCase ✅

Behavioral parity confirmed:

  • All four SDKs set COPILOT_HOME on the spawned CLI process with the option value taking priority over any COPILOT_HOME in the user-supplied env — and this is tested via E2E tests in all four SDKs
  • All four skip setting the env var when the option is empty/null
  • All four ignore the option when connecting to an external server via cliUrl / cli_url / CLIUrl / CliUrl
  • All four READMEs updated with equivalent documentation

Go-specific nuance (appropriate): The Go SDK also reads COPILOT_HOME from the calling process environment to determine where to cache the embedded CLI binary (embeddedcli.go). This is Go-only (other SDKs don't embed a CLI binary), is well-documented in the README ("This does not affect where the Go SDK extracts the embedded CLI binary"), and is a reasonable use of the same env var for a related purpose.

No inconsistencies found. 🎉

Generated by SDK Consistency Review Agent for issue #1191 · ● 493.1K ·

@SteveSandersonMS SteveSandersonMS merged commit 662f270 into main May 4, 2026
35 checks passed
@SteveSandersonMS SteveSandersonMS deleted the configurable-copilot-home branch May 4, 2026 11:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants