fix(copilot): pass two-slash custom-model ids through unchanged
Copilot enterprise custom models (BYOK) expose catalog ids shaped owner/sub/model. normalize_copilot_model_id() only tried the full id and the id minus its FIRST segment, and returned the stripped form when neither matched the (unreachable) catalog - corrupting those ids into sub/model, which the CLI's second normalization pass then stripped again to model. The Copilot API answered HTTP 400 model_not_supported on every call. Only accept the strip guess when the remainder is itself a flat id: a result that still contains "/" cannot be a Copilot id. Fixes #110597
This commit is contained in:
@@ -2051,7 +2051,12 @@ def normalize_copilot_model_id(
|
||||
return candidate
|
||||
|
||||
if "/" in raw:
|
||||
return raw.split("/", 1)[1].strip()
|
||||
stripped = raw.split("/", 1)[1].strip()
|
||||
# Enterprise BYOK custom models expose ``owner/sub/model`` ids (two
|
||||
# slashes). A strip guess that still contains "/" cannot be a Copilot
|
||||
# id, so pass the input through untouched instead of corrupting it.
|
||||
if stripped and "/" not in stripped:
|
||||
return stripped
|
||||
return raw
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user