You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Python ModelLimits drops max_output_tokens from model metadata #2798
The generated RPC schema includes max_output_tokens in ModelCapabilitiesLimits, but the public Python ModelLimits type does not. CopilotClient.list_models() deserializes model limits through ModelLimits.from_dict(), so the value is discarded.
This follows the same schema/public-type parity principle addressed for TypeScript in #2569, although this issue affects the Python model-list response path rather than the session override path.
Investigated python/copilot/client.py (ModelLimits, ~line 1009) and the generated python/copilot/generated/rpc.py (ModelCapabilitiesLimits, ~line 23547).
Finding: this is a genuine bug. The generated ModelCapabilitiesLimits includes max_output_tokens, and the Python ModelLimits dataclass already exposes max_prompt_tokens, max_context_window_tokens and vision. However, it has no max_output_tokens field, and neither from_dict() nor to_dict() handles it. As a result, list_models() silently drops the value. Related types such as ModelLimitsOverride in session.py do carry it, so this is a parity gap and not intentional.
Fix: add max_output_tokens: int | None = None to ModelLimits, and read and write it in from_dict() and to_dict(). Also add a unit test covering the reproduction from the issue.
Labeled as bug.
Generated by Bug Handler for #2798 · copilot · auto · 16.9 AIC · ⌖ 6.35 AIC · ⊞ 7.3K · ◷
Activity
github-actions commentedon Sep 30, 2026
Investigated
python/copilot/client.py(ModelLimits, ~line 1009) and the generatedpython/copilot/generated/rpc.py(ModelCapabilitiesLimits, ~line 23547).Finding: this is a genuine bug. The generated
ModelCapabilitiesLimitsincludesmax_output_tokens, and the PythonModelLimitsdataclass already exposesmax_prompt_tokens,max_context_window_tokensandvision. However, it has nomax_output_tokensfield, and neitherfrom_dict()norto_dict()handles it. As a result,list_models()silently drops the value. Related types such asModelLimitsOverrideinsession.pydo carry it, so this is a parity gap and not intentional.Fix: add
max_output_tokens: int | None = NonetoModelLimits, and read and write it infrom_dict()andto_dict(). Also add a unit test covering the reproduction from the issue.Labeled as
bug.