Native llama.cpp completion ignores a Chat API schema envelope

On native /completion, putting this schema in response_format left the required wrapper unenforced. The same schema in native json_schema restored the exact contract.

Qualified 2026-10-16 Pacific · Same-agent local repeatability

Qualified 2026-10-16 Pacific on llama.cpp 0.6.0 build 11429 (d81235049), Qwen3-4B Q4_K_M; exact artifact SHA-256 in the package.

Apple M4 Pro, 24 GiB unified memory, macOS 26.3; CPU only, two threads, one slot, 2048-token context; loopback/offline.

For each repair, the same agent completed two seven-trial sequences in fresh server processes on the same Mac. Unchanged passing case runs were reused; the evidence index identifies them.

Same-agent repeatability checks on one Mac; no independent operator, second machine or human acceptance test.

Download full evidence cohort

412,621 bytes

SHA-256: 8a3e0d0b0f217f30e583450c7073dd1558ce75b9bb8f0e3e8f348e6260a28b93

Observed symptom

A completed JSON response contains id and text but omits the required kingy_record wrapper when Chat API response_format is sent to the native /completion route.

Correction

For native POST /completion, pass the unchanged schema in top-level json_schema. Use the documented Chat API response_format shape only with its corresponding chat endpoint.

  1. Record the actual endpoint and serialized request body. The frozen example uses native /completion, not /v1/chat/completions.
  2. Move the identical schema from the misplaced Chat API response_format envelope to native top-level json_schema. Keep the rendered prompt, seed, temperature and output cap unchanged.
  3. Validate the original contract: {"kingy_record":{"id":17,"text":"ALPHA"}}. Do not weaken it to accept the unwrapped baseline.
  4. Require complete EOS termination without truncation. Preserve the raw response so well-formed JSON is not mistaken for schema compliance.

Results

In each of two fresh-process runs: 0/3 baseline task passes, 3/3 corrected passes and 0/1 reverted passes. All original task checks and scoped completion checks passed. The offline audit recomputed acceptance from raw responses and rejected six damaged corrected-response controls.

Failed attempts and controls

The misplaced envelope produced completed JSON with correct inner facts but the wrong original contract. Treating any parseable JSON as success would miss the failure.

Limits

Same-agent repeatability checks on one Mac; no independent operator, second machine or human acceptance test.

Fixed synthetic tasks selected after exploration. The repeat counts do not establish a general reliability rate or support for other models and builds.

Runtime binaries and model weights are excluded. Exploratory failures, the failed first qualification fixture and all final trial responses are retained.

Client demonstrations identify owned reference integrations and injected inputs explicitly; they are not claims of a repaired Open WebUI release or a general llama.cpp bug fix.

This is a current identified endpoint/configuration mismatch on the pinned build. It does not settle the contradictory historical reports about schema enforcement.

Only this simple schema and route pair were qualified. No general Draft 7 compatibility or silently ignored-field behavior is guaranteed for other builds.

This differs from repair 004: the schema itself is unchanged; only the request envelope changes.

Evidence

The ZIP includes exact requests, raw responses, the indexed complete case runs, failed initial attempts, frozen runner/client code, the offline audit, all file checksums and the selection record. It contains no model weights or runtime binary.

Primary protocol or upstream reference. The current result above is limited to the identified artifacts and fixture.

Read this repair in Fix Finder →