Skip to content

feat!: redirect Copilot SDK state to a provider-owned home directory - #68

Merged
Mowri Mohan (mowree) merged 1 commit into
microsoft:mainfrom
HDMowri:feat/redirect-copilot-sdk-state
May 22, 2026
Merged

feat!: redirect Copilot SDK state to a provider-owned home directory#68
Mowri Mohan (mowree) merged 1 commit into
microsoft:mainfrom
HDMowri:feat/redirect-copilot-sdk-state

Conversation

@HDMowri

Copy link
Copy Markdown
Contributor

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%

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%
@mowree
Mowri Mohan (mowree) merged commit 6dbe844 into microsoft:main May 22, 2026
1 check passed
@HDMowri
Mowri Mohan (HDMowri) deleted the feat/redirect-copilot-sdk-state branch May 22, 2026 22:36
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