all SDKs: add EnableExperimentalMode to session create/resume wire with mode-aware defaults - #1600
Conversation
There was a problem hiding this comment.
Pull request overview
Adds per-session control of the Copilot CLI experimental feature-flag tier to the Rust SDK by threading an optional is_experimental_mode: Option<bool> through the user-facing config types into the JSON-RPC session.create / session.resume wire payloads (camelCased as isExperimentalMode and omitted when None for backwards compatibility).
Changes:
- Add
is_experimental_mode: Option<bool>toSessionCreateWireandSessionResumeWirewithskip_serializing_if = "Option::is_none". - Add
is_experimental_mode: Option<bool>toSessionConfigandResumeSessionConfig, wire it through defaults/debug/into_wire, and addwith_is_experimental_mode(bool)builders. - Add unit tests asserting
isExperimentalModeserializes when set and is omitted whenNonefor both create and resume paths.
Show a summary per file
| File | Description |
|---|---|
| rust/src/wire.rs | Extends create/resume JSON wire structs to include optional isExperimentalMode when provided. |
| rust/src/types.rs | Exposes is_experimental_mode on public config types, maps it into wire payloads, and adds serialization/omission tests. |
Copilot's findings
- Files reviewed: 2/2 changed files
- Comments generated: 1
|
We will want to add this to all 6 SDKs, not just Rust. |
|
@copilot Continue this PR by adding support for the other 5 languages in addition to Rust |
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Generated by SDK Consistency Review Agent for issue #1600 · sonnet46 1.5M
|
@copilot Fix all the CI errors |
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Generated by SDK Consistency Review Agent for issue #1600 · sonnet46 1.8M
1a39b41 to
096aede
Compare
|
Removed the two redundant |
There was a problem hiding this comment.
Review details
Suppressed comments (1)
dotnet/test/Unit/SerializationTests.cs:1130
- These tests invoke a private implementation method via reflection, so they bypass the public create/resume pipeline and would still pass if the default were never included in the outgoing RPC. Please cover the mode default through
CreateSessionAsync/ResumeSessionAsyncwith a captured request instead; .NET tests in this repository are required to exercise public APIs only.
var method = typeof(CopilotClient).GetMethod(
"ApplyConfigDefaultsForMode",
System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic);
Assert.NotNull(method);
method!.Invoke(client, [config]);
- Files reviewed: 25/25 changed files
- Comments generated: 0 new
- Review effort level: Balanced
This comment has been minimized.
This comment has been minimized.
096aede to
acdffac
Compare
|
Addressed in acdffac: replaced the two |
This comment has been minimized.
This comment has been minimized.
acdffac to
c23d6fa
Compare
This comment has been minimized.
This comment has been minimized.
c23d6fa to
0cc82e9
Compare
This comment has been minimized.
This comment has been minimized.
Adds per-session EnableExperimentalMode (enableExperimentalMode /
enable_experimental_mode) to all SDK languages. The flag controls whether
the session enables experimental features.
Semantics are mode-aware and consistent across languages:
- In "empty" mode the SDK sends false unless the caller explicitly sets
true, so headless integrations are not silently opted into experimental
behaviour.
- In "copilot-cli" mode the field is omitted from the wire when nil/null/
None, letting the runtime decide (e.g. based on staff-user flags).
Wire field is isExperimentalMode on both session.create and session.resume.
Changes per language:
- Rust: enable_experimental_mode on SessionConfig / ResumeSessionConfig,
experimental_mode_for_mode helper in mode.rs, 6 new unit tests
- .NET: EnableExperimentalMode on SessionOptions / SessionResumeOptions,
mode-aware default in Client.CreateSessionAsync/ResumeSessionAsync
- Node: enableExperimentalMode on SessionOptions / SessionResumeOptions
- Python: enable_experimental_mode param on create_session/resume_session,
_enable_experimental_mode_default helper in _mode.py
- Go: EnableExperimentalMode on SessionConfig / ResumeSessionConfig,
empty-mode default in mode_empty.go
- Java: enableExperimentalMode on SessionConfig / ResumeSessionConfig,
experimentalModeForMode helper in SessionRequestBuilder
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
0cc82e9 to
d802925
Compare
Cross-SDK Consistency Review ✅This PR adds
No consistency issues found. The feature parity looks complete and well-implemented.
|
Summary
Adds per-session
EnableExperimentalModesupport across all SDKs so a consumer can control whether a session enables experimental features.This pairs with a companion copilot-agent-runtime change that adds an optional
isExperimentalMode?: booleanfield to the classic--serverSessionCreateRequest/SessionResumeRequest.SDK semantics are now mode-aware and consistent across languages:
copilot-climode, the SDK leaves the field unset by default so the runtime decidesemptymode, the SDK sendsfalseby default unless the developer explicitly opts in withtrueThe motivating consumer is the GitHub desktop app, which spawns
copilot --serverand needs per-session control over the experimental tier.Changes
Rust
rust/src/wire.rs: Addis_experimental_mode: Option<bool>(withskip_serializing_if = "Option::is_none") toSessionCreateWireandSessionResumeWire. Serializes asisExperimentalModevia the existingrename_all = "camelCase".rust/src/types.rs:pub enable_experimental_mode: Option<bool>toSessionConfigandResumeSessionConfig.Debugimpls,Default/newconstructors, and bothinto_wiremappings.with_enable_experimental_mode(bool)builders to both.rust/src/mode.rs/rust/src/session.rs: Apply mode-aware defaulting so unset values becomefalseinClientMode::Emptyand remain unset inClientMode::CopilotCli.Node.js / TypeScript
enableExperimentalMode?: booleanto the public session config surface.session.createandsession.resumerequest payloads as wire fieldisExperimentalMode."empty"mode sendsfalsewhen unset, while"copilot-cli"leaves it unset.Python
enable_experimental_mode: bool | Nonetocreate_session/resume_session.isExperimentalModeinsession.createandsession.resume.mode="empty"sendsFalsewhen unset, whilemode="copilot-cli"leaves it unset.Go
EnableExperimentalMode *booltoSessionConfigandResumeSessionConfig.createSessionRequest/resumeSessionRequestwire structs and request building, keeping the wire field nameisExperimentalMode.applyConfigDefaultsForMode/applyResumeDefaultsForModeso unset values becomefalseonly inModeEmpty..NET
EnableExperimentalModetoSessionConfigBase.CreateSessionRequest/ResumeSessionRequestand clone logic, while keeping the wire field name unchanged.ApplyConfigDefaultsForModeso unset values becomefalseonly inCopilotClientMode.Empty.Java
enableExperimentalModesupport toSessionConfigandResumeSessionConfigwith getter/setter/clear methods and clone wiring.SessionRequestBuilderintoCreateSessionRequest/ResumeSessionRequest, keeping the wire field nameisExperimentalMode.SessionRequestBuildermode-aware so empty mode defaults unset values tofalse, while copilot-cli leaves them unset.Tests
Added or updated focused tests in each SDK to verify
EnableExperimentalModeis forwarded when set and that the default behavior is mode-aware while the wire payload still usesisExperimentalMode:None, plus mode-default helper testsSessionRequestBuilderTestcoverage for create/resume set, omitted, and empty-mode default casesValidation
cargo test experimental_modepasses locally withCOPILOT_SKIP_CLI_DOWNLOAD=1enableExperimentalModepassuv run pytest test_client.py -k "enable_experimental_mode"passesSerializationTestscoverage forEnableExperimentalModeand mode defaults passesmvn -Denforcer.skip=true test -Dtest=SessionRequestBuilderTestpasses locallyNo schema codegen needed for this change path.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>