Repository navigation
llama.cpp b11538, InvalidRequestException (400 instead of 500), agent follow-ups closed - #499
Merged
Merged
Conversation
All eleven patches apply unchanged (verified in order against the pristine tag); see docs/history/llama-cpp-breaking-changes.md for the range. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AytmJF9faEiQEVt6eetQS2
…p b11538) Upstream #30228 makes GET /models carry the trained context length per model, read offline from the GGUF. The parser reads it, 0 when absent (a server before b11538, or a file without the key); value tests cover the getter, the constructor delegation and equals/hashCode. CHANGELOG entries for the bump and the getter. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AytmJF9faEiQEVt6eetQS2
…ODO and handover updated Two entries of the Atmosphere agent's follow-up list in TODO.md were stale: - "Approval for destructive tools": the gate has shipped (ApprovalMode, ConsoleApprovalStrategy, AgentRunner.approval with Atmosphere's ToolApprovalPolicy, --auto for unattended runs; ApprovalWireTest and ConsoleApprovalStrategyTest pin it). Removed. - "Tool rounds are not carried across REPL turns": rewritten with the measured reason the asked-for form is impossible on atmosphere-ai 4.0.72 (AbstractAgentRuntime.assembleMessages rebuilds every history entry as new ChatMessage(role, content), checked in the bytecode), what ships instead (AgentSession.toolNote in front of the next user message, pinned by LocalAgentTest), and when to reopen it. docs/handover/local-agent-pr-a.md said it is deleted once PR A is merged; PR A and the agent's corrections are, but deliverable 6 carries the agent's measurements and the four OPEN items the Windows CPU-variants job (B2) still needs, so the file stays with a status note and TODO.md's "CPU variants" entry points at it. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AytmJF9faEiQEVt6eetQS2
…AiCompatServer answers 400 llama.cpp's own HTTP server has answered a malformed or empty request with 400 (invalid_request_error) since b11337 (#29060); the Java transport answered 500, because the JNI layer threw the same LlamaException for a rejected request and a failed inference and the server could not tell them apart without matching on message text (TODO.md, "400 vs. 500"). Native side: a second exception class, exception.InvalidRequestException (a LlamaException), cached as c_llama_invalid_request next to c_llama_error. Three helpers decide which one a failure gets, each with upstream's rule: throw_invalid_request for request parsing (an invalid request whatever the parser threw; now also behind parse_json_params and require_json_field), throw_by_exception_type for upstream code whose exception type carries the verdict (std::invalid_argument and common_json_error are 400, as in upstream's ex_wrapper; tokenization, format_prompt_infill, the /v1/systemone handler), and error_class_for for a failed task result, from the new json_helpers get_result_error_code (400 for ERROR_TYPE_INVALID_REQUEST and ERROR_TYPE_EXCEED_CONTEXT_SIZE). The empty-input and pooling-type checks of handleEmbeddings and a 400 from the systemone route are typed the same way. The message of a rejected request is the bare reason now, no longer the JSON object the old throw_invalid_request wrapped it in; the type is the class. Java side: OpenAiCompatServer catches InvalidRequestException together with the IllegalArgumentException of its own validation at the ten request sites (400, or the invalid_request_error SSE event once a stream has started), on every surface. A plain LlamaException stays 500. The Server layer may now see the Exception layer (LlamaArchitectureTest). Tests: four C++ tests for get_result_error_code (607 total); six model-free HTTP tests (a backend throwing the typed exception is 400 for chat, embeddings, completions, Ollama and Anthropic, an SSE error event when streaming, a plain LlamaException 500); ErrorHandlingTest tightened to the typed exception plus an empty input array and a malformed body; model-backed 400 cases in the embeddings and completion server integration tests. Javadoc on every entry point that can throw it; CHANGELOG, CLAUDE.md (the JNI exception boundary, the helper and test tables) and TODO.md updated. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AytmJF9faEiQEVt6eetQS2
bernardladenthin
had a problem deploying
to
maven-central
October 9, 2026 22:34 — with
GitHub Actions
Failure
bernardladenthin
had a problem deploying
to
startgate
October 9, 2026 22:34 — with
GitHub Actions
Error
bernardladenthin
had a problem deploying
to
maven-central
October 9, 2026 22:34 — with
GitHub Actions
Failure
|
10 of 11 tasks
This branch had an error being deployed
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.


Summary
get_rows), #30228 (UI Models Manager:GET /modelsgainscontext_length;common_get_decision_typereplaced bycommon_get_gguf_info(), which no project C++ called), #28331 (llama-bench-fitc). All 11 patches apply unchanged, the drop-checks are unchanged, the two history rows are written.RouterModel.getContextLength()exposes the new router field (0from an older server or a GGUF without the key); thevalue.*PIT gate at 100 % is covered byRouterModelTest/RouterModelsResponseParserTest.InvalidRequestException(aLlamaException) from the JNI layer, andOpenAiCompatServeranswers400instead of500for a request the native layer rejects. Upstream's server has answered these with400since b11337 (#29060); the Java transport reportedserver_error, because the JNI layer threw the sameLlamaExceptionfor a rejected request and a failed inference. Native side:c_llama_invalid_requestnext toc_llama_error, chosen by three helpers with upstream's own rules —throw_invalid_requestfor request parsing (also behindparse_json_paramsandrequire_json_field),throw_by_exception_type(std::invalid_argument/common_json_error→ 400, the rule of upstream'sex_wrapper; tokenization,format_prompt_infill, the/v1/systemonehandler), anderror_class_forfor a failed task result via the newjson_helpersget_result_error_code(400 forERROR_TYPE_INVALID_REQUESTandERROR_TYPE_EXCEED_CONTEXT_SIZE). The message of a rejected request is the bare reason now, no longer the JSON object the oldthrow_invalid_requestwrapped it in (CHANGELOG "Changed"). Java side: the server catches the typed exception together with theIllegalArgumentExceptionof its own validation at the ten request sites, on every surface (OpenAI, Ollama, Anthropic, Responses; aninvalid_request_errorSSE event once a stream has started); a plainLlamaExceptionstays500. TheServerlayer may now see theExceptionlayer (LlamaArchitectureTest).ApprovalMode,ConsoleApprovalStrategy,AgentRunner.approvalwith Atmosphere'sToolApprovalPolicy,--auto; pinned byApprovalWireTest) — entry removed. Tool rounds across REPL turns ride asAgentSession.toolNotein front of the next user message, and the asked-for form (fullChatMessagelist incl.tool_calls) is impossible on atmosphere-ai 4.0.72:AbstractAgentRuntime.assembleMessagesrebuilds every history entry asnew ChatMessage(role, content)(checked in the bytecode) — entry rewritten with that reason and the reopen condition.docs/handover/local-agent-pr-a.mdstays with a status note, because deliverable 6 carries the local agent's B2 measurements and the fourOPENitems the Windows CPU-variants job still needs;TODO.md"CPU variants" points at it.Test plan
ctest, +4 forget_result_error_code); Java suite model-free1845run /0failures /285skipped (-Dnet.ladenthin.llama.test.ngl=0; +6 model-free HTTP tests: typed rejection is400for chat, embeddings, completions, Ollama and Anthropic, an SSE error event when streaming, a plainLlamaException500);ErrorHandlingTesttightened to the typed exception plus an empty input array and a malformed body; model-backed400cases inOpenAiServerEmbeddingsIntegrationTest("input":[], unknownencoding_format) andOpenAiServerCompletionIntegrationTest(noprompt) — these need CI's models;spotless:check,compile spotbugs:check(0),javadoc:jar(0 errors, 0 warnings),check-natives.py,check-patches.py,check-release-gate.py,check-run-scripts.py,check-shared-files.py, the 113 buildcheck unit tests,reuse lintall green; clang-format 23.1.3 applied.json_helpersfunction list, the test table, theFindClasslist), TODO.md,docs/history/llama-cpp-breaking-changes.md, Javadoc on everyLlamaModelentry point that can throw the new exception.Related issues / PRs
Follows #496, #497 and #498. Closes the TODO.md entries "400 vs. 500 for an invalid request body", "Approval for destructive tools" and (rewritten) "Tool rounds are not carried across REPL turns".
Checklist
CONTRIBUTING.mdandCODE_OF_CONDUCT.mdSECURITY.md)🤖 Generated with Claude Code
https://claude.ai/code/session_01AytmJF9faEiQEVt6eetQS2
Generated by Claude Code