Add typed context tier support#1503
Merged
Merged
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds typed context tier support for the C# and Go SDK surfaces while preserving the existing JSON wire values used by the Copilot CLI.
Changes:
- Adds a C#
ContextTierstring-enum wrapper and uses it in session create/resume configuration and internal request DTOs. - Adds a Go
ContextTiernamed string type with known constants and wires it through public configs and internal request payloads. - Updates C# clone/serialization tests and Go request serialization tests to use the new typed constants.
Show a summary per file
| File | Description |
|---|---|
dotnet/src/Types.cs |
Defines the C# ContextTier wrapper and updates session config typing/docs. |
dotnet/src/Client.cs |
Updates internal create/resume request records to carry ContextTier?. |
dotnet/test/Unit/SerializationTests.cs |
Verifies C# request JSON serialization for context tier values. |
dotnet/test/Unit/CloneTests.cs |
Updates clone tests to use the typed C# context tier value. |
go/types.go |
Defines the Go ContextTier type/constants and applies them to config/request structs. |
go/client_test.go |
Updates Go serialization tests to use the new context tier constants. |
Copilot's findings
- Files reviewed: 6/6 changed files
- Comments generated: 0
Contributor
Cross-SDK Consistency Review ✅This PR maintains cross-SDK consistency well. Here's a summary across all SDKs:
The approach taken for Go and .NET mirrors the existing patterns in those languages (Go named string type with constants, .NET string-enum struct wrapper), which is consistent with how
|
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.
Context tier is a small string-enum surface, but the C# SDK exposed it as
string?while similar values use typed string-enum wrappers. This adds a typed C# surface and aligns Go with its named string type convention without changing the JSON wire values.Summary
ContextTierstruct withDefaultandLongContextwell-known values and JSON conversion.ContextTier?, with clone and serialization coverage.ContextTiernamed string type with constants and use it in public config and internal session request payloads.Notes
Node and Python already expose
ContextTierliteral aliases. Rust and Java keep raw-string config surfaces for forward-compatible arbitrary values, so this PR leaves those unchanged.Testing
dotnet test dotnet\test\GitHub.Copilot.SDK.Test.csproj --no-restore --filter "SessionRequests_CanSerializeContextTier|ResumeSessionConfig_Clone_CopiesContextTier|SessionConfig_Clone_CopiesAllProperties"Push-Location go; go test -count=1 . ./rpc; Pop-Locationgo test ./...was attempted but Go E2E packages require local CLI setup fromnodejsfirst.