Commit 2f86895
authored
Align provider to github-copilot-sdk 1.0.0b10; release v2.3.0 (#69)
* chore(deps): bump github-copilot-sdk to 1.0.0b10; release v2.3.0
Pin the SDK at 1.0.0b10 and bump the provider to 2.3.0. Behavior
changes, surface deltas, and rollback guidance land with the contract,
test, and MIGRATION updates later in this series.
Declare `packaging` as an explicit runtime dependency. The PEP 440
parser is imported at provider load time by the SDK floor check; pip's
vendored copy at `pip._vendor.packaging` is not visible as a top-level
import, so a minimal venv without an explicit dep can fail at
provider import. The `>=20` lower bound covers the stable `Version` /
`InvalidVersion` API surface used here.
Quality: ruff: 0 errors | pyright: 0 errors | pytest (linux/py3.14): 1337 passed | pytest (win32/py3.13): 1335 passed | total coverage: 98%
* feat(sdk-boundary): wire SDK 1.0.0b10 surface end-to-end
CopilotClient construction
SubprocessConfig was removed from the SDK at b7 and remains absent in
b10 (verified in b10 `copilot/client.py` and `copilot/__init__.py`).
Adopt the direct keyword-only constructor:
`CopilotClient(base_directory=..., env=..., log_level=..., mode=...,
github_token=...)`. Both the token and no-token branches
share a single kwargs dict; only `github_token` differs. `mode` is
passed explicitly ("copilot-cli") rather than relying on the SDK
default, so a future SDK default change cannot silently move us off it.
Permission rejection
Replace `PermissionRequestResult(kind="reject")` with
`PermissionDecisionReject()` (b10 `generated/rpc.py:10054`). In b10
`PermissionRequestResult` is a `PermissionDecision | PermissionNoResult`
type alias (`session.py:275`), not a constructor. The new dataclass has
`kind: ClassVar[str] = "reject"` and `feedback: str | None = None`
whose serializer omits `feedback` when None, preserving the silent-
reject wire shape used previously.
MinimalMode (sdk-boundary:MinimalMode:MUST:7-14)
Pin 8 SDK session-capability kwargs as defense-in-depth so the SDK
side of the boundary cannot acquire context-construction, telemetry,
embedding, or host-git authority. MUST:7-13 are new in b10
(`client.py:1582-1605`); MUST:14 (`enable_session_telemetry`) was a
pre-existing b9 kwarg now consolidated under MinimalMode. Each has an
empty-mode default helper at b10 `_mode.py:185-258` that fires only
when `mode == "empty"`; under `mode="copilot-cli"` the explicit pins
are the wire shape — leaving any of them None lets the bundled CLI
defaults apply.
Env scrubbing
Extract `scrub_sdk_env()` so production wiring and the live-test
fixture share one implementation. b10 keeps `env=` as a REPLACE
(`client.py:3182-3185`) and injects `COPILOT_HOME` from
`base_directory` afterwards (`client.py:3199`), so ambient
`COPILOT_HOME` / `COPILOT_CLI_PATH` must be stripped before the call.
Prewarm task cancellation
Extract `_cancel_prewarm_task()` and call it from both the success-
path cleanup closure and the `mount()` exception handler. Without the
failure-path call, a prewarm task could outlive the client release
triggered by a mount failure (sdk-protection:Subprocess:MUST:5).
SDK floor check
Replace hand-rolled integer-tuple parsing with `packaging.Version`
comparison against `Version("1.0.0b10")`. The floor is the symbol-
availability minimum (`>=1.0.0b10`); the exact pin (`==1.0.0b10`) is
enforced separately by the test-suite version gate. Unparseable
inputs map to a sentinel below every real release (fail closed).
Event router
Add 6 b9 SDK event types to the no-emit allowlist:
`session.autopilot_objective_changed`, `session.permissions_changed`,
`session.custom_notification`, `session.canvas.opened`,
`session.canvas.registry_changed`, `mcp_app.tool_call_complete`.
Each has no kernel-domain mapping; rationale documented inline.
Version: bump `__version__` literal to "2.3.0" to match pyproject.toml.
Quality: ruff: 0 errors | pyright: 0 errors | pytest (linux/py3.14): 1337 passed | pytest (win32/py3.13): 1335 passed | total coverage: 98%
* docs(contracts): sdk-boundary v1.9 + filesystem-layout v1.2 (SDK b10)
Align both contracts with the b10 SDK surface wired in this series.
sdk-boundary.md (1.6 -> 1.9)
- MinimalMode extended from MUST:1-6 to MUST:1-14 (7 new b10
create_session kwargs + telemetry consolidated under one place).
- SDKSurface:MUST:1 rewritten: PermissionRequestResult is a type
alias; rejection is PermissionDecisionReject().
- SDKSurface:MUST:6 updated to the b10 send() shape (5 keyword-only
incl. display_prompt).
- SDKSurface:MUST:8 added: CopilotClient.__init__ keyword-only pin.
- ImportQuarantine:MUST:7 added: copilot.generated.* carve-out
confined to sdk_adapter/_imports.py with TODO/HACK markers.
filesystem-layout.md (1.0 -> 1.2)
- Wiring MUST:1/2/5 rewritten from SubprocessConfig(copilot_home=...)
to CopilotClient(base_directory=..., env=...).
- env= REPLACE semantics make the ambient COPILOT_HOME /
COPILOT_CLI_PATH scrub mandatory.
- Test-anchor table aligned to current fixtures.
Contracts only; no production code change.
Quality: ruff: 0 errors | pyright: 0 errors | pytest (linux/py3.14): 1337 passed | pytest (win32/py3.13): 1335 passed | total coverage: 98%
* chore(stubs): align typings/copilot/*.pyi with SDK 1.0.0b10
Stubs are pyright-only and have no runtime effect; the membrane stays
narrow (opaque `Any` for the long tail of re-exports the provider does
not construct), with precise typing reserved for symbols the provider
actually imports.
client.pyi
- Remove SubprocessConfig (deleted from the SDK at b7).
- Add CopilotClient with keyword-only __init__ matching b10
client.py:1073 (13 keyword params; positional construction is a
type error).
- Add ModelInfo / ModelPolicy / ModelBilling with the exact required
vs defaulted field split from b10 client.py:645 / :670 / :691, so
call-site shape errors fail type-check.
- Add LogLevel = Literal[...] matching b10 client.py:110.
session.pyi
- PermissionRequestResult is now a TypeAlias of
`PermissionDecision | PermissionNoResult` (b10 session.py:275),
not a dataclass; permission denial is constructed via
`PermissionDecisionReject()` from copilot.generated.rpc.
- Add PermissionNoResult dataclass sentinel (b10 session.py:257).
- Move CopilotSession declaration here (canonical home is
copilot.session per b10 session.py:1066); root re-export retained
in __init__.pyi.
- CopilotSession.send / send_and_wait extended to the b10 keyword-
only signature: attachments, mode, agent_mode, request_headers,
display_prompt (display_prompt added in b10).
types.pyi
- Remove SubprocessConfig.
- Tighten BlobAttachment: mimeType required, displayName NotRequired
(b10 session.py:149).
- Tighten ModelPolicy: state and terms required, no defaults
(b10 client.py:645).
__init__.pyi
- Re-exports aligned with b10 __init__.py __all__ (~115 symbols).
- LargeToolOutputConfig and ReasoningSummary added (new in b10).
Quality: ruff: 0 errors | pyright: 0 errors | pytest (linux/py3.14): 1337 passed | pytest (win32/py3.13): 1335 passed | total coverage: 98%
* test(sdk-boundary): align fixtures and assertions to SDK 1.0.0b10
Pins the test surface to the b10 wire shape so the suite fails loud on
SDK regressions instead of drifting silently.
- New `tests/_sdk_version_gate.py` reads the canonical pinned version
and `importlib.metadata.version("github-copilot-sdk")`. Fails (never
skips) on mismatch; imported unconditionally from `conftest.py` so any
environment drift surfaces at collection time.
- `conftest.py` drops the legacy `_default_permission_handler` and
constructs `sdk_client` via the b10 keyword-only `CopilotClient(...)`
signature with `scrub_sdk_env(...)`, matching production wiring.
- `tests/fixtures/sdk_mocks.py` extends `MockSDKSession.send` (and the
error variant) with the b10 `agent_mode` and `display_prompt` kwargs.
- New boundary contracts (`test_sdk_boundary_contract.py`) pin the
eight MinimalMode kwargs end-to-end (MUST:7-14) plus a superset
closure to catch future SDK additions.
- `test_sdk_boundary_quarantine.py` re-binds the `_imports` package
attribute after `sys.modules` patch contexts to prevent mock leakage
into subsequent tests that resolve `from . import _imports`.
- `test_filesystem_acceptance_live.py` adds a `_real_sdk_mode` context
manager that reloads `_imports` + `client` and re-binds
`CopilotClientWrapper` on the three module roots so class identity
holds across mixed mock/live test ordering.
- `test_filesystem_subprocess_env.py` drops the removed
`SubprocessConfig` helper and pins the b10 5-kwarg `CopilotClient`
constructor via a `FakeCopilotClient` capture fixture.
- `test_sdk_assumptions.py` pins keyword-only construction, zero-arg
`PermissionDecisionReject` with `ClassVar` discriminator, the
`PermissionRequestResult` alias-not-constructor shape, and the
`CopilotSession.send` five-keyword-only signature.
- `test_permissions.py` converts a POSIX-only chmod test from a
conditional skip to a runtime fail on `win32` (gate policy: tests
must run or fail, never skip).
- Strengthens five weak assertions in files already in scope:
`is not None` placeholders replaced with isinstance pins
(`copilot.client.ModelBilling`, `copilot._jsonrpc.JsonRpcError`),
direct attribute access (`handle.session_id`), and a `KeyError` raise
on missing `reasoning_effort` parameter. Each assertion now names the
exact SDK contract that breaks if it regresses.
No production wire-shape changes. SDK pin verified end-to-end via the
canonical version gate.
Quality: ruff: 0 errors | pyright: 0 errors | pytest (linux/py3.14): 1337 passed | pytest (win32/py3.13): 1335 passed | total coverage: 98%
* docs: v2.3.0 migration guide, README SDK refs, lock metadata refresh
- `MIGRATION.md`: new v2.2.x → v2.3.0 section. Documents the SDK pin
bump (`1.0.0b10`), the removal of `COPILOT_CLI_PATH` / `COPILOT_HOME`
forwarding to the SDK runtime, and the SDK-side removal of
`copilot.SubprocessConfig` (gone since b7). Each item names the new
behavior, the migration path, and a precise rollback target
(provider `<=2.2.x` with `github-copilot-sdk==1.0.0b9`).
- `README.md`: bumps the SDK reference in Dependencies and the model
table caption to `1.0.0b10` and refreshes the public model snapshot.
The runtime list is still resolved via
`amplifier provider models github-copilot` against the user's plan;
the table is documentation only.
- `uv.lock`: regenerated to reflect the `packaging>=20` requirement
shipped in commit 1 (`e63638d`). No transitive dependency changes.
Quality: ruff: 0 errors | pyright: 0 errors | pytest (linux/py3.14): 1337 passed | pytest (win32/py3.13): 1335 passed | total coverage: 98%
* fix(sdk-boundary): pin mcp_oauth_token_storage in MinimalMode
Pins the 9th SDK mode-gated default (was 8/9). Under mode="copilot-cli" the
default helper returns None, so without this pin the bundled-CLI runtime
default governs OAuth token storage on the wire -- the same gap the other 8
pins close. It was harmless only because mcp_servers={} forecloses the OAuth
flow, leaving the switch silently coupled to an unrelated invariant. Pinning
to "in-memory" cuts that coupling and makes the deny-list complete.
Also corrects three stale b10 anchors in the contract: the emit is an
independent block (not gated by mcpServers); manage_schedule_enabled and
coauthor_enabled are create_session kwargs that resolve to None via the
post-create patch (no emit), not absent kwargs; resume-path anchor fixed.
Verified the live MinimalMode payload emits mcpOAuthTokenStorage:"in-memory"
via a real Amplifier CLI run; added a guard test that fails if any mode-gated
default goes unpinned.
Quality: ruff: 0 errors | pyright: 0 errors | pytest (linux/py3.14): 1349 passed | pytest (win32/py3.13): 1346 passed | total coverage: 98%
---------
Co-authored-by: HDMowri <HDMowri@users.noreply.github.com>1 parent c03a97a commit 2f86895
48 files changed
Lines changed: 3534 additions & 1309 deletions
File tree
- amplifier_module_provider_github_copilot
- config
- data
- sdk_adapter
- contracts
- tests
- fixtures
- typings/copilot
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
1 | 132 | | |
2 | 133 | | |
3 | 134 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
127 | 127 | | |
128 | 128 | | |
129 | 129 | | |
130 | | - | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
131 | 137 | | |
132 | 138 | | |
133 | 139 | | |
134 | 140 | | |
135 | 141 | | |
| 142 | + | |
136 | 143 | | |
| 144 | + | |
| 145 | + | |
137 | 146 | | |
138 | 147 | | |
139 | 148 | | |
140 | | - | |
141 | | - | |
142 | | - | |
143 | | - | |
144 | 149 | | |
145 | 150 | | |
146 | 151 | | |
147 | 152 | | |
148 | 153 | | |
149 | | - | |
150 | | - | |
| 154 | + | |
| 155 | + | |
151 | 156 | | |
152 | 157 | | |
153 | 158 | | |
| |||
504 | 509 | | |
505 | 510 | | |
506 | 511 | | |
507 | | - | |
| 512 | + | |
508 | 513 | | |
509 | 514 | | |
510 | 515 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
4 | | - | |
5 | | - | |
6 | | - | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
7 | 9 | | |
8 | 10 | | |
9 | 11 | | |
| |||
26 | 28 | | |
27 | 29 | | |
28 | 30 | | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
29 | 34 | | |
30 | 35 | | |
31 | 36 | | |
| |||
39 | 44 | | |
40 | 45 | | |
41 | 46 | | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
47 | 72 | | |
48 | 73 | | |
49 | 74 | | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
| 75 | + | |
55 | 76 | | |
56 | | - | |
57 | | - | |
58 | | - | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
59 | 82 | | |
60 | 83 | | |
61 | 84 | | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
62 | 102 | | |
63 | 103 | | |
64 | 104 | | |
65 | 105 | | |
66 | 106 | | |
67 | 107 | | |
68 | 108 | | |
69 | | - | |
| 109 | + | |
70 | 110 | | |
71 | 111 | | |
72 | | - | |
73 | | - | |
74 | 112 | | |
75 | 113 | | |
76 | 114 | | |
77 | | - | |
| 115 | + | |
78 | 116 | | |
79 | 117 | | |
80 | 118 | | |
| |||
89 | 127 | | |
90 | 128 | | |
91 | 129 | | |
92 | | - | |
| 130 | + | |
93 | 131 | | |
94 | 132 | | |
95 | 133 | | |
| |||
192 | 230 | | |
193 | 231 | | |
194 | 232 | | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
195 | 266 | | |
196 | 267 | | |
197 | 268 | | |
| |||
350 | 421 | | |
351 | 422 | | |
352 | 423 | | |
353 | | - | |
354 | | - | |
355 | | - | |
356 | | - | |
357 | | - | |
358 | | - | |
359 | | - | |
360 | | - | |
361 | | - | |
| 424 | + | |
362 | 425 | | |
363 | 426 | | |
364 | 427 | | |
| |||
370 | 433 | | |
371 | 434 | | |
372 | 435 | | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
373 | 440 | | |
374 | 441 | | |
375 | 442 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
60 | | - | |
61 | | - | |
| 60 | + | |
62 | 61 | | |
63 | 62 | | |
64 | 63 | | |
| |||
0 commit comments