Add Rust model allowlist support on pinned SDK base - #2513
Conversation
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)
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")] | |||
|
Thanks for the contribution! I looked into this and found Could you clarify the plan for landing this in the runtime first? Once the runtime actually implements I'm moving this to draft for tracking — please mark it ready for review once the runtime side has landed. |
Embed the full Copilot CLI separately from the managed runtime bundle so explicit callers receive the Node SEA while normal SDK resolution continues to use copilot-runtime. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
1b83eac to
67519be
Compare


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