fix(auxiliary): stop capping output with max_tokens by default (#34530) - #34845
Merged
Merged
Conversation
🔎 Lint report:
|
added 2 commits
May 29, 2026 13:38
Auxiliary LLM calls (compression, titles, vision, etc.) no longer send max_tokens on the OpenAI-compatible chat-completions path. Most providers treat an omitted max_tokens as "use the model max", which is what we want; an explicit cap only risks truncation or a wire-format 400. This was surfaced by GitHub Copilot / GPT-5 (#34530): those models reject max_tokens and require max_completion_tokens, so compression 400'd and fell back to a static context marker. Omitting the param sidesteps that quirk (and ZAI vision's error 1210) entirely. The Anthropic Messages wire (MiniMax + /anthropic endpoints) keeps max_tokens because it is a mandatory field there.
…tokens The temperature-retry tests asserted retry_kwargs["max_tokens"] == 500 on an api.openai.com endpoint. Now that auxiliary calls omit max_tokens on OpenAI-compatible endpoints (#34530), that key is absent. Assert it's absent in both first and retry kwargs and use model as the survives-the-retry witness.
ghost
force-pushed
the
hermes/hermes-73915d12
branch
from
May 29, 2026 20:38
fd90d42 to
6ae3a7a
Compare
ghost
deleted the
hermes/hermes-73915d12
branch
May 30, 2026 00:24
This was referenced May 30, 2026
This was referenced Jul 23, 2026
This was referenced Jul 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Auxiliary LLM calls no longer cap output with
max_tokensby default — they let the model max out its own output, which is the behavior we want for compression summaries, titles, vision, etc.Closes #34530. Root cause:
_build_call_kwargssentmax_tokenson the OpenAI-compatible path, but GitHub Copilot / GPT-5 models reject it (requiremax_completion_tokens). Compression 400'd and fell back to a static context marker. Rather than translate the param name per-provider, we just stop sending it.Changes
agent/auxiliary_client.py:_build_call_kwargsomitsmax_tokensfor all OpenAI-compatible chat-completions providers (Copilot, OpenAI, OpenRouter, Nous, local, ZAI). The Anthropic Messages wire (MiniMax + any/anthropicendpoint) keeps it —max_tokensis a mandatory field there. This collapses the old host-sniffing + ZAI-vision-skip branches into one Anthropic-compat check.tests/agent/test_auxiliary_client.py: newTestBuildCallKwargsMaxTokens— 9 cases asserting omit-by-default for OpenAI-family, keep-it for the Anthropic wire.Validation
max_tokens→ 400max_completion_tokensmax_tokens/anthropicmax_tokensmax_tokens(unchanged — mandatory)E2E with real imports across 8 endpoints +
test_auxiliary_client.pyandtest_context_compressor.py: 279/279 pass.Infographic