Skip to content

Add capi.disableWebSocketResponses and provider.transport session options#1711

Open
dereklegenzoff wants to merge 2 commits into
mainfrom
dereklegenzoff/capi-disable-websocket-responses
Open

Add capi.disableWebSocketResponses and provider.transport session options#1711
dereklegenzoff wants to merge 2 commits into
mainfrom
dereklegenzoff/capi-disable-websocket-responses

Conversation

@dereklegenzoff

@dereklegenzoff dereklegenzoff commented Jun 17, 2026

Copy link
Copy Markdown

Why

Two related WebSocket transport controls for the SDK's hand-written session options, both follow-ups to runtime PRs that were already merged/under review and explicitly called out as needing a corresponding SDK change:

  1. capi.disableWebSocketResponses — WebSocket transport is now the default for the CAPI (Copilot API) Responses API whenever a model advertises the ws:/responses endpoint. That breaks for users behind proxies or in networks where WebSockets fail, so they need a way to opt out and fall back to the HTTP Responses transport. SDK-side follow-up to github/copilot-agent-runtime#10551 (requested in review by @SteveSandersonMS).
  2. provider.transport — BYOK OpenAI-compatible providers need the opposite knob: an opt-in to deliver Responses API requests over a persistent WebSocket connection instead of HTTP (better for long-running, tool-call-heavy sessions that benefit from incremental previous_response_id continuations). SDK-side follow-up to github/copilot-agent-runtime#9557.

These are two distinct, complementary toggles: capi.disableWebSocketResponses opts out of WS for GitHub's Copilot API; provider.transport opts in to WS for your own BYOK endpoint. They are independent and coexist.

What

1. capi.disableWebSocketResponses

New nested session option capi: { disableWebSocketResponses?: boolean } on session create and resume. When true, the session uses the HTTP Responses transport instead of WebSockets. Equivalent to setting the COPILOT_CLI_DISABLE_WEBSOCKET_RESPONSES environment variable. Scoped under a capi namespace (not a top-level option) by design: a single session can host multiple providers (CAPI + BYOK), so transport choice is conceptually provider-level.

Wire shape: session.create / session.resume params gain capi: { disableWebSocketResponses: true }, omitted entirely when unset.

2. provider.transport

New field transport?: "http" | "websockets" (default "http") on the BYOK ProviderConfig. When "websockets", Responses API requests for that OpenAI-compatible provider are delivered over a persistent WebSocket connection. Flows through the already-wired provider option on session create and resume.

Wire shape: provider.transport serializes as a plain camelCase string, omitted when unset.

Approach

Both options are hand-written pass-throughs. Session create/resume options — and the ProviderConfig type — are hand-written in every language (not codegen-driven), so these ship independently of the runtime releases:

  • capi is a new nested type mirroring the existing provider (BYOK) nested option exactly, wired into both the create and resume RPC params in every language.
  • transport is a single new field on ProviderConfig mirroring the existing wireApi field; it needs no new wiring because the whole provider object is already serialized end-to-end.

Per-language summary:

  • Node.js (reference): CapiSessionOptions interface + SessionConfigBase.capi wired in create/resume + re-export; transport on ProviderConfig. Tests added.
  • Python: CapiSessionOptions TypedDict + camelCase wire helper + capi kwarg + export; transport on ProviderConfig TypedDict + wire mapping. Tests added.
  • Go: CapiSessionOptions struct + Capi on configs/wire requests/builders; Transport on ProviderConfig. Tests added.
  • Java: new CapiSessionOptions (fluent + Jackson) wired in SessionRequestBuilder for create/resume; transport field + getter/fluent-setter on ProviderConfig. Tests added.
  • .NET: CapiSessionOptions class + Capi on SessionConfigBase (copy-ctor, both request records, serializer context); Transport on ProviderConfig. Tests added.
  • Rust: CapiSessionOptions (#[non_exhaustive] + builders) + capi on configs/wire; transport field + with_transport builder on ProviderConfig. Tests added.

Compatibility

Both fields are harmless no-ops on a CLI runtime that predates the corresponding runtime PR, so the SDK changes are safe to land ahead of (or independently of) the runtime releases.

Deferred follow-up (by design)

  • No @github/copilot dependency bump / codegen re-run. The current schema does not contain a generated CapiSessionOptions, and the generated ProviderConfig is not the consumer-facing type (the SDK exports a hand-written one). Once the runtime PRs publish, an optional bump + codegen re-run can produce generated types; the hand-written pass-throughs are sufficient in the meantime.
  • No session.options.update (live update) wiring. This PR covers session create and resume only.

Testing

Built and ran the per-language unit suites for every change — Node.js, Python, Go, Java, Rust, and .NET all pass locally (formatting/lint/clippy/spotless clean where applicable). e2e suites that require the replay-proxy harness were out of scope for local verification.

Refs github/copilot-agent-runtime#10551, github/copilot-agent-runtime#9557

Add the capi.disableWebSocketResponses opt-out to session create/resume
across all six SDK languages, so consumers in proxy/WebSocket-blocked
environments can fall back to the HTTP Responses transport for the CAPI
Responses API.

SDK-side follow-up to github/copilot-agent-runtime#10551, which makes
WebSocket transport the default for CAPI and adds this opt-out. The field
is a hand-written pass-through mirroring the existing provider (BYOK)
nested option, wired into session.create and session.resume.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings June 17, 2026 19:26
@dereklegenzoff dereklegenzoff requested a review from a team as a code owner June 17, 2026 19:26

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a provider-scoped session option capi.disableWebSocketResponses to the session create and resume request shapes across all SDK languages, allowing users to opt out of the default WebSocket-based CAPI Responses transport and fall back to HTTP (useful in proxy-restricted environments).

Changes:

  • Introduces CapiSessionOptions (language-idiomatic) and threads it through session create/resume configs and wire payloads.
  • Ensures the option is omitted from the wire payload when unset (via optional fields / non-null serialization).
  • Adds/extends unit tests to verify forwarding + serialization behavior.
Show a summary per file
File Description
rust/src/wire.rs Adds optional capi field to Rust create/resume wire payload structs.
rust/src/types.rs Introduces CapiSessionOptions, adds capi to SessionConfig/ResumeSessionConfig, and adds serialization tests.
python/test_client.py Adds unit test ensuring capi options are forwarded on create/resume.
python/copilot/client.py Adds CapiSessionOptions TypedDict, wire conversion helper, and capi kwarg wiring for create/resume.
python/copilot/init.py Re-exports CapiSessionOptions from the package surface.
nodejs/test/client.test.ts Adds test verifying capi forwarding on session.create and session.resume.
nodejs/src/types.ts Adds CapiSessionOptions and capi?: to shared session config base types.
nodejs/src/index.ts Re-exports CapiSessionOptions in public entrypoint.
nodejs/src/client.ts Forwards config.capi into session.create / session.resume request params.
java/src/test/java/com/github/copilot/JsonIncludeNonNullTest.java Adds JSON non-null include annotation coverage for CapiSessionOptions.
java/src/test/java/com/github/copilot/CapiSessionOptionsTest.java New test suite covering Java option defaults, fluent setters, and request inclusion/omission.
java/src/main/java/com/github/copilot/SessionRequestBuilder.java Wires config.getCapi() into create/resume request builders.
java/src/main/java/com/github/copilot/rpc/SessionConfig.java Adds capi field + getter/setter + clone propagation.
java/src/main/java/com/github/copilot/rpc/ResumeSessionConfig.java Adds capi field + getter/setter + clone propagation.
java/src/main/java/com/github/copilot/rpc/CreateSessionRequest.java Adds capi JSON property + accessor methods on the wire request type.
java/src/main/java/com/github/copilot/rpc/ResumeSessionRequest.java Adds capi JSON property + accessor methods on the wire request type.
java/src/main/java/com/github/copilot/rpc/CapiSessionOptions.java New Java RPC type with Jackson annotations and fluent setter for disableWebSocketResponses.
go/types.go Adds CapiSessionOptions, threads it through session configs and create/resume request structs.
go/client.go Forwards config.Capi into create/resume RPC request builders.
go/client_test.go Adds tests ensuring capi.disableWebSocketResponses is serialized/forwarded and omitted when unset.
dotnet/test/Unit/SerializationTests.cs Adds serialization coverage for CapiSessionOptions and create/resume request inclusion/omission.
dotnet/test/Unit/CloneTests.cs Extends clone coverage to ensure Capi is copied consistently.
dotnet/src/Types.cs Introduces CapiSessionOptions, adds it to SessionConfigBase, and registers it for source-gen serialization.
dotnet/src/Client.cs Threads config.Capi through internal create/resume request records and serializer context.

Copilot's findings

  • Files reviewed: 24/24 changed files
  • Comments generated: 0

@github-actions

This comment has been minimized.

Add the BYOK provider `transport` field ("http" | "websockets", default
"http") to the hand-written ProviderConfig across all six SDK languages,
so BYOK OpenAI-compatible providers can opt into delivering Responses API
requests over a persistent WebSocket connection instead of HTTP.

SDK-side follow-up to github/copilot-agent-runtime#9557, which adds the
runtime `transport` option. The SDK's consumer-facing ProviderConfig is
hand-written (not generated from the schema), so the field is added as a
pass-through mirroring the existing `wireApi` field, flowing through the
already-wired `provider` option on session create and resume.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@dereklegenzoff dereklegenzoff changed the title Add capi.disableWebSocketResponses session option Add capi.disableWebSocketResponses and provider.transport session options Jun 18, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Cross-SDK Consistency Review ✅

This PR adds two new session options (capi.disableWebSocketResponses and provider.transport) across all six SDK implementations. I reviewed the changes for feature parity and API consistency.

Coverage

All six SDKs are updated in this PR:

SDK CapiSessionOptions type capi on session configs transport on ProviderConfig Tests
Node.js
Python
Go
.NET
Java
Rust

Wire Format Consistency

All SDKs agree on the JSON wire shape:

  • "capi": { "disableWebSocketResponses": true } — CAPI option, omitted when unset
  • "transport": "websockets" — nested in the existing provider object, omitted when unset

API Naming Conventions

Conventions are correctly applied per language:

  • camelCase: disableWebSocketResponses / capi (Node.js, Java)
  • snake_case: disable_web_socket_responses / capi (Python, Rust) with camelCase wire serialization
  • PascalCase: DisableWebSocketResponses / Capi (Go, .NET)

Type Safety

  • transport uses typed string literals ("http" | "websockets") in TypeScript and Python, and untyped string in Go, .NET, Java, and Rust — appropriate for each language's idioms
  • disableWebSocketResponses correctly supports tri-state (true / false / unset) across all SDKs using bool?, *bool, Option<bool>, or total=False TypedDict field

Export Visibility

CapiSessionOptions is correctly exported from the public API surface in all SDKs (Node.js index.ts, Python __init__.py, Go exported type, .NET public class, Java public class, Rust pub struct).

Both Session Operations

Both create_session and resume_session (and their equivalents) are updated in all SDKs. ✅


No consistency issues found. The changes are symmetric, well-documented, and follow each language's established conventions.

Generated by SDK Consistency Review Agent for issue #1711 · sonnet46 1.9M ·

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.

2 participants