Add Rust model allowlist support on pinned SDK base - #2513
Open
jpbufe3 wants to merge 2 commits into
Open
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
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
New issues introduced by this change (1)
| Severity | Finding |
|---|---|
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_modelstoSessionConfigandResumeSessionConfig, including builders and wire conversion. - Add typed
session.model.setAllowedModelsRPC 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.
| @@ -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>
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.

Integrations pinned to SDK commit
c672e716473da0be4da7ad807df8d21259623640need 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
allowed_modelsfields and fluent builders toSessionConfigandResumeSessionConfig, serialized asallowedModelsand omitted when unrestricted.session.model.setAllowedModelsRPC request/result surface for replacing or clearing a running session's restriction.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_modelscargo +nightly-2026-04-14 fmt --check