Skip to content

Runaway generation with default llama.cpp settings #1240

Closed

Description

@jacobtomlinson

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.

Activity

  1. added
    bug
    local-models
    on Aug 27, 2026
  2. added
    clawsweeper:fix-shape-clear
    clawsweeper:queueable-fix
    clawsweeper:source-repro
    impact:other
    issue-rating: 🦞 diamond lobster
    no-stale
    P2
    on Aug 27, 2026
  3. clawsweeper commented on Aug 27, 2026

    @clawsweeper

    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:

    • The implementation must verify the supported preset key and omitted-request behavior against the pinned llama.cpp b10488 runtime, then preserve explicit caller-supplied limits.

    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:

    • ./build.ps1
    • dotnet test ./tests/OpenClaw.Shared.Tests/OpenClaw.Shared.Tests.csproj --no-restore
    • dotnet test ./tests/OpenClaw.Tray.Tests/OpenClaw.Tray.Tests.csproj --no-restore
    • dotnet test ./tests/OpenClaw.Connection.Tests/OpenClaw.Connection.Tests.csproj --no-restore
    • dotnet test ./tests/OpenClaw.SetupEngine.Tests/OpenClaw.SetupEngine.Tests.csproj --no-restore

    What I checked:

    Likely related people:

    • Joel: Introduced the managed Local AI and llama-server configuration surface containing both the preset and gateway ceiling. (role: feature introducer; confidence: high; commits: ccd64bbb7d68; files: src/OpenClaw.Connection/LocalAi/LlamaServerRouterConfiguration.cs, src/OpenClaw.Connection/LocalAi/LocalAiGatewayProviderDefinition.cs)
    How this review workflow works
    • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
    • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
    • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
    • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
    • Maintainers can also comment @clawsweeper review to request a fresh review only.
    • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
    • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
    • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.
  4. added
    status: 🚢 actively landing
    on Aug 27, 2026
  5. locked as resolved and limited conversation to collaborators on Aug 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2bugclawsweeper:fix-shape-clearclawsweeper:queueable-fixclawsweeper:source-reproimpact:otherissue-rating: 🦞 diamond lobsterlocal-modelsno-stalestatus: 🚢 actively landing

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions