Upgrade @github/copilot-sdk to ^1.0.0#311
Merged
plusplusoneplusplus merged 3 commits intoJun 10, 2026
Merged
Conversation
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>
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>
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.
What
Bumps
@github/copilot-sdkfrom^0.3.0to^1.0.0in 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.cwdremoved → passworkingDirectoryinstead (sdk-client-factory.tsincl. the WSL path-translation branch,CopilotSDKService.createClient).CopilotSession.destroy()removed — it was a deprecated alias ofdisconnect()in 0.3.0 with identical semantics (session state on disk stays resumable). Renamed inrequest-runner.ts,session-manager.ts,streaming-session.ts, and theIAbortableSession/IStreamableSessionstructural interfaces.types.ts):Tool.handleris now optional (declaration-only tools),ToolBinaryResult.typenarrowed to'image' | 'resource',toolTelemetryuses the SDK'sToolTelemetryshape.CocToolRuntime.callToolnow returns an error result for a handler-less tool instead of throwing (new regression test).Reviewer notes
coc/src/server/mcp-oauth/mcp-oauth-initiator.tstyped the session loosely asdestroy?: () => Promise<void>and calledsession.destroy?.()— under 1.0.0 that silently becomes a no-op and leaks the OAuth holder session for up to 10 minutes. Switched todisconnect?.().SessionConfigfields, permission decision kinds,sessions.fork/account.getQuota/mcp.oauth.loginRPCs,ModelInfo,MessageOptions,ReasoningEffort.destroy→disconnectmock renames pluscwd→workingDirectoryassertion updates (obsoletecliPath/cliArgsassertions replaced with the 1.0.0connectionequivalent).Verification
npm run compile(all packages + extension webpack) passes🤖 Generated with Claude Code