Repository navigation
fix(model): replace inherited output limits on request overrides - #4564
Open
ningmao-hlyz wants to merge 1 commit into
Open
ningmao-hlyz wants to merge 1 commit into
ningmao-hlyz wants to merge 1 commit into
Conversation
maxTokens and maxCompletionTokens name the same output limit, but mergeOptions fell back per field. A request that set only one of them kept the other from the model defaults, so the merged options carried two limits and downstream budget estimation reserved the larger one as output. Treat the two fields as one override group: a request value in either field replaces both defaults, a request without either keeps both defaults, and an explicit pair is preserved as supplied.
ningmao-hlyz
force-pushed
the
fix/output-limit-override
branch
from
December 2, 2026 12:05
4038619 to
4d17a8b
Compare
This branch has not been deployed
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.
AgentScope-Java Version
2.1.0-SNAPSHOT, based on
mainat634fe8d7.Description
Fixes #4164.
maxTokensandmaxCompletionTokensname one output limit, butmergeOptionsfell back per field. A request that set onlymaxTokenskeptmaxCompletionTokensfrom the model defaults, and the reverse. Downstream that means:HarnessContextBuilder.inputLimitandJevRouteCatalogtakeMath.maxof the two, so the inherited default becomes the reserved output budget and the input budget loses that much room.OpenAIChatFormatter.applyMaxTokenswrites both non-null fields into the request, so which limit applies depends on the provider.The fix treats the two fields as one override group:
Provider-specific validation is untouched. The
Math.maxfolding inHarnessContextBuilderandJevRouteCatalogstays as it is, because when a caller does supply both limits, reserving the larger one is the conservative choice.The merge rules in the
mergeOptionsJavadoc now carry the output-limit entry.Validation on Windows with Java 17:
The targeted classes pass (51 tests).
agentscope-corein full: 3635 tests, 0 failures, 9 skipped. With the source change stashed, the two directional regressions fail (requestMaxTokensReplacesInheritedCompletionLimitandrequestCompletionLimitReplacesInheritedMaxTokens, bothexpected: <null> but was: <16000>), so the tests are not vacuous.Checklist
mvn spotless:applyagentscope-coreare passing (mvn test -pl agentscope-core)mergeOptionsJavadoc)