rust: add isExperimentalMode to session create/resume wire#1600
Open
jmoseley wants to merge 1 commit into
Open
rust: add isExperimentalMode to session create/resume wire#1600jmoseley wants to merge 1 commit into
jmoseley wants to merge 1 commit into
Conversation
Add an optional `is_experimental_mode` field to `SessionConfig` and `ResumeSessionConfig` (plus `with_is_experimental_mode` builders) that serializes as camelCase `isExperimentalMode` and is omitted from the `session.create` / `session.resume` wire when `None`. Lets a consumer disable (`false`) or force-enable (`true`) the experimental feature-flag tier for a single session without persisting to the user's shared config. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
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
Comment on lines
+2023
to
+2026
| /// Disable (`false`) or force-enable (`true`) the experimental feature-flag | ||
| /// tier for this session only. `None` (default) inherits the CLI process's | ||
| /// flags. Never persists to config. See the field docs for resume caveats. | ||
| pub fn with_is_experimental_mode(mut self, is_experimental_mode: bool) -> Self { |
Collaborator
|
We will want to add this to all 6 SDKs, not just Rust. |
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.
Summary
Adds an optional
is_experimental_modefield to the Rust SDK'sSessionConfigandResumeSessionConfigso a consumer can tell the runtime to disable (false) or force-enable (true) the experimental feature-flag tier for a single session — without persisting anything to the user's shared config.This pairs with a companion copilot-agent-runtime change that adds an optional
isExperimentalMode?: booleanfield to the classic--serverSessionCreateRequest/SessionResumeRequest. Runtime semantics:false⇒ re-resolve that session's feature flags as if experimental were offtrue⇒ enable even if the process didn'tThe motivating consumer is the GitHub desktop app, which spawns
copilot --serverand needs per-session control over the experimental tier.Changes
rust/src/wire.rs: Addis_experimental_mode: Option<bool>(withskip_serializing_if = "Option::is_none") toSessionCreateWireandSessionResumeWire. Serializes asisExperimentalModevia the existingrename_all = "camelCase", omitted from the wire whenNoneso older CLIs are unaffected.rust/src/types.rs:pub is_experimental_mode: Option<bool>toSessionConfigandResumeSessionConfigwith doc comments (resume doc notes it only re-resolves on the cold-load path).Debugimpls,Default/newconstructors, and bothinto_wiremappings.with_is_experimental_mode(bool)builders to both, mirroringwith_enable_mcp_apps.Tests
Added four unit tests (co-located with the existing wire/types tests):
session_config_is_experimental_mode_serializes_when_set— asserts"isExperimentalMode": falseis present.session_config_is_experimental_mode_omitted_when_none— asserts the key is absent.resume_session_config_is_experimental_mode_serializes_when_setresume_session_config_is_experimental_mode_omitted_when_noneValidation
cargo fmt,cargo clippy --all-targets, andcargo buildare clean. Full lib test suite passes (151 passed; 0 failed), including the 4 new tests.No schema codegen needed — this
--serverpath is hand-written.Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com