mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-08-20 06:02:14 +03:00
* fix(chatcore): use combo-resolved context limit in enforceOutputTokenBudget Line 1801 called getTokenLimit() directly, ignoring the contextLimit variable that was already resolved with combo overrides (e.g. user-set 201320 for nvidia/z-ai/glm-5.2). This caused enforceOutputTokenBudget to use the fallback 128K default, capping max_tokens to near-zero and silently truncating responses. Fix: use the existing contextLimit variable instead of re-resolving. * fix(chatcore): hoist combo-resolved contextLimit so the output-token budget honors it contextLimit (including the combo override from resolveComboContextLimit()) was declared inside the proactive-compression `if` block and never survived to the final enforceOutputTokenBudget() call further down in handleChatCore(), which referenced an out-of-scope `contextLimit` — a ReferenceError on every request. Hoist the declaration to function scope so the combo-resolved context limit is what the output-token budget actually enforces. Adds a regression test that drives handleChatCore() end-to-end with a combo whose resolved context limit differs from the plain per-target getTokenLimit() lookup, since output-token-budget.test.ts only exercises enforceOutputTokenBudget() directly and cannot catch this class of bug. Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com> --------- Co-authored-by: TonPro <hello@tonpro.fu> Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com> Co-authored-by: Diego Rodrigues de Sa e Souza <diegosouza.pw@gmail.com>