Repository navigation
Add configurable per-request LLM token and prompt-byte limits - #1026
Open
SajjadPSavoji wants to merge 1 commit into
Open
SajjadPSavoji wants to merge 1 commit into
SajjadPSavoji wants to merge 1 commit into
Conversation
Signed-off-by: Sajjad Pakdamansavoji <44399382+SajjadPSavoji@users.noreply.github.com>
SajjadPSavoji
force-pushed
the
fix-1003-allow-configurable-per-request
branch
from
November 5, 2026 21:23
e53a509 to
758e0c0
Compare
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.
Deployments with a gateway that rejects big requests had to patch the code to get a smaller per-request size. This adds three optional env vars:
SKILLSPECTOR_MAX_BATCH_INPUT_TOKENS,SKILLSPECTOR_MAX_PROMPT_BYTESandSKILLSPECTOR_TP4_MAX_BATCH_INPUT_TOKENS. Each one only lowers a limit, so the model budget and the CLI provider byte cap still win when they're smaller. Unset or blank keeps today's behavior and bad values log a warning without echoing the value.The byte cap goes through the existing chunking in
get_batchesand TP4's own chunk planner. Prompts are also checked right before sending in the sync and async paths. A line or fixed prompt that can't fit is markedSIZE_LIMITfor that batch, nothing is truncated and other batches keep running. README has a short section on units and precedence.Thanks @SajjadPSavoji for the suggested design in the thread.
Tests: new
TestConfigurableRequestLimitsintests/nodes/test_llm_analyzer_base.pyplus the TP4 token ceiling, byte ceiling andSIZE_LIMITpartial tests intests/test_mcp_tool_poisoning.py. They fail before the change and pass after. I also ran the rest oftest_llm_analyzer_base.py,test_mcp_tool_poisoning.py,test_meta_analyzer.pyandtest_meta_analyzer_fallback.py, andruff checkon the touched files.Fixes #1003