Skip to content

feat(compression): make Lite tool-result truncation length configurable - #13915

Merged
diegosouzapw merged 4 commits into
cheaper-inference:release/v3.8.51from
HouMinXi:feat/lite-max-tool-length
Sep 17, 2026
Merged

diegosouzapw merged 4 commits into
cheaper-inference:release/v3.8.51from
HouMinXi:feat/lite-max-tool-length

Conversation

@HouMinXi

Copy link
Copy Markdown
Contributor

Summary

Lite truncated tool results at a hardcoded 2000 characters. File reads and crash dumps arriving as tool payloads lost the middle of the content, and there was no supported way to raise the cap.

This adds lite.maxToolLength next to the existing compressToolResults toggle. Resolution order:

  1. explicit option / step config / dashboard setting
  2. OMNIROUTE_LITE_MAX_TOOL_LENGTH
  3. 2000

Default stays 2000, so existing installs do not change. The truncation-allowlist idea stays a follow-up.

Related to #13178.
#13178 stays open.

Test plan

  • compressToolResults honors an explicit cap below 2000
  • a 1500-char payload is kept when the cap is 4000
  • OMNIROUTE_LITE_MAX_TOOL_LENGTH is read when no option is passed
  • an explicit option wins over the env fallback
  • settings round-trip maxToolLength
  • schema accepts an integer cap and rejects a string
  • Lite engine schema exposes maxToolLength (default 2000, min 256)
  • dashboard Save PUTs { compressToolResults, maxToolLength } when the operator set a cap
  • dashboard Save omits maxToolLength when settings never stored one, and when the number input is cleared
  • defect injection: hardcoding 2000 again fails the two new truncation tests; restoring the resolver passes

Lite truncated tool results at a hardcoded 2000 characters. Coding-agent
payloads (file reads, crash dumps) lost the middle of the content with no
supported way to raise the cap.

Honor lite.maxToolLength from settings, then OMNIROUTE_LITE_MAX_TOOL_LENGTH,
then 2000. Existing installs keep the old length.

Related to cheaper-inference#13178.

Signed-off-by: Minxi Hou <houminxi@gmail.com>
cheaper-inference#13178 stays open.
…complete

An out-of-range step maxToolLength was still a number, so it hid a valid
global cap and fell through to env. A toggle-only settings PUT replaced
the whole lite row and dropped the stored cap. Save treated an out-of-range
number like a cleared field. Reject the bad Save, merge omitted caps, and
use null to clear.

Related to cheaper-inference#13178.

Signed-off-by: Minxi Hou <houminxi@gmail.com>
@HouMinXi

Copy link
Copy Markdown
Contributor Author

Inline review of af4a921e90 found three real issues. They are fixed in 0e0d775964.

  1. A pipeline step with maxToolLength: 10 (or NaN / Infinity) is still a number, so it hid a valid global cap of 8000 and fell through to env. A 3000-character tool result was truncated at env 400 instead of kept. Only an in-range integer now overrides the global cap.

  2. PUT { lite: { compressToolResults: false } } replaced the whole lite JSON row, so a stored 8000 disappeared. Confirmed on a temp sqlite. Omit the key to keep the stored cap; send null to clear it.

  3. Save treated an out-of-range number (100) like a cleared field and omitted it, which also wiped the stored cap. Save now refuses and does not PUT.

Copy that still said "over 2,000 characters" is updated. Lite Preview still posts a user message, so it cannot show tool truncation. That is existing preview scope, not this change.

Tests: node 65/65, vitest 15/15. Injected the three defects at the call sites; each test failed, then passed after restore.

Related to #13178. #13178 stays open.

The page overlays schema descriptions from i18n. Updating only
LITE_SCHEMA left operators seeing "over 2,000 characters" after the
cap became configurable. Also assert the Save error string, not the
Save button.

Related to cheaper-inference#13178.

Signed-off-by: Minxi Hou <houminxi@gmail.com>
@HouMinXi

Copy link
Copy Markdown
Contributor Author

Follow-up on the last review of 0e0d775964.

The three runtime issues stayed fixed. Two leftovers were still real:

  1. The dashboard still said "over 2,000 characters". Schema copy had changed, but the page overlays src/i18n/messages when that key exists, so operators never saw the schema string. All 66 catalogs now point at the Maximum tool-result length field / env.

  2. The out-of-range Save test matched /save/i, which is the Save button. It now looks for "Failed to save configuration."

Lite Preview still posts a user message and does not send config.lite, so it cannot show tool truncation. That is existing preview scope.

Related to #13178. #13178 stays open.

@HouMinXi

Copy link
Copy Markdown
Contributor Author

Third look at 4caf3a40a6.

The runtime cap, the settings merge, the dashboard copy, and the out-of-range Save error all still match the earlier follow-ups. No new defects.

Lite Preview still posts a user message and does not send config.lite, so it cannot show tool truncation. Same as before; not this change.

Related to #13178. #13178 stays open.

@HouMinXi

Copy link
Copy Markdown
Contributor Author

Fourth look at 4caf3a40a6.

Same SHA as the third look. Runtime cap, settings merge, dashboard copy, and out-of-range Save still hold. No new defects.

Lite Preview still posts a user message and does not send config.lite. Same as before; not this change.

Related to #13178. #13178 stays open.

@HouMinXi

Copy link
Copy Markdown
Contributor Author

Fifth look at 4caf3a40a6.

Same SHA as the third and fourth looks. Runtime cap, settings merge, dashboard copy, and out-of-range Save still hold. No new defects.

Lite Preview still posts a user message and does not send config.lite. Same as before; not this change.

Related to #13178. #13178 stays open.

@diegosouzapw
diegosouzapw merged commit ec780ef into cheaper-inference:release/v3.8.51 Sep 17, 2026
6 of 7 checks passed
@HouMinXi
HouMinXi deleted the feat/lite-max-tool-length branch September 19, 2026 13:06
@diegosouzapw diegosouzapw mentioned this pull request Sep 21, 2026
muhamadgalihsaputra pushed a commit to niyatna/NiyatnaRoute that referenced this pull request Sep 27, 2026
…le (cheaper-inference#13915)

* feat(compression): make Lite tool-result truncation length configurable

Lite truncated tool results at a hardcoded 2000 characters. Coding-agent
payloads (file reads, crash dumps) lost the middle of the content with no
supported way to raise the cap.

Honor lite.maxToolLength from settings, then OMNIROUTE_LITE_MAX_TOOL_LENGTH,
then 2000. Existing installs keep the old length.

Related to cheaper-inference#13178.

Signed-off-by: Minxi Hou <houminxi@gmail.com>
cheaper-inference#13178 stays open.

* compression/lite: keep a stored cap when a step or toggle write is incomplete

An out-of-range step maxToolLength was still a number, so it hid a valid
global cap and fell through to env. A toggle-only settings PUT replaced
the whole lite row and dropped the stored cap. Save treated an out-of-range
number like a cleared field. Reject the bad Save, merge omitted caps, and
use null to clear.

Related to cheaper-inference#13178.

Signed-off-by: Minxi Hou <houminxi@gmail.com>

* compression/lite: stop dashboard copy from hard-coding a 2000-char cap

The page overlays schema descriptions from i18n. Updating only
LITE_SCHEMA left operators seeing "over 2,000 characters" after the
cap became configurable. Also assert the Save error string, not the
Save button.

Related to cheaper-inference#13178.

Signed-off-by: Minxi Hou <houminxi@gmail.com>

* chore(changelog): move cheaper-inference#13915 entry to a changelog.d fragment

---------

Signed-off-by: Minxi Hou <houminxi@gmail.com>
Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants