Bound the size and duration of a chat request - #4
Merged
Conversation
`chat_max_concurrency` caps how many generations run at once and says nothing about how large or how long any one of them is. Four callers could hold every slot for the full Ollama timeout with a prompt the size of a book, and the service would look healthy the whole time. - The message is capped at 4000 characters (413 over it) and a blank one is rejected outright rather than sent to the model. - History is trimmed to the most recent 20 turns and 16000 characters rather than rejected: dropping the oldest turns costs a little context, while a 413 in the middle of a conversation ends it. History matters more than the message here -- every turn is re-sent to the model and paid for again on the next request. - The page context is truncated to 200 characters. It is a route, not a payload. - A generation gets a 180s deadline independent of the model's own timeout. One that will not stop still ends, because the slot it holds is one of only four. Defaults are settings, so an operator who wants a longer conversation can have one. Documented alongside the chat token, whose empty default leaves the endpoint open -- the chart now always sets it.
krlex
force-pushed
the
fix/assistant-request-limits
branch
from
August 19, 2026 21:17
de0afc7 to
93c7671
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.
Closes the application half of M3 from the 2026-08-19 Codex review. The chart
half — always setting a bearer token — is forail-helm#7.
chat_max_concurrencycaps how many generations run at once and says nothingabout how large or how long any one of them is. Four callers could hold every
slot for the full Ollama timeout with a prompt the size of a book, and the
service would report healthy throughout.
rather than sent to the model.
than rejected — dropping the oldest turns costs a little context, while a 413
mid-conversation ends it. History matters more than the message: every turn is
re-sent to the model and paid for again on the next request.
timeout. A generation that will not stop still ends, because the slot it holds
is one of only four.
All four are settings, so an operator who wants longer conversations can have
them. Documented alongside
FORAIL_ASSISTANT_CHAT_TOKEN, whose empty defaultleaves the endpoint open — worth saying plainly, since that default is what made
the chart's omission a problem.
Verified
38 tests pass (31 before). The new ones cover each bound, including that an
endless generation is cut rather than drained — the generator does not run to
completion.