Expose new session options across SDKs#1865
Merged
Merged
Conversation
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>
Contributor
There was a problem hiding this comment.
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
This comment has been minimized.
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>
This comment has been minimized.
This comment has been minimized.
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>
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
Key Checks Passed
No cross-SDK consistency issues found.
|
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.
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
enableCitations,excludedBuiltinAgents, andsessionLimitsto the C#, Node/TS, Python, Go, Rust, and Java SDK create/resume session surfaces using each SDK's existing naming and configuration style.enableCitations,excludedBuiltinAgents, andsessionLimits.maxAiCredits.Validation
git diff --checkpassed.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 nativeclangtooling respectively. Static review and three parallel code-review agents found no high-confidence issues.Generated by Copilot