Skip to content

rust: add isExperimentalMode to session create/resume wire#1600

Open
jmoseley wants to merge 1 commit into
mainfrom
jmoseley/rust-sdk-is-experimental-mode
Open

rust: add isExperimentalMode to session create/resume wire#1600
jmoseley wants to merge 1 commit into
mainfrom
jmoseley/rust-sdk-is-experimental-mode

Conversation

@jmoseley
Copy link
Copy Markdown
Contributor

@jmoseley jmoseley commented Jun 8, 2026

Summary

Adds an optional is_experimental_mode field to the Rust SDK's SessionConfig and ResumeSessionConfig so 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?: boolean field to the classic --server SessionCreateRequest / SessionResumeRequest. Runtime semantics:

  • false ⇒ re-resolve that session's feature flags as if experimental were off
  • true ⇒ enable even if the process didn't
  • omitted ⇒ inherit process flags unchanged (no-op)

The motivating consumer is the GitHub desktop app, which spawns copilot --server and needs per-session control over the experimental tier.

Changes

  • rust/src/wire.rs: Add is_experimental_mode: Option<bool> (with skip_serializing_if = "Option::is_none") to SessionCreateWire and SessionResumeWire. Serializes as isExperimentalMode via the existing rename_all = "camelCase", omitted from the wire when None so older CLIs are unaffected.
  • rust/src/types.rs:
    • Add pub is_experimental_mode: Option<bool> to SessionConfig and ResumeSessionConfig with doc comments (resume doc notes it only re-resolves on the cold-load path).
    • Wire it through the manual Debug impls, Default/new constructors, and both into_wire mappings.
    • Add with_is_experimental_mode(bool) builders to both, mirroring with_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": false is present.
  • session_config_is_experimental_mode_omitted_when_none — asserts the key is absent.
  • resume_session_config_is_experimental_mode_serializes_when_set
  • resume_session_config_is_experimental_mode_omitted_when_none

Validation

cargo fmt, cargo clippy --all-targets, and cargo build are clean. Full lib test suite passes (151 passed; 0 failed), including the 4 new tests.

No schema codegen needed — this --server path is hand-written.

Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com

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>
@jmoseley jmoseley requested a review from a team as a code owner June 8, 2026 17:32
Copilot AI review requested due to automatic review settings June 8, 2026 17:32
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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> to SessionCreateWire and SessionResumeWire with skip_serializing_if = "Option::is_none".
  • Add is_experimental_mode: Option<bool> to SessionConfig and ResumeSessionConfig, wire it through defaults/debug/into_wire, and add with_is_experimental_mode(bool) builders.
  • Add unit tests asserting isExperimentalMode serializes when set and is omitted when None for 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 thread rust/src/types.rs
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 {
@stephentoub
Copy link
Copy Markdown
Collaborator

We will want to add this to all 6 SDKs, not just Rust.

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