feat!: redirect Copilot SDK state to a provider-owned home directory - #68
Merged
Mowri Mohan (mowree) merged 1 commit intoMay 22, 2026
Conversation
Introduces a normative filesystem-layout V1.0 contract that redirects all SDK-written state (sessions, auth, logs) out of the host-shared `~/.copilot/` directory and into a provider-owned `provider_home`. Adds a single canonical PROVIDER_ID constant to replace 15+ scattered string literals. - `provider_home` resolution: AMPLIFIER_PROVIDER_GITHUB_COPILOT_HOME -> XDG_DATA_HOME/amplifier-provider-github-copilot -> ~/.amplifier-provider- github-copilot/ (Linux), ~/Library/Caches/... (macOS), %LOCALAPPDATA%/... (Windows). `cache_home` follows XDG_CACHE_HOME -> platform defaults; cache directory renamed from ~/.cache/amplifier/provider-github-copilot/ to ~/.cache/amplifier-provider-github-copilot/. - New stdlib-only `config/_paths.py` with frozen `ProviderPaths` dataclass, `_enforce_disjoint` runtime check, and `ensure_paths_exist()` that materializes directories with 0o700 mode on POSIX, refuses symlinks, does not mutate umask, and is lazy + idempotent. - `sdk_adapter/client.py` passes `copilot_home` plus a scrubbed env dict (COPILOT_HOME and COPILOT_CLI_PATH removed) to `SubprocessConfig`, so the SDK cannot escape provider_home via host environment. - New `_identity.PROVIDER_ID` is the single source for the provider id; AST scan enforces no literal "github-copilot" outside `config/_models.py`. - TTL jitter (SHOULD): `CacheConfig.disk_ttl_jitter_factor` applies a per- call random multiplier [1-factor, 1+factor] to the default TTL only; caller-pinned `max_age_seconds` is exact. Log line shows nominal TTL. - Docs: contracts/filesystem-layout.md (normative V1.0), contracts/ behaviors.md SHOULD:4, contracts/observability.md provider_home anchor, MIGRATION.md v2.1.x->v2.2.0 section, README.md cache-paths table, version bump to 2.2.0. Quality: ruff: 0 errors | pyright: 0 errors | pytest (linux/py3.14): 1306 passed | pytest (win32/py3.13): 1299 passed | total coverage: 98%
Ken Chau (kenotron-ms)
approved these changes
May 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Introduces a normative filesystem-layout V1.0 contract that redirects all SDK-written state (sessions, auth, logs) out of the host-shared
~/.copilot/directory and into a provider-ownedprovider_home. Adds a single canonical PROVIDER_ID constant to replace 15+ scattered string literals.provider_homeresolution: AMPLIFIER_PROVIDER_GITHUB_COPILOT_HOME ->XDG_DATA_HOME/amplifier-provider-github-copilot -> ~/.amplifier-provider-
github-copilot/ (Linux), ~/Library/Caches/... (macOS), %LOCALAPPDATA%/...
(Windows).
cache_homefollows XDG_CACHE_HOME -> platform defaults; cachedirectory renamed from ~/.cache/amplifier/provider-github-copilot/ to
~/.cache/amplifier-provider-github-copilot/.
config/_paths.pywith frozenProviderPathsdataclass,_enforce_disjointruntime check, andensure_paths_exist()that materializes directories with 0o700 mode on POSIX, refuses symlinks, does not mutate umask, and is lazy + idempotent.sdk_adapter/client.pypassescopilot_homeplus a scrubbed env dict (COPILOT_HOME and COPILOT_CLI_PATH removed) toSubprocessConfig, so the SDK cannot escape provider_home via host environment._identity.PROVIDER_IDis the single source for the provider id; AST scan enforces no literal "github-copilot" outsideconfig/_models.py.CacheConfig.disk_ttl_jitter_factorapplies a per- call random multiplier [1-factor, 1+factor] to the default TTL only; caller-pinnedmax_age_secondsis exact. Log line shows nominal TTL.Quality: ruff: 0 errors | pyright: 0 errors | pytest (linux/py3.14): 1306 passed | pytest (win32/py3.13): 1299 passed | total coverage: 98%