Skip to content

Commit a848749

Browse files
stephentoubCopilot
andcommitted
Fix CI failures for @github/copilot 1.0.32-1 update
- Add shared nullable-required schema normalization in codegen utils (converts required \ properties with null descriptions to anyOf pattern) - Add Python forward-reference topological sort in codegen - Update Go type alias for renamed PurpleModelCapabilitiesOverrideLimitsVision - Add Go type conversion helper for duplicate quicktype-generated types - Add Node.js model capabilities normalization (backfill supports/limits) - Regenerate all language bindings with fixes applied Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 37d6638 commit a848749

12 files changed

Lines changed: 2715 additions & 2441 deletions

File tree

dotnet/src/Generated/Rpc.cs

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

go/rpc/generated_rpc.go

Lines changed: 1 addition & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

go/session.go

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1213,7 +1213,7 @@ func (s *Session) SetModel(ctx context.Context, model string, opts *SetModelOpti
12131213
params := &rpc.ModelSwitchToRequest{ModelID: model}
12141214
if opts != nil {
12151215
params.ReasoningEffort = opts.ReasoningEffort
1216-
params.ModelCapabilities = opts.ModelCapabilities
1216+
params.ModelCapabilities = convertModelCapabilitiesToClass(opts.ModelCapabilities)
12171217
}
12181218
_, err := s.RPC.Model.SwitchTo(ctx, params)
12191219
if err != nil {
@@ -1223,7 +1223,33 @@ func (s *Session) SetModel(ctx context.Context, model string, opts *SetModelOpti
12231223
return nil
12241224
}
12251225

1226-
// LogOptions configures optional parameters for [Session.Log].
1226+
// convertModelCapabilitiesToClass converts from ModelCapabilitiesOverride
1227+
// (used in the public API) to ModelCapabilitiesClass (used internally by
1228+
// the ModelSwitchToRequest RPC). The two types are structurally identical
1229+
// but have different Go types due to code generation.
1230+
func convertModelCapabilitiesToClass(src *rpc.ModelCapabilitiesOverride) *rpc.ModelCapabilitiesClass {
1231+
if src == nil {
1232+
return nil
1233+
}
1234+
dst := &rpc.ModelCapabilitiesClass{
1235+
Supports: src.Supports,
1236+
}
1237+
if src.Limits != nil {
1238+
dst.Limits = &rpc.ModelCapabilitiesLimitsClass{
1239+
MaxContextWindowTokens: src.Limits.MaxContextWindowTokens,
1240+
MaxOutputTokens: src.Limits.MaxOutputTokens,
1241+
MaxPromptTokens: src.Limits.MaxPromptTokens,
1242+
}
1243+
if src.Limits.Vision != nil {
1244+
dst.Limits.Vision = &rpc.FluffyModelCapabilitiesOverrideLimitsVision{
1245+
MaxPromptImageSize: src.Limits.Vision.MaxPromptImageSize,
1246+
MaxPromptImages: src.Limits.Vision.MaxPromptImages,
1247+
SupportedMediaTypes: src.Limits.Vision.SupportedMediaTypes,
1248+
}
1249+
}
1250+
}
1251+
return dst
1252+
}
12271253
type LogOptions struct {
12281254
// Level sets the log severity. Valid values are [rpc.SessionLogLevelInfo] (default),
12291255
// [rpc.SessionLogLevelWarning], and [rpc.SessionLogLevelError].

go/types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -848,7 +848,7 @@ type (
848848
ModelCapabilitiesOverride = rpc.ModelCapabilitiesOverride
849849
ModelCapabilitiesOverrideSupports = rpc.ModelCapabilitiesOverrideSupports
850850
ModelCapabilitiesOverrideLimits = rpc.ModelCapabilitiesOverrideLimits
851-
ModelCapabilitiesOverrideLimitsVision = rpc.ModelCapabilitiesOverrideLimitsVision
851+
ModelCapabilitiesOverrideLimitsVision = rpc.PurpleModelCapabilitiesOverrideLimitsVision
852852
)
853853

854854
// ModelPolicy contains model policy state

nodejs/src/client.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1019,6 +1019,28 @@ export class CopilotClient {
10191019
const result = await this.connection.sendRequest("models.list", {});
10201020
const response = result as { models: ModelInfo[] };
10211021
models = response.models;
1022+
1023+
// Normalize model capabilities — some models (e.g. embedding models)
1024+
// may omit 'supports' or 'limits' in their capabilities.
1025+
for (const model of models) {
1026+
const caps = model.capabilities as Record<string, unknown> | undefined;
1027+
if (!caps) {
1028+
(model as Record<string, unknown>).capabilities = {
1029+
supports: {},
1030+
limits: { max_context_window_tokens: 0 },
1031+
};
1032+
} else {
1033+
if (!caps.supports) caps.supports = {};
1034+
if (!caps.limits) {
1035+
caps.limits = { max_context_window_tokens: 0 };
1036+
} else if (
1037+
(caps.limits as Record<string, unknown>).max_context_window_tokens ===
1038+
undefined
1039+
) {
1040+
(caps.limits as Record<string, unknown>).max_context_window_tokens = 0;
1041+
}
1042+
}
1043+
}
10221044
}
10231045

10241046
// Update cache before releasing lock (copy to prevent external mutation)

nodejs/src/generated/rpc.ts

Lines changed: 4 additions & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)