Add max_output_tokens to ModelCapabilities limits - #2569
SteveSandersonMS merged 3 commits into
Conversation
The generated RPC schema ModelCapabilitiesOverrideLimits declares max_output_tokens, but the hand-written public ModelCapabilities type omits it. Because ModelCapabilitiesOverride is DeepPartial of ModelCapabilities, callers setting modelCapabilities.limits on a session config are rejected by the compiler for a field the protocol accepts. Signed-off-by: 1fanwang <1fannnw@gmail.com>
There was a problem hiding this comment.
🟢 Approval recommended
The focused type change resolves the schema mismatch with no unresolved issues.
Pull request overview
Aligns the public TypeScript model-capabilities type with the generated RPC schema.
Changes:
- Adds optional
max_output_tokenssupport to model capability limits.
File summaries
| File | Description |
|---|---|
nodejs/src/types.ts |
Exposes the existing wire-protocol output-token limit in the public type. |
Review details
- Files reviewed: 1/1 changed files
- Comments generated: 0
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
SteveSandersonMS
left a comment
There was a problem hiding this comment.
Confirmed: the generated RPC schema (ModelCapabilitiesOverrideLimits) already declares max_output_tokens, and this field is already present in the hand-written public wrapper types for Python, Rust, Java, Go, and .NET — Node's ModelCapabilities was the only one missing it. I reproduced the reported TS2561 compile error locally by reverting this change and confirmed the fix resolves it cleanly. Minimal, correctly-scoped, no further test/doc changes needed. Approving.
Summary
TypeScript callers cannot set an output token limit through the session config, even though the wire protocol accepts one. Setting a value fails to compile with TS2561, so the only way to reach the field is to cast away the type.
Problem
The generated RPC schema declares an optional output token limit on the model capabilities override. The hand-written public model capabilities type omits it. The session config override is a deep partial of that public type, so the compiler rejects the field for a value the protocol already accepts.
Solution
Add the optional field to the public limits type, next to the existing prompt token limit, so the public surface matches the generated schema.
Testing Done
Compiled a probe that sets the field on a session config against the base branch and this branch, and ran the repository typecheck gate.
Raw logs