Skip to content

Expose new session options across SDKs#1865

Merged
stephentoub merged 4 commits into
mainfrom
stephentoub-compare-sdk-options
Jul 1, 2026
Merged

Expose new session options across SDKs#1865
stephentoub merged 4 commits into
mainfrom
stephentoub-compare-sdk-options

Conversation

@stephentoub

Copy link
Copy Markdown
Collaborator

Runtime session options have grown beyond what the SDKs expose, so this brings create and resume session configuration back into parity across the language SDKs.

Summary

  • Adds enableCitations, excludedBuiltinAgents, and sessionLimits to the C#, Node/TS, Python, Go, Rust, and Java SDK create/resume session surfaces using each SDK's existing naming and configuration style.
  • Wires the new options through each SDK's request-building path to the runtime wire names: enableCitations, excludedBuiltinAgents, and sessionLimits.maxAiCredits.
  • Adds unit coverage for request forwarding, serialization, and clone behavior where applicable.
  • Adds replay-backed E2E coverage for session limits and excluded built-in agents, plus request-capture E2E coverage for Anthropic citation document blocks.

Validation

  • Node typecheck and focused client/session config tests passed.
  • Python ruff and focused client/session config tests passed.
  • .NET focused net8 tests passed.
  • Rust formatting passed.
  • git diff --check passed.

Go formatting/tests, Java Maven validation, and Rust test execution could not be run locally because the environment is missing go/gofmt, java/JAVA_HOME, and native clang tooling respectively. Static review and three parallel code-review agents found no high-confidence issues.

Generated by Copilot

Adds enable citations, excluded built-in agents, and session limits to create and resume session options across the SDKs, with forwarding tests and replay-backed E2E coverage for session limits, agent exclusion, and citation request shaping.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 1, 2026 02:32
@stephentoub stephentoub requested a review from a team as a code owner July 1, 2026 02:32
Comment thread java/src/main/java/com/github/copilot/rpc/ResumeSessionConfig.java Fixed
Comment thread java/src/main/java/com/github/copilot/rpc/SessionConfig.java Fixed

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 brings the SDKs back into parity with newer runtime session options by exposing and forwarding enableCitations, excludedBuiltinAgents, and sessionLimits.maxAiCredits across the supported language clients, with accompanying unit + E2E coverage and updated replay snapshots.

Changes:

  • Adds new create/resume session options across Rust, Python, Node/TS, Go, Java, and .NET SDK surfaces and forwards them to the runtime wire fields.
  • Introduces/extends unit tests to validate request forwarding, JSON serialization, and config cloning behavior.
  • Adds replay-backed E2E tests (and snapshots) for session limits and excluded built-in agents, plus request-capture E2Es validating Anthropic document citation blocks.
Show a summary per file
File Description
test/snapshots/session_config/should_apply_session_limits_on_resume.yaml New replay snapshot for session-limits behavior on resume.
test/snapshots/session_config/should_apply_session_limits_on_create.yaml New replay snapshot for session-limits behavior on create.
test/snapshots/session_config/should_apply_excluded_built_in_agents_on_resume.yaml New replay snapshot for excluded built-in agents on resume.
test/snapshots/session_config/should_apply_excluded_built_in_agents_on_create.yaml New replay snapshot for excluded built-in agents on create.
rust/tests/session_test.rs Adds unit tests asserting new session options are sent in session.create / session.resume.
rust/tests/e2e/session_config.rs Adds Rust E2E coverage for session limits, excluded agents, and Anthropic citation document blocks via request capture.
rust/src/wire.rs Extends Rust create/resume wire structs with new session option fields.
rust/src/types.rs Exposes new options on Rust SessionConfig / ResumeSessionConfig (builder methods + debug/default/wire plumbing).
python/test_client.py Adds unit coverage verifying create/resume forward the new options to wire payloads.
python/e2e/test_session_config_e2e.py Adds Python E2E tests for limits/exclusions and request-capture citation assertions.
python/e2e/_copilot_request_helpers.py Extends synthetic inference response builder to support Anthropic /messages.
python/copilot/session.py Introduces SessionLimitsConfig typed dict for Python surface area.
python/copilot/client.py Adds new create/resume kwargs and wire conversion for sessionLimits.
python/copilot/init.py Exports SessionLimitsConfig from the Python package surface.
nodejs/test/e2e/session_config.e2e.test.ts Adds Node/TS E2E coverage for session limits, excluded agents, and Anthropic citation document blocks.
nodejs/test/client.test.ts Adds unit test ensuring new session options are forwarded in create/resume RPC payloads.
nodejs/src/types.ts Extends Node/TS session config types with new options (docs + experimental tags).
nodejs/src/client.ts Wires new options into Node/TS session.create and session.resume request-building paths.
java/src/test/java/com/github/copilot/SessionRequestBuilderTest.java Adds unit assertions that Java request builder forwards new options.
java/src/test/java/com/github/copilot/SessionConfigE2ETest.java Adds Java E2E tests for limits/exclusions and Anthropic citation document blocks.
java/src/test/java/com/github/copilot/CopilotRequestTestSupport.java Enhances Java request interception to retain request bodies and synthesize Anthropic /messages responses.
java/src/test/java/com/github/copilot/ConfigCloneTest.java Adds Java clone tests covering new session policy options.
java/src/main/java/com/github/copilot/SessionRequestBuilder.java Forwards new session options into Java create/resume request objects.
java/src/main/java/com/github/copilot/rpc/SessionConfig.java Adds Java session config properties for excluded agents, citations, and session limits (with cloning).
java/src/main/java/com/github/copilot/rpc/ResumeSessionRequest.java Extends Java resume request wire object with new option fields.
java/src/main/java/com/github/copilot/rpc/ResumeSessionConfig.java Adds Java resume config properties for excluded agents, citations, and session limits (with cloning).
java/src/main/java/com/github/copilot/rpc/CreateSessionRequest.java Extends Java create request wire object with new option fields.
go/types.go Extends Go SessionConfig / ResumeSessionConfig and wire request structs with new options.
go/internal/e2e/testharness/proxy.go Extends Go harness tool-function shape to retain parameters for assertions.
go/internal/e2e/session_config_e2e_test.go Adds Go E2E coverage for session limits/exclusions and request-capture citation assertions.
go/internal/e2e/copilot_request_session_id_e2e_test.go Enhances Go request interception to store request bodies for downstream assertions.
go/internal/e2e/copilot_request_helpers_test.go Extends Go synthetic inference responses to support Anthropic /messages.
go/client.go Wires new options into Go create/resume request-building code.
go/client_test.go Adds Go unit coverage validating new session option forwarding.
dotnet/test/Unit/SerializationTests.cs Adds .NET serialization unit test for citations/exclusions/limits in session requests.
dotnet/test/Unit/CloneTests.cs Extends .NET clone tests to include new session options and collection independence.
dotnet/test/Harness/CapiProxy.cs Extends .NET harness tool-function shape to retain parameters for assertions.
dotnet/test/E2E/SessionConfigE2ETests.cs Adds .NET E2E coverage for session limits/exclusions and Anthropic citation document blocks.
dotnet/test/E2E/CopilotRequestE2EProvider.cs Enhances .NET request interception to retain request bodies and synthesize Anthropic /messages responses.
dotnet/src/Types.cs Exposes new session options on .NET config types with docs/attributes and cloning support.
dotnet/src/Client.cs Forwards new options into .NET create/resume wire requests and updates source-gen types list.

Review details

  • Files reviewed: 41/41 changed files
  • Comments generated: 0
  • Review effort level: Low

@github-actions

This comment has been minimized.

Defensively copy excluded built-in agents lists and use the non-deprecated Java session request builder overload in tests.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@github-actions

This comment has been minimized.

stephentoub and others added 2 commits July 1, 2026 00:17
Rust: add missing model field/builder to ResumeSessionConfig so
sessions can switch models on resume, matching the existing
capability in the other language SDKs (Go, Node.js, Python, .NET,
Java). The newly added citations-on-resume e2e test called
ResumeSessionConfig::with_model, which didn't exist, causing a
compile failure on all three Rust CI runners. Also removed the
resulting unused SessionConfig import in the e2e test file.

Java: run 'mvn spotless:apply' to fix formatting violations in
SessionConfigE2ETest.java, CreateSessionRequest.java, and
ResumeSessionRequest.java introduced by the new session option
changes.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
The two new should_enable_citations_for_anthropic_file_attachments_on_create/
on_resume e2e tests set a session-level gitHubToken (via
approve_all_session_config()/with_github_token) while also specifying a
Provider, which the CLI rejects with 'Cannot specify both gitHubToken and
provider in session.create/resume.' This matches the .NET SDK's equivalent
tests, which never pass GitHubToken alongside Provider.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Cross-SDK Consistency Review ✅

Reviewed all 6 SDK implementations (Node.js/TypeScript, Python, Go, .NET, Java, Rust) for the three new session options. All changes are consistent.

New Options Coverage

Option Node.js Python Go .NET Java Rust
enableCitations enableCitations?: boolean enable_citations: bool | None EnableCitations *bool bool? EnableCitations Optional<Boolean> enable_citations: Option<bool>
excludedBuiltinAgents excludedBuiltinAgents?: string[] excluded_builtin_agents: list[str] ExcludedBuiltInAgents []string IList<string>? ExcludedBuiltInAgents List<String> excluded_builtin_agents: Option<Vec<String>>
sessionLimits sessionLimits?: SessionLimitsConfig session_limits: SessionLimitsConfig SessionLimits *rpc.SessionLimitsConfig SessionLimitsConfig? SessionLimits SessionLimitsConfig session_limits: Option<SessionLimitsConfig>

Key Checks Passed

  • Wire format consistency: All SDKs serialize to the same wire keys (enableCitations, excludedBuiltinAgents, sessionLimits). The ExcludedBuiltInAgentsexcludedBuiltinAgents mapping is handled correctly in each language (Rust via rename_all = "camelCase", .NET via explicit [JsonPropertyName], Java via @JsonProperty, etc.). ✅
  • Both create and resume paths: All SDKs wire the three new fields for both createSession and resumeSession. ✅
  • Experimental annotations: enableCitations and sessionLimits are consistently marked experimental across all SDKs (.NET: [Experimental], Java: @CopilotExperimental, Go: // Experimental: comment, Rust: **Experimental.**, Node.js: @experimental, Python: **Experimental.**). ✅
  • SessionLimitsConfig.maxAiCredits shape: Consistent across all generated/TypedDict types, with Python correctly mapping max_ai_creditsmaxAiCredits at the wire layer. ✅
  • Rust model catch-up: Rust's ResumeSessionConfig was the only SDK missing a model field; this PR brings it into parity with all other SDKs. ✅
  • E2E coverage: Snapshot-backed tests added for excludedBuiltinAgents and sessionLimits on both create and resume; request-capture coverage added for enableCitations. ✅

No cross-SDK consistency issues found.

Generated by SDK Consistency Review Agent for issue #1865 · sonnet46 2.8M ·

@stephentoub stephentoub merged commit 64dcd25 into main Jul 1, 2026
41 checks passed
@stephentoub stephentoub deleted the stephentoub-compare-sdk-options branch July 1, 2026 05:27
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