Expose context tier in SDK set model APIs#1507
Conversation
Auto-committed by java-codegen-check workflow.
| var generatedContextTier = contextTier == null ? null : ContextTier.fromValue(contextTier); | ||
| return getRpc().model.switchTo(new SessionModelSwitchToParams(sessionId, model, reasoningEffort, | ||
| generatedReasoningSummary, generatedCapabilities)).thenApply(r -> null); | ||
| generatedReasoningSummary, generatedCapabilities, generatedContextTier)).thenApply(r -> null); |
Cross-SDK Consistency Review ✅This PR maintains strong feature parity across all six SDK implementations. Coverage: Node.js, Python, Go, .NET, Java, and Rust all receive Consistency observations:
The Java SDK's use of Type consolidation: The PR also cleans up duplicate enum types (e.g., No cross-SDK consistency issues found.
|
There was a problem hiding this comment.
Pull request overview
This PR standardizes and exposes a shared ContextTier type across SDK surfaces and wires it through setModel / set_model / SetModelAsync APIs so model switches can pin the session to a specific context-window tier (e.g. long_context).
Changes:
- Introduces/renames the shared
ContextTiertype in generated RPC types (replacing request/result-specific context-tier types). - Adds
contextTier/context_tiersupport to model-switch APIs across Rust, Python, Node.js, Java, Go, and .NET and forwards it intosession.model.switchTo. - Updates/extends per-language tests to assert correct serialization/forwarding of
contextTieron model switches.
Show a summary per file
| File | Description |
|---|---|
| rust/tests/session_test.rs | Extends Rust integration test to assert contextTier is sent on session.model.switchTo. |
| rust/src/wire.rs | Uses typed ContextTier in session create/resume wire payloads. |
| rust/src/types.rs | Re-exports ContextTier, updates configs to use it, and adds SetModelOptions.context_tier + builder. |
| rust/src/session.rs | Forwards SetModelOptions.context_tier into ModelSwitchToRequest. |
| rust/src/generated/api_types.rs | Unifies context-tier enums into ContextTier and updates request/result fields accordingly. |
| python/test_client.py | Adds assertion that contextTier is included in captured session.model.switchTo params. |
| python/copilot/session.py | Adds context_tier parameter to set_model and maps it into the generated RPC request. |
| python/copilot/generated/rpc.py | Introduces ContextTier enum and updates CurrentModel / ModelSwitchToRequest to use it (with alias for compatibility). |
| nodejs/test/client.test.ts | Extends Node client test to verify contextTier is passed to session.model.switchTo. |
| nodejs/src/types.ts | Re-exports generated ContextTier type and removes the local duplicate type definition. |
| nodejs/src/session.ts | Adds contextTier to setModel options and forwards it via spread into switchTo. |
| nodejs/src/generated/rpc.ts | Renames/unifies context-tier types to ContextTier and updates request typing. |
| java/src/test/java/com/github/copilot/RpcWrappersTest.java | Updates wrapper test to include and assert contextTier serialization for switchTo. |
| java/src/test/java/com/github/copilot/generated/rpc/GeneratedRpcRecordsCoverageTest.java | Updates generated-record coverage tests for new ContextTier field/ctor params. |
| java/src/main/java/com/github/copilot/CopilotSession.java | Adds setModel overload that accepts contextTier (string) and forwards it via generated ContextTier. |
| java/src/generated/java/com/github/copilot/generated/rpc/ContextTier.java | Adds generated ContextTier enum definition. |
| go/types.go | Aliases public ContextTier to generated rpc.ContextTier and maps exported constants. |
| go/session.go | Adds SetModelOptions.ContextTier and forwards it into the SwitchTo request. |
| go/rpc/zrpc.go | Unifies generated context-tier types into ContextTier and updates request/result structs. |
| dotnet/test/Unit/SerializationTests.cs | Adds a serialization test ensuring contextTier is emitted for ModelSwitchToRequest. |
| dotnet/src/Types.cs | Adds public SetModelOptions (including ContextTier) and registers it for source-gen serialization. |
| dotnet/src/Session.cs | Adds SetModelAsync(string, SetModelOptions, ...) and routes existing overloads through it to forward ContextTier. |
| dotnet/src/Generated/Rpc.cs | Updates generated RPC types/methods to use ContextTier for current model + switchTo requests. |
Copilot's findings
Files not reviewed (1)
- go/rpc/zrpc.go: Language not supported
- Files reviewed: 16/23 changed files
- Comments generated: 0
Java Codegen Fix Agent ReportThe Root CauseThe failure is not a code generation or handwritten code issue. The error is: This is a CI configuration mismatch:
Current State
Required Fix (Manual Intervention)Update - uses: actions/setup-java@...
if: steps.push-regen.outcome == 'success'
with:
java-version: "25" # was "17"
distribution: "microsoft"
cache: "maven"This will align the Note: The Warning Firewall blocked 5 domainsThe following domains were blocked by the firewall during workflow execution:
network:
allowed:
- defaults
- "jcenter.bintray.com"
- "jfrog.io"
- "repo.maven.apache.org"
- "repo1.maven.org"
- "search.maven.org"See Network Configuration for more information.
|
Summary
Testing