Repository navigation
docs(gateway): document llamacpp toolSchemaProfile for custom llama.cpp endpoints - #117120
vincentkoc merged 5 commits into
Conversation
…pp endpoints Custom openai-completions providers pointed at a llama.cpp / llama-server endpoint bypass the GBNF-safe schema normalization that built-in llama-cpp, ollama, and lmstudio providers apply automatically. The toolSchemaProfile: "llamacpp" switch activates it, but the supported value was never named in the docs, so users hit llama.cpp 400 'failed to parse grammar' on tools with large minLength/maxLength (e.g. cron trigger.script, maxLength 65536). - Expand the toolSchemaProfile row to name the values recognized on a model's compat (llamacpp, gemini) and when llamacpp must be set explicitly; cross-reference the unsupportedToolSchemaKeywords escape hatch. - Add a 'Local models (llama.cpp / llama-server)' provider example showing the required compat.toolSchemaProfile: "llamacpp" on a custom endpoint. Related to openclaw#117070 Co-Authored-By: iCodeMate <[email protected]>
60d6c04 to
93ae825
Compare
|
Codex review: needs maintainer review before merge. Reviewed August 1, 2026, 2:06 AM ET / 06:06 UTC. ClawSweeper reviewWhat this changesThis PR documents the existing Merge readinessKeep this PR open for normal maintainer merge. The prior P3 finding is fixed on the current head: the new llama.cpp accordion now precedes LM Studio alphabetically. Current Priority: P3 Review scores
Verification
How this fits togetherCustom provider configuration supplies model compatibility declarations before OpenClaw builds tool schemas for an endpoint. The flowchart LR
A[Custom llama-server endpoint] --> B[Custom model configuration]
B --> C[Tool-schema profile selection]
C --> D[llama.cpp schema cleaner]
D --> E[Tool request payload]
E --> F[OpenAI-compatible llama.cpp server]
Before merge
Agent review detailsSecurityNone. PR surfaceDocs +38. Total +38 across 1 file. View PR surface stats
Review metricsNone. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Merge the targeted custom-provider reference and example after the pending docs check passes, keeping llama.cpp behavior model-level and explicit for arbitrary OpenAI-compatible endpoints. Do we have a high-confidence way to reproduce the issue? Not applicable: this PR changes documentation only. The described runtime path is directly verified from current source and existing tests rather than requiring a new failing reproduction. Is this the best way to solve the issue? Yes. It documents the existing explicit per-model compatibility setting at the custom-provider reference point, avoids a new provider/default, and accurately distinguishes the targeted profile from the broader keyword-removal fallback. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 137050cedd32. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (5 earlier review cycles)
|
Address review feedback on openclaw#117120: the fallback sentence claimed the llamacpp profile "also clamps" constraints, but cleanSchemaForLlamacppGbnf only removes `pattern` outright and drops `maxLength` at or above the 2000-repetition threshold (LLAMACPP_GBNF_MAX_REPETITION_THRESHOLD). It never clamps a value, and small bounds like `minLength: 1` are preserved (confirmed by the projection test at src/plugin-sdk/provider-tools.test.ts). Reword the escape-hatch sentence to describe the implemented stripping behavior and contrast it with the unconditional keyword-list drops, so operators do not expect a preserved bounded constraint. No code or behavior changes; documentation only.
…formations Address follow-up review on openclaw#117120: the toolSchemaProfile table row described `llamacpp` as "rewriting tool schemas into the JSON Schema subset llama.cpp can compile to GBNF," which overstates what cleanSchemaForLlamacppGbnf does. The cleaner only removes `pattern` outright and drops `maxLength` at or above the 2000-repetition threshold (LLAMACPP_GBNF_MAX_REPETITION_THRESHOLD); it leaves every other keyword and `minLength` untouched, and those are not guaranteed GBNF-safe. Reword the row to state the exact transformation contract and explicitly note it is a targeted compatibility cleaner, not a blanket GBNF-safety guarantee. No code or behavior changes; documentation only. Co-Authored-By: iCodeMate <[email protected]>
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Final maintainer landing gate for exact head
Landing via squash with contributor authorship preserved. |
…pp endpoints (openclaw#117120) * docs(gateway): document llamacpp toolSchemaProfile for custom llama.cpp endpoints Custom openai-completions providers pointed at a llama.cpp / llama-server endpoint bypass the GBNF-safe schema normalization that built-in llama-cpp, ollama, and lmstudio providers apply automatically. The toolSchemaProfile: "llamacpp" switch activates it, but the supported value was never named in the docs, so users hit llama.cpp 400 'failed to parse grammar' on tools with large minLength/maxLength (e.g. cron trigger.script, maxLength 65536). - Expand the toolSchemaProfile row to name the values recognized on a model's compat (llamacpp, gemini) and when llamacpp must be set explicitly; cross-reference the unsupportedToolSchemaKeywords escape hatch. - Add a 'Local models (llama.cpp / llama-server)' provider example showing the required compat.toolSchemaProfile: "llamacpp" on a custom endpoint. Related to openclaw#117070 Co-Authored-By: iCodeMate <[email protected]> * docs(gateway): describe llamacpp profile as stripping, not clamping Address review feedback on openclaw#117120: the fallback sentence claimed the llamacpp profile "also clamps" constraints, but cleanSchemaForLlamacppGbnf only removes `pattern` outright and drops `maxLength` at or above the 2000-repetition threshold (LLAMACPP_GBNF_MAX_REPETITION_THRESHOLD). It never clamps a value, and small bounds like `minLength: 1` are preserved (confirmed by the projection test at src/plugin-sdk/provider-tools.test.ts). Reword the escape-hatch sentence to describe the implemented stripping behavior and contrast it with the unconditional keyword-list drops, so operators do not expect a preserved bounded constraint. No code or behavior changes; documentation only. * docs(gateway): scope llamacpp profile description to its actual transformations Address follow-up review on openclaw#117120: the toolSchemaProfile table row described `llamacpp` as "rewriting tool schemas into the JSON Schema subset llama.cpp can compile to GBNF," which overstates what cleanSchemaForLlamacppGbnf does. The cleaner only removes `pattern` outright and drops `maxLength` at or above the 2000-repetition threshold (LLAMACPP_GBNF_MAX_REPETITION_THRESHOLD); it leaves every other keyword and `minLength` untouched, and those are not guaranteed GBNF-safe. Reword the row to state the exact transformation contract and explicitly note it is a targeted compatibility cleaner, not a blanket GBNF-safety guarantee. No code or behavior changes; documentation only. Co-Authored-By: iCodeMate <[email protected]> * docs(gateway): tighten llama.cpp profile contract * docs(gateway): order local model examples --------- Co-authored-by: iCodeMate <[email protected]> Co-authored-by: Vincent Koc <[email protected]>
…in-4caff51-20260801 * origin/main: fix(agents): surface /new guidance for thinking-signature replay errors (openclaw#116967) (openclaw#116987) fix(doctor): keep repaired session rows readable (openclaw#117207) fix(feishu): unify outbound delivery lifecycle (openclaw#117223) docs(gateway): document llamacpp toolSchemaProfile for custom llama.cpp endpoints (openclaw#117120) fix(clickclack): thread replies stop being answered past the 100-reply thread window (openclaw#117225) fix(talk): retain bounded relay close owners fix(talk): bound relay transcript persistence
What Problem This Solves
OpenClaw already supports
compat.toolSchemaProfile: "llamacpp"for custom model entries, but the gateway docs did not name the value or explain when a customllama-serverroute needs it. Operators could therefore hit llama.cpp HTTP 400 grammar failures without a documented path to the existing compatibility cleaner.Related to #117070
Why This Change Was Made
This documents the existing
llamacppprofile and adds a complete customopenai-completionsprovider example forllama-server. The wording is intentionally narrow: the profile removespatternandmaxLengthvalues at or above 2000, covering the reported cronmaxLength: 65536failure without claiming complete compatibility for every JSON Schema constraint orminLength.Built-in
llama-cpp,ollama, andlmstudioproviders already apply the same cleaner through provider hooks. Custom endpoints remain explicit because an arbitrary OpenAI-compatible URL is not a reliable llama.cpp identity contract. The broader first-party provider decision is already tracked in #116765.User Impact
Operators using a custom
llama-serverendpoint can now configure the supported schema profile directly instead of reverse-engineering a provider rejection. Older builds also get a clearly labeled broader keyword-stripping fallback.Evidence
packages/ai/src/providers/agent-tools-parameter-schema.tspackages/ai/src/providers/clean-for-llamacpp-gbnf.tsextensions/llama-cpp/index.ts,extensions/ollama/index.ts,extensions/lmstudio/index.tssrc/agents/tools/cron-tool-schema.tssrc/plugin-sdk/provider-tools.test.tsddd4ec1428a6201e18975ea52b07c71e0f9aef26: stringminLength/maxLengthbecome grammar repetitions, and llama.cpp rejects repetition expansion at its 2000-rule ceiling.Validation on head
0fc2c856d17cc7b5408c89584eea1576ceb682b1:No runtime behavior changes.