llamacpp: HTTP 400 on valid unanchored JSON Schema patterns in tool definitions
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- Nửa ngày
- Mức phù hợp với người mới
- 45/100
Hướng nghiên cứu
The fix is a version bump of the llama.cpp backend pin, LLAMA_SERVER_VERSION (currently b9879), so find where that variable is set in the repo. Confirm the upstream change in ggml-org/llama.cpp#26939 is included in the new build, then run the curl reproduction with the ^ses pattern and check for HTTP 200. Done means that request succeeds and the existing tool-call tests still pass.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Summary
Docker Model Runner's llama.cpp backend rejects any chat completion request whose tool JSON Schema contains a valid pattern that is not fully anchored with ^/$. The whole request fails with HTTP 400 before inference starts.
Upstream llama.cpp fixed this class of failure in ggml-org/llama.cpp#26939 (merged 2026-08-20), but DMR still pins LLAMA_SERVER_VERSION=b9879, which predates the fix.
Real-world impact: OpenAI-compatible clients that emit prefix patterns such as ^ses cannot use grammar-constrained tool calling with DMR.
Environment
- Docker Desktop 29.8.2 (client 29.9.1), Windows 11
10.0.26300 - Docker Model Runner server
v1.2.8 - Model:
docker.io/ai/gpt-oss:20b - Backend fingerprint reported by DMR:
b1-72874f5(LLAMA_SERVER_VERSION=b9879in the repo)
Reproduction
Minimal, standalone request (no OpenCode or other client involved):
curl -sS http://localhost:12434/engines/v1/chat/completions \
-H 'content-type: application/json' \
-d '{
"model": "docker.io/ai/gpt-oss:20b",
"messages": [{"role": "user", "content": "hi"}],
"max_tokens": 5,
"tools": [{
"type": "function",
"function": {
"name": "demo",
"parameters": {
"type": "object",
"properties": {
"sessionID": {"type": "string", "pattern": "^ses"}
},
"required": ["sessionID"]
}
}
}]
}'
Result: HTTP 400
{
"error": {
"code": 400,
"message": "JSON schema conversion failed:\nPattern must start with '^' and end with '$'\nPattern must start with '^' and end with '$'",
"type": "invalid_request_error"
}
}
A/B test, changing only the pattern:
| Pattern | Result |
|---|---|
^ses |
HTTP 400 (schema conversion failure) |
^ses.*$ |
HTTP 200, completion succeeds |
Expected behavior
A valid JSON Schema pattern should not fail the entire request. Unsupported regex constructs should degrade gracefully (for example, fall back to an unconstrained string) as upstream llama.cpp now does, rather than returning HTTP 400.
Suggested fix
Bump LLAMA_SERVER_VERSION from b9879 to a llama.cpp build that contains ggml-org/llama.cpp#26939, or cherry-pick that change.
Additional context
- Concrete trigger: OpenCode v2 declares the built-in
subagenttool parametersessionIDas{"type":"string","pattern":"^ses"}(session IDs start withses). The same request works against Ollama, which tolerates unanchored patterns. - Client-side workaround: rewrite patterns to be fully anchored (
^ses→^ses.*$) before dispatch. - Related: docker/model-runner#534 ("Failed to parse grammar - opencode", closed).
- Upstream PR: https://github.com/ggml-org/llama.cpp/pull/26939
- Ngôn ngữ chính
- Go
- Star
- 662
- Fork
- 156
- Merge trung bình
- 15 giờ 26 phút
- Pull request đã merge (30 ngày)
- 17
Chuẩn bị môi trường
- Có Dockerfile hoặc tệp Docker Compose
- Không có mẫu pull request
- Không có hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của docker/model-runner
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 20/100
docker/model-runner#1107 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
NixOS package manager supportĐang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 43/100
docker/model-runner#1103 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
docker/model-runner#1077 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
docker/model-runner#1073 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 68/100
docker/model-runner#1063 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của docker/model-runner
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
IBM-Cloud/terraform-provider-ibm#7115 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
fluxcd/notification-controller#1441 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
volcengine/volcengine-go-sdk#163 · 1 bình luận ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
OneBusAway/maglev#2145 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
priority/medium status/ready type/chore
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
discobox-ai/discobox#1357 ·
Maintainer thường phản hồi trong vòng 1 ngày