Repository navigation
Conversation
zikajk
approved these changes
Oct 20, 2026
zikajk
left a comment
Member
There was a problem hiding this comment.
Looks good!
Please, do the rebase and feel free to merge.
netlogics
force-pushed
the
fix/llama-server-context-overflow-pattern
branch
from
October 20, 2026 17:57
633f62c to
a7eed1d
Compare
llama-server rejects over-long prompts with a 400 saying the request "exceeds the available context size". The catch-all in context-overflow-patterns only accepted max/maximum/model after "exceeds the", so the error classified as :unknown and auto-recovery (prune, auto-compact, retry) never ran. - add "available" to the catch-all's alternation - also match the error's type field, "exceed_context_size_error", so detection keeps working if llama.cpp rewords the message The catch-all keeps its existing shape. A looser "exceed ... token" pattern would also match unrelated text such as Azure's "exceeded token rate limit" message; a test guards against loosening it. 🤖 Generated with [Claude Code](https://claude.com/claude-code) (anthropic/claude-opus-5-5) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
netlogics
force-pushed
the
fix/llama-server-context-overflow-pattern
branch
from
October 20, 2026 18:15
a7eed1d to
f46c659
Compare
Contributor
Author
Thanks for the review and approval @zikajk . I only have read access so I can't merge it myself. I reviewed the dev docs but apologies if I missed something. |
Member
|
Sorry, my bad @netlogics. Merged 🙂 |
Contributor
Author
|
Thanks |
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.
Recognize llama-server's context-overflow error
Summary
Auto compaction isn't triggered when a llama.cpp model's context window is exceeded.
Problem
When a provider rejects a prompt that exceeds the model's context window, ECA classifies the error with
eca.llm-providers.errors/classify-errorand, on:context-overflow, runs the automatic recovery path (prune-tool-results!auto-compact retry), as described indocs/config/context-management.md.If no pattern matches, the error falls through to
:unknown, so recovery never runs and the raw 400 is shown to the user instead.llama.cpp's
llama-serverphrases the rejection as:{"error":{"code":400,"message":"request (68183 tokens) exceeds the available context size (65536 tokens), try increasing it","type":"exceed_context_size_error","n_prompt_tokens":68183,"n_ctx":65536}}The existing catch-all regex requires
max/maximum/modelright afterexceeds the, soavailabledoesn't match. Every llama-server wording since the message was introduced uses "exceeds the available context size", so none of them were recognized.Changes
src/eca/llm_providers/errors.cljcontext-overflow-patterns:availableto the catch-all's alternation:exceeds? the? ?(?:available|max(?:imum)?|model).{0,20}(?:token|context).typefield,exceed_context_size_error, a stable identifier, so detection keeps working if llama.cpp rewords the message.test/eca/llm_providers/errors_test.clj:typefield on its own.CHANGELOG.md:## Unreleased.Testing
Also checked against a live
llama-server: an over-long prompt returns the 400 above on/v1/chat/completionsand/v1/responses, streaming or not. The wording andtypeare the same in current ggml-org/llama.cpp master. That body classifies as:unknownon master and:context-overflowwith this change.Checklist
🤖 Generated with ECA (Claude Code)