test(config): cover maxTokens clamping

This commit is contained in:
George Pickett
2026-02-08 14:04:58 -08:00
parent eed580d310
commit 92764a60d6
2 changed files with 19 additions and 1 deletions
-1
View File
@@ -215,7 +215,6 @@ export function applyModelDefaults(cfg: OpenClawConfig): OpenClawConfig {
}
const defaultMaxTokens = Math.min(DEFAULT_MODEL_MAX_TOKENS, contextWindow);
// Clamp maxTokens to contextWindow to prevent invalid configurations
const rawMaxTokens = isPositiveNumber(raw.maxTokens) ? raw.maxTokens : defaultMaxTokens;
const maxTokens = Math.min(rawMaxTokens, contextWindow);
if (raw.maxTokens !== maxTokens) {