Skip to content

Add Rust model allowlist support on pinned SDK base - #2513

Open
jpbufe3 wants to merge 2 commits into
github:mainfrom
jpbufe3:jobufe-microsoft-pinned-sdk-model-allowlist
Open

Add Rust model allowlist support on pinned SDK base#2513
jpbufe3 wants to merge 2 commits into
github:mainfrom
jpbufe3:jobufe-microsoft-pinned-sdk-model-allowlist

Conversation

@jpbufe3

@jpbufe3 jpbufe3 commented Sep 4, 2026

Copy link
Copy Markdown

Integrations pinned to SDK commit c672e716473da0be4da7ad807df8d21259623640 need the Rust model allowlist contract without pulling in later unrelated SDK changes. This compatibility PR ports only that surface onto the exact pinned base.

Summary

  • Add optional allowed_models fields and fluent builders to SessionConfig and ResumeSessionConfig, serialized as allowedModels and omitted when unrestricted.
  • Add the generated typed session.model.setAllowedModels RPC request/result surface for replacing or clearing a running session's restriction.
  • Cover defaults, Debug output, create/resume wire conversion, request serialization, method routing, session ID injection, and typed result deserialization.

The SDK preserves exact caller-provided IDs; the runtime remains responsible for validation, policy intersection, fallback selection, and enforcement across child, sub-agent, Auto, and remote execution paths.

Testing

  • COPILOT_SKIP_CLI_DOWNLOAD=1 cargo test --all-features allowed_models
  • cargo +nightly-2026-04-14 fmt --check

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings September 4, 2026 01:56
@jpbufe3
jpbufe3 requested a review from a team as a code owner September 4, 2026 01:56

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Copilot review overview

Review tier: Lite
Findings: 1 Low severity

New issues introduced by this change (1)
Severity Finding
Low severity rust/​src/​wire.rs — The PR contract depends on this field serializing as allowedModels. This currently relies on any…
What changed in this PR

Ports the Rust “model allowlist” contract onto an SDK base pinned to a specific commit, adding config fields and an RPC method to set/clear allowed model IDs without pulling additional SDK changes.

Changes:

  • Add allowed_models to SessionConfig and ResumeSessionConfig, including builders and wire conversion.
  • Add typed session.model.setAllowedModels RPC method plus request/result types and method constant.
  • Add unit/integration tests covering serialization, wire conversion, routing, and result deserialization.
File Description
rust/​src/​types.rs Adds allowed_models fields/builders and wires them into create/resume payloads; adds unit tests.
rust/​src/​wire.rs Adds allowed_models to create/resume wire structs for JSON serialization.
rust/​src/​generated/​api_types.rs Introduces RPC method constant and request/result types for setAllowedModels.
rust/​src/​generated/​rpc.rs Adds the session.model.setAllowedModels RPC call surface with sessionId injection.
rust/​tests/​session_test.rs Adds integration tests for request/response serialization and RPC dispatch.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread rust/src/wire.rs Outdated
@@ -53,6 +53,8 @@ pub(crate) struct SessionCreateWire {
#[serde(skip_serializing_if = "Option::is_none")]
pub model: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
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.

2 participants