Skip to content

Upgrade @github/copilot-sdk to ^1.0.0#311

Merged
plusplusoneplusplus merged 3 commits into
mainfrom
pr/76190469a-upgrade-github-copilot-sdk-to-100
Jun 10, 2026
Merged

Upgrade @github/copilot-sdk to ^1.0.0#311
plusplusoneplusplus merged 3 commits into
mainfrom
pr/76190469a-upgrade-github-copilot-sdk-to-100

Conversation

@plusplusoneplusplus

Copy link
Copy Markdown
Owner

What

Bumps @github/copilot-sdk from ^0.3.0 to ^1.0.0 in all 5 package.json files (root, coc-agent-sdk, forge, coc, deep-wiki) and adapts the wrapper layer to the 1.0.0 breaking changes.

Breaking changes adapted

  • CopilotClientOptions.cwd removed → pass workingDirectory instead (sdk-client-factory.ts incl. the WSL path-translation branch, CopilotSDKService.createClient).
  • CopilotSession.destroy() removed — it was a deprecated alias of disconnect() in 0.3.0 with identical semantics (session state on disk stays resumable). Renamed in request-runner.ts, session-manager.ts, streaming-session.ts, and the IAbortableSession/IStreamableSession structural interfaces.
  • Native tool contract drift (caught by the compile-time guard in types.ts): Tool.handler is now optional (declaration-only tools), ToolBinaryResult.type narrowed to 'image' | 'resource', toolTelemetry uses the SDK's ToolTelemetry shape. CocToolRuntime.callTool now returns an error result for a handler-less tool instead of throwing (new regression test).

Reviewer notes

  • One bug the compiler could not catch: coc/src/server/mcp-oauth/mcp-oauth-initiator.ts typed the session loosely as destroy?: () => Promise<void> and called session.destroy?.() — under 1.0.0 that silently becomes a no-op and leaks the OAuth holder session for up to 10 minutes. Switched to disconnect?.().
  • Verified unchanged in 1.0.0 (no action needed): all session event names, SessionConfig fields, permission decision kinds, sessions.fork / account.getQuota / mcp.oauth.login RPCs, ModelInfo, MessageOptions, ReasoningEffort.
  • Test changes are mechanical destroydisconnect mock renames plus cwdworkingDirectory assertion updates (obsolete cliPath/cliArgs assertions replaced with the 1.0.0 connection equivalent).

Verification

  • coc-agent-sdk: build + 581 tests pass (baseline 580; +1 new regression test)
  • forge: build + 118 copilot-sdk-wrapper tests pass
  • deep-wiki: build + 43 bundle tests pass
  • coc: full build + typecheck + 93 mcp-oauth tests pass
  • Root aggregate: npm run compile (all packages + extension webpack) passes

🤖 Generated with Claude Code

Adapt the coc-agent-sdk wrapper to the 1.0.0 breaking changes:

- CopilotClientOptions: cwd was removed; pass workingDirectory instead
  (sdk-client-factory, CopilotSDKService.createClient).
- CopilotSession.destroy() was removed; use disconnect() everywhere
  (request-runner, session-manager, streaming-session, and the
  IAbortableSession/IStreamableSession structural interfaces).
- coc mcp-oauth-initiator: SessionShape.destroy?.() would have become a
  silent no-op and leaked the OAuth holder session; switched to
  disconnect?.().
- Native tool contract: Tool.handler is now optional (declaration-only
  tools), ToolBinaryResult.type narrowed to 'image' | 'resource', and
  toolTelemetry uses the SDK's ToolTelemetry shape — keeps the
  bidirectional compile-time drift guard in types.ts passing.
- CocToolRuntime.callTool returns an error result for a handler-less
  tool instead of throwing; new regression test covers this.

Tests: renamed destroy->disconnect in session mocks/assertions, updated
sdk-client-factory tests to workingDirectory (cliPath/cliArgs assertions
replaced with connection), and added a declaration-only-tool test.

Verified: coc-agent-sdk build + 581 tests, forge build + 118 wrapper
tests, deep-wiki build + 43 bundle tests, coc build + 93 mcp-oauth
tests, root build:packages + extension webpack all green.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
plusplusoneplusplus and others added 2 commits June 10, 2026 08:21
PermissionRequest is now a union of kind-specific shapes with required
tool-specific payload fields, so bare { kind } literals no longer
type-check. The handlers under test only read kind (and optionally
toolCallId), so build fixtures through a makeRequest() factory that
casts a minimal object instead of fabricating full SDK payloads —
runtime shapes are unchanged.

Fixes the extension-test compile failure on PR #311 (all three OSes).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The SDK's sendAndWait() subscribes a session.error handler that rejects
its internal idle promise, but rejection handling (Promise.race) is only
attached after `await send()` resolves. When the CLI's session.error
event outraces the send acknowledgment — reliably reproduced on slow CI
hosts with an unauthenticated CLI — the promise rejects with no handler
attached and the host process gets an unhandled rejection with the bare
CLI message ("Execution failed: ... Session was not created with
authentication info or custom provider").

This crashed Playwright e2e workers on PR #311: every coc server start
fires the prompt-autocomplete prewarm, which uses the non-streaming
path; the in-process server's unhandled rejection failed whatever test
was running (websocket-recovery 8.x/10.x, multi-workspace-ui).

RequestRunner.sendWithTimeout now implements the send + idle/error/
timeout wait itself, attaching all handlers (plus a pre-send no-op
catch) before send() is issued, so the error event can never reject an
unobserved promise. Sessions lacking on()/send() still fall back to the
SDK's sendAndWait.

Tests: new regression test dispatches session.error synchronously during
send() and asserts a graceful error result with zero unhandled
rejections; the non-streaming contract test now asserts send()+events
are used and sendAndWait is not; skills-test mocks drop their inert
on/send stubs to keep exercising the fallback.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@plusplusoneplusplus plusplusoneplusplus merged commit 1aa53b8 into main Jun 10, 2026
36 checks passed
@plusplusoneplusplus plusplusoneplusplus deleted the pr/76190469a-upgrade-github-copilot-sdk-to-100 branch June 10, 2026 16:57
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.

1 participant