Internalize env_value_mode (cross-SDK parity)#1215
Conversation
…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>
|
#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? |
There was a problem hiding this comment.
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_serversfrom Rust session configs/builders/tests (runtime disablement remains via typed MCP RPC APIs). - Internalized
env_value_modeand hardcodedenvValueMode: "direct"onsession.createandsession.resume, matching Node/Python/Go/.NET behavior. - Updated Rust README examples to use the typed
session.rpc().*namespace where directSessionhelpers 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
Yes, that's fine. Go ahead and merge that 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
disabled_mcp_servers + internalize env_value_mode (cross-SDK parity)|
OK @stephentoub - down to just |
Follow-up to #1212. Internalizes the last Rust-only knob on
SessionConfig/ResumeSessionConfigthat hadn't already been cleaned up by the cross-SDK surface audit.What changes
env_value_modewas apub Option<String>on both configs, exposed via awith_env_value_modebuilder. All four other SDKs unconditionally sendenvValueMode: "direct"on everysession.createandsession.resumeand never expose it as a knob:nodejs/src/client.ts:813,:959python/copilot/client.py:1431,:1740go/client.go:636,:826dotnet/src/Client.cs:578,:707Now Rust matches: the field is
pub(crate) Stringon 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 publicwith_env_value_modebuilder is gone.Other touch-ups
McpStdioServerConfig::envdoc, which used to describe"direct"vs"indirect"interpretation — now stale since consumers can no longer flip the mode.env_value_mode_hardcoded_direct_on_create_and_resumeinrust/tests/session_test.rscovering bothsession.createandsession.resume(including the resume-sidesession.skills.reloadfollow-up).Validation
All green.
Release impact
Doesn't touch
rust/Cargo.toml,rust/Cargo.lock, orrust/release-plz.toml, sorust-publish-release.ymlwon't fire on merge. release-plz will pick this up as a breaking change on the next manualrust-release-pr.ymlrun, alongside the other 0.1.0 follow-ups in #1212.