Repository navigation
fix(laya-ts): forward maxLen / headMaxLen through Router.predict - #1338
Merged
NandhaKishorM merged 1 commit intoOct 24, 2026
Merged
Conversation
PredictOptions documents per-call token-budget overrides and Agent.systemOne honours them, but Router.predict never read them: the PredictContext was built without maxLen/headMaxLen and agentOpts carried only lang and minConfidence. So the documented per-call budget -- and the documented "a start hook may also set them" -- did nothing on the primary entry point, while Agent.predict honoured both; a caller raising the window on a long state got the checkpoint default and the truncation they were trying to avoid, and decide(router, ...) inherited that silently. The options now seed the context (so a start hook can read and rewrite them, exactly as it can states/questions) and the values left on the context are forwarded to the agent, which is what Python's Router.predict does with ctx.max_len / ctx.head_max_len. Nothing is passed when neither is set, so the agent's own configured budget still applies.
NandhaKishorM
added a commit
that referenced
this pull request
Oct 24, 2026
33 PRs. Server hardening (#1331, #1332, #1333), TypeScript parity (#1330, #1336, #1337, #1338, #1339, #1340, #1341, #1342, #1343), fail-closed input handling in evals and the integrations (#1317, #1318, #1319, #1320, #1321, #1322, #1326, #1335), exact and faster script detection (#1334, #1349), JVM and .NET resource handling (#1327, #1328, #1329, #1346), port goldens and clipping (#1324 excluded, #1325, #1344, #1345), CI (#1323, #1347, #1348). Verified before tagging: all 92 suites pass, 610 tests. ruff clean on both lists. laya-ts 1247 tests across 44 files, tsc --noEmit clean. Version agrees across pyproject.toml, laya.__version__ and nix/package.nix. README carries 0.4.15 only. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
4 tasks done
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.
What
The per-call token-budget options seed the
PredictContext(so a start hook can read and rewrite them) and the values left there are forwarded to the agent, as Python'sRouter.predictdoes withctx.max_len/ctx.head_max_len.Why
PredictOptionsdocuments per-call budget overrides andAgent.systemOnehonours them, butRouter.predictnever read them --agentOptscarried onlylangandminConfidence-- so the documented per-call budget, and the documented "a start hook may also set them", did nothing on the primary entry point. A caller raising the window on a long state got the checkpoint default and the truncation they were trying to avoid;decide(router, ...)inherited it silently.How it was verified
Checklist
main(branch cut fromupstream/mainat 0.4.14)