Repository navigation
fix(llamacpp): use --load-mode for llama.cpp v1.0.0 on macOS and Windows - #1116
Merged
Merged
Conversation
llama.cpp v1.0.0 replaced --mmap, --no-mmap, --mlock and --direct-io with --load-mode and exits on the old flags. macOS always passed --no-mmap, so every model load failed. Pass --load-mode none instead, allow --load-mode in runtime flags, drop the removed flags, and pin the Desktop download to v1.0.0 to match the Linux image. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Contributor
There was a problem hiding this comment.
Hey - I've found 4 issues
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="pkg/inference/backends/llamacpp/llamacpp_config.go" line_range="26" />
<code_context>
// Special case for macOS (Apple), optimization
if runtime.GOOS == "darwin" {
- args = append(args, "--no-mmap")
+ args = append(args, "--load-mode", "none")
}
</code_context>
<issue_to_address>
**Older server overrides fail**
When a user selects a pre-v1.0.0 server version, `NewDefaultLlamaCppConfig` adds `--load-mode none`, which older servers reject, while `ValidateRuntimeFlags` rejects legacy flags those servers support. The server cannot load models with the macOS default, and callers cannot use supported legacy flags.
Choose the macOS argument and validate runtime flags according to the selected server version.
Also at `pkg/inference/runtime_flags_allowlist.go:78-81`.
</issue_to_address>
### Comment 2
<location path="pkg/inference/backends/llamacpp/download.go" line_range="36" />
<code_context>
// is upgraded, so all platforms ship a consistent, tested build. Users can
// override it via LLAMA_SERVER_VERSION or `--llama-server-version`.
- pinnedServerVersion = "b9879"
+ pinnedServerVersion = "v1.0.0"
)
</code_context>
<issue_to_address>
**Failed upgrades remove working server**
When an existing installation is upgraded and a filesystem operation fails after the old directories are removed, `downloadLatestLlamaCpp` removes the existing installation before preparing the replacement, so a later filesystem failure leaves the backend without a working server.
Prepare the replacement separately and preserve the existing installation until the replacement is ready to take its place.
</issue_to_address>
### Comment 3
<location path="pkg/inference/runtime_flags_allowlist.go" line_range="78" />
<code_context>
- "--mmap": true, "--no-mmap": true,
- "-dio": true, "--direct-io": true,
- "-ndio": true, "--no-direct-io": true,
+ "-lm": true, "--load-mode": true,
"-cram": true, "--cache-ram": true,
"-kvu": true, "--kv-unified": true,
</code_context>
<issue_to_address>
**Legacy environment flags still crash**
When a deployment's `LLAMA_ARGS` still contains a flag removed in llama.cpp v1.0.0, `LLAMA_ARGS` bypasses `ValidateRuntimeFlags`, so a configured removed flag such as `--no-mmap` reaches the v1.0.0 server, which exits on it and causes model loads to fail instead of returning a validation error.
Validate `LLAMA_ARGS` against the current llama.cpp flag allowlist or explicitly reject the removed flags before accepting the environment config.
</issue_to_address>
### Comment 4
<location path="pkg/inference/backends/llamacpp/download.go" line_range="36" />
<code_context>
// is upgraded, so all platforms ship a consistent, tested build. Users can
// override it via LLAMA_SERVER_VERSION or `--llama-server-version`.
- pinnedServerVersion = "b9879"
+ pinnedServerVersion = "v1.0.0"
)
</code_context>
<issue_to_address>
**Platform builds use different pins**
When the `v1.0.0` Hub images resolve to a different upstream build than the Linux pin, macOS and Windows resolve the `v1.0.0` Hub tags, while Linux is built from `v1.0.0-b12359-b1b770d`; that does not ensure the same llama.cpp build across platforms as the description claims.
Use and publish a deferred-download tag matching the Linux build, or document that the platform builds are not identical.
</issue_to_address>An explicit --load-mode argument breaks when users override the server version to a build older than v1.0.0, which rejects the flag. Set LLAMA_ARG_LOAD_MODE and LLAMA_ARG_MMAP instead; each llama.cpp version reads its own variable and ignores the other. Co-Authored-By: Claude Opus 5.5 <[email protected]>
doringeman
approved these changes
Nov 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
llama.cpp v1.0.0 replaced
--mmap,--no-mmap,--mlock,-dio/--direct-ioand-ndio/--no-direct-iowith-lm/--load-modeand exits on the old flags. model-runner always passes--no-mmapon macOS, so with the newdocker/docker-model-backend-llamacpp:v1.0.0image every model load on Docker Desktop for Mac fails:Changes:
--no-mmapdefault argument and setLLAMA_ARG_LOAD_MODE=noneandLLAMA_ARG_MMAP=falsein the server environment. v1.0.0 reads the first, older builds read the second, so overriding the server version to an older build (--llama-server-version b9879) keeps working.-lm/--load-modeand drop the removed flags, so users get a validation error instead of a crash.pinnedServerVersion:b9879→v1.0.0, matching the Linux image pinned in fix(llamacpp): pin stable v1.0.0 with JSON nesting fixes #1113. Thev1.0.0-{cpu,cuda,opencl,metal}images are published on Hub.Validation
go test -race ./pkg/inference/... ./pkg/server/...andgolangci-lintpass on Linux; the darwin branch is covered by macOS CI.docker model install-runner --backend llama.cpp --llama-server-version v1.0.0. The fix itself still needs a Desktop build with this model-runner to verify end to end.🤖 Generated with Claude Code