Repository navigation
Description
The current default settings on the llama.cpp server allow for unlimited generation. The max_tokens cap is configured in the gateway. A direct or malformed request that omits max_tokens can therefore inherit llama.cpp’s unlimited n_predict = -1 default.
I ran into an edge case earlier today where a subagent ended up with the max_tokens not being set. The prompt was to summarise and extract info from a long document into a tool call. The qwen3.6:35b model struggled with the complexity of the tool call and kept getting stuck in reasoning loops which ran until the request timed out.
The fix was to turn down the temperature and disable reasoning on the subagent. But a max_tokens default on the model would've caused this to fail faster and get to this solution quicker.
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Activity
clawsweeper commentedon Aug 27, 2026
Codex review: keeping this open for maintainer follow-up; there is still a little grit to resolve. Reviewed August 27, 2026, 10:25 AM ET / 14:25 UTC.
Summary
This remains a small, source-proven Local AI bug. Current main advertises an 8,192-token gateway limit but does not write a matching llama-server default for requests that omit
max_tokens.Reproducibility: yes. Generate the managed preset, send a completion without max_tokens, and verify against the pinned llama-server runtime that the omitted request lacks an OpenClaw-defined output ceiling.
Next step
The missing preset default and existing gateway ceiling define a narrow repair boundary; no open fixing PR is identified in the supplied context.
Review details
Best possible solution:
Write a verified finite default into the managed llama-server preset, aligned with the existing 8,192-token gateway ceiling, and cover omitted and explicit request-limit behavior.
Do we have a high-confidence way to reproduce the issue?
Yes. Generate the managed preset, send a completion without max_tokens, and verify against the pinned llama-server runtime that the omitted request lacks an OpenClaw-defined output ceiling.
Is this the best way to solve the issue?
Yes. Preset generation is the narrowest common enforcement point, avoiding reliance on every gateway and direct caller to supply max_tokens.
AGENTS.md: found and applied where relevant.
Remaining risk / open question:
Codex review notes: model internal, reasoning high; reviewed against 911f36860b2d.
Label changes
Label justifications:
P2: A malformed local-model request can consume resources until timeout, but the evidence supports a bounded default-setting repair rather than an availability emergency.impact:other: The concrete impact is runaway local generation and resource consumption, outside the more specific owned impact categories.Evidence reviewed
Acceptance criteria:
What I checked:
src/OpenClaw.Connection/LocalAi/LlamaServerRouterConfiguration.cs:145, 911f36860b2d)src/OpenClaw.Connection/LocalAi/LocalAiGatewayProviderDefinition.cs:113, 911f36860b2d)src/OpenClaw.Connection/LocalAi/LlamaServerRouterConfiguration.cs:108, ccd64bbb7d68)src/OpenClaw.Connection/LocalAi/LlamaServerRouterConfiguration.cs:108, ccd64bbb7d68)Likely related people:
src/OpenClaw.Connection/LocalAi/LlamaServerRouterConfiguration.cs,src/OpenClaw.Connection/LocalAi/LocalAiGatewayProviderDefinition.cs)How this review workflow works
@clawsweeper re-reviewcomments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.@clawsweeper re-reviewor@clawsweeper re-runon an open PR or issue to request a fresh review only.@clawsweeper reviewto request a fresh review only.@clawsweeper autofix,@clawsweeper automerge,@clawsweeper fix ci, or@clawsweeper address review.@clawsweeper explainto ask for more context, or@clawsweeper stopto stop active automation.