Skip to content

Internalize env_value_mode (cross-SDK parity)#1215

Merged
stephentoub merged 2 commits intomainfrom
tclem/tclem-parity-cleanup-disabled-mcp-and-en
May 6, 2026
Merged

Internalize env_value_mode (cross-SDK parity)#1215
stephentoub merged 2 commits intomainfrom
tclem/tclem-parity-cleanup-disabled-mcp-and-en

Conversation

@tclem
Copy link
Copy Markdown
Member

@tclem tclem commented May 6, 2026

Follow-up to #1212. Internalizes the last Rust-only knob on SessionConfig / ResumeSessionConfig that hadn't already been cleaned up by the cross-SDK surface audit.

What changes

env_value_mode was a pub Option<String> on both configs, exposed via a with_env_value_mode builder. All four other SDKs unconditionally send envValueMode: "direct" on every session.create and session.resume and never expose it as a knob:

  • Node nodejs/src/client.ts:813, :959
  • Python python/copilot/client.py:1431, :1740
  • Go go/client.go:636, :826
  • .NET dotnet/src/Client.cs:578, :707

Now Rust matches: the field is pub(crate) String on both configs with #[serde(default = "default_env_value_mode", skip_deserializing)], so serde always emits "direct" on the wire and any inbound JSON value is forced back to "direct" on round-trip. The public with_env_value_mode builder is gone.

Other touch-ups

  • Simplified the McpStdioServerConfig::env doc, which used to describe "direct" vs "indirect" interpretation — now stale since consumers can no longer flip the mode.
  • Wire-shape test env_value_mode_hardcoded_direct_on_create_and_resume in rust/tests/session_test.rs covering both session.create and session.resume (including the resume-side session.skills.reload follow-up).

Validation

cargo +1.94.0 test --all-features
cargo +nightly-2026-04-14 fmt --all -- --config-path .rustfmt.nightly.toml --check
cargo clippy --all-features --all-targets -- -D warnings
RUSTDOCFLAGS="-D warnings" cargo doc --no-deps --all-features

All green.

Release impact

Doesn't touch rust/Cargo.toml, rust/Cargo.lock, or rust/release-plz.toml, so rust-publish-release.yml won't fire on merge. release-plz will pick this up as a breaking change on the next manual rust-release-pr.yml run, alongside the other 0.1.0 follow-ups in #1212.

…arity)

Two Rust-only items on SessionConfig + ResumeSessionConfig that aren't
present in the Node, Python, Go, or .NET SDKs and shouldn't be on the
public Rust surface either.

disabled_mcp_servers: removed entirely. The field was schema-undocumented
(not in api.schema.json's SessionCreateRequest) and silently ignored by
the runtime on session.create. Runtime MCP server disablement lives in
the typed RPC namespace already (session.rpc().mcp().disable() and
session.rpc().mcp().config().disable()).

env_value_mode: internalized. Hardcode envValueMode: "direct" on every
session.create / session.resume payload, matching Node and Go's wire
behaviour. Subprocess MCP server env values pass through to the child
literally; consumers don't have a meaningful choice at the SDK boundary.

Also fix the README's Session cheat-sheet, which advertised several
methods (get_model, get_mode/set_mode, list_workspace_files /
read_workspace_file, read_plan / update_plan, start_fleet) as if they
existed on Session directly. They don't — replace those snippets with
the typed session.rpc().*() namespace they actually use.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 6, 2026 18:14
@tclem tclem requested a review from a team as a code owner May 6, 2026 18:14
@stephentoub
Copy link
Copy Markdown
Collaborator

#1212 already covers most of this and a bit more. Could we merge that and just trim this back to env_value_mode, which I neglected in that other PR?

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

This PR brings the Rust SDK’s SessionConfig/ResumeSessionConfig back into parity with the other language SDKs by removing two Rust-only public knobs that aren’t part of the shared wire schema and/or aren’t supported as public API elsewhere.

Changes:

  • Removed disabled_mcp_servers from Rust session configs/builders/tests (runtime disablement remains via typed MCP RPC APIs).
  • Internalized env_value_mode and hardcoded envValueMode: "direct" on session.create and session.resume, matching Node/Python/Go/.NET behavior.
  • Updated Rust README examples to use the typed session.rpc().* namespace where direct Session helpers do not exist; updated changelog entries accordingly.
Show a summary per file
File Description
rust/src/types.rs Removes disabled_mcp_servers, internalizes env_value_mode, and ensures "direct" is always serialized on the wire for create/resume.
rust/tests/session_test.rs Adds an integration test asserting envValueMode: "direct" is sent for both session.create and session.resume (including the resume session.skills.reload follow-up).
rust/README.md Fixes the Session “cheat-sheet” snippets to use the typed RPC namespace for APIs that aren’t direct Session methods.
rust/CHANGELOG.md Documents the removals under [Unreleased] and rolls the previous unreleased content into [0.1.0] - 2026-05-06.

Copilot's findings

  • Files reviewed: 4/4 changed files
  • Comments generated: 0

@tclem
Copy link
Copy Markdown
Member Author

tclem commented May 6, 2026

#1212 already covers most of this and a bit more. Could we merge that and just trim this back to env_value_mode, which I neglected in that other PR?

Yes, that's fine. Go ahead and merge that and this one can sync up if there is anything left to do.

@stephentoub
Copy link
Copy Markdown
Collaborator

and this one can sync up if there is anything left to do.

I think it'll just be the env_value_mode, which I missed in the other one. Thanks for following up on that.

…eanup-disabled-mcp-and-en

# Conflicts:
#	rust/README.md
@tclem tclem changed the title Remove disabled_mcp_servers + internalize env_value_mode (cross-SDK parity) Internalize env_value_mode (cross-SDK parity) May 6, 2026
@tclem
Copy link
Copy Markdown
Member Author

tclem commented May 6, 2026

OK @stephentoub - down to just env_value_mode changes now. I'll let you approve/merge.

@stephentoub stephentoub added this pull request to the merge queue May 6, 2026
Merged via the queue into main with commit 23b1bb8 May 6, 2026
22 checks passed
@stephentoub stephentoub deleted the tclem/tclem-parity-cleanup-disabled-mcp-and-en branch May 6, 2026 19:18
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