Skip to content

Upgrade llama.cpp to b10154 and refactor server route registration - #364

Merged
bernardladenthin merged 3 commits into
mainfrom
claude/dependency-plugin-updates-audit-lcubyh
Jul 27, 2026
Merged

Upgrade llama.cpp to b10154 and refactor server route registration#364
bernardladenthin merged 3 commits into
mainfrom
claude/dependency-plugin-updates-audit-lcubyh

Conversation

@bernardladenthin

Copy link
Copy Markdown
Owner

Summary

  • Upgrade llama.cpp pinned version from b10107 to b10154
  • Refactor HTTP route registration in llama_server() to extract a shared llama_server_register_common_routes() helper that registers stable, state-independent routes (health, models, slots, etc.)
  • Implement llama_server_attach() entry point for embedded/JNI callers to attach the HTTP frontend to an already-loaded server_context, enabling full route table + WebUI assets + resumable streaming without re-loading the model
  • Update Android build tooling: AGP 9.2.1 → 9.3.0, Gradle 9.4.1 → 9.5.0, Compose plugin 2.4.0 → 2.4.10
  • Update version strings and documentation to reflect b10154

Details

Route registration refactor:
The new llama_server_register_common_routes() extracts the core endpoint set (health, models, slots, etc.) that is identical between the standalone server and embedded attach mode. Experimental features (CORS proxy, built-in tools, MCP) remain wired per entry point since they depend on router state and lifecycle management that the shared helper does not carry. This prevents drift between the two entry points on the stable route set.

New llama_server_attach() entry point:
Allows embedding callers (e.g., JNI/Java) to attach a full HTTP frontend to an already-loaded server_context without re-initializing the model or backend. The caller's worker thread continues driving the context; HTTP routes post tasks to its queue. Supports resumable streaming, WebUI assets, and all stable routes. Experimental features (CORS proxy, built-in tools) answer 403 "disabled" to match a stock server built without those features.

Windows JNI regression fix (patch 0001):
Carries upstream llama.cpp changes to fix a Windows regression where common_params_parse unconditionally re-derived argv from the process command line, clobbering embedded caller args. The fix introduces common_params_parse_main() for standalone tools and guards common_params_parse() to honor caller-supplied argv. All ~34 standalone call sites flip to the new wrapper; embedded callers (jllama.cpp) keep calling common_params_parse directly and are never overridden.

Test plan

  • CI is green on this branch
  • Existing unit/integration tests pass (no new test code added; patch 0001 includes a regression test in test-arg-parser.cpp)
  • Route registration refactor is a pure extraction with no behavioral change to llama_server()
  • llama_server_attach() is new code; integration tested via JNI layer in downstream jllama builds

Related issues / PRs

Upstream llama.cpp b10154 release; carries PR #22393 (slot_prompt_similarity getter/setter) and Windows arg-parse regression fix.

Checklist

  • I have read CONTRIBUTING.md and CODE_OF_CONDUCT.md
  • My commits follow Conventional Commits
  • No security-sensitive changes

https://claude.ai/code/session_01MeheJtyQwUzJGLcYpyWURD

claude added 3 commits July 27, 2026 17:01
Patch bump of org.jetbrains.kotlin.plugin.compose; tracks the Kotlin
version and stays above AGP's bundled Kotlin floor. No other change.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MeheJtyQwUzJGLcYpyWURD
Bumps com.android.application to 9.3.0 in both the android-llmservice app
and the .github/android-consumer-test fixture. AGP 9.3.x requires Gradle
>= 9.5.0, so the four gradle-version pins on the AGP-building CI jobs move
9.4.1 -> 9.5.0 (the AAR/lib-only jobs stay on their older Gradle). JDK
floor stays 17 (CI runs 21); max API stays 37 (compileSdk 37). The R8
RecordTag regression fix first shipped in 9.2.1 is carried forward by
9.3.0. Docs (README, CLAUDE.md) updated to match.

Validated only against Android's official AGP<->Gradle compatibility
table; the isMinifyEnabled release/R8 path is validated by CI, which has
the Android SDK a local sandbox lacks.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MeheJtyQwUzJGLcYpyWURD
Bumps the pinned llama.cpp release across the four canonical files
(CMakeLists.txt GIT_TAG + LLAMA_TAG, README badge, CLAUDE.md, and the
LlamaCppVersion.LLAMA_CPP_VERSION Java constant) and refreshes patches/.

Patch refresh (b10154 added upstream MCP-server support):
- 0001: one common/arg.h hunk drifted (b10154 inserted
  common_print_available_devices() beside common_params_parse); the other
  36 files applied unchanged. Regenerated against b10154.
- 0007: reworked. b10154 moved the resumable-streaming routes
  (/v1/stream/:conv_id -> /v1/stream) into the middle of the route/CORS/tools
  block and coupled tools/CORS to a new server_mcp mcp_mgr lifecycle
  (2-arg tools.setup), so the old contiguous 'route-table + CORS-proxy +
  tools' extraction is no longer possible. The shared helper
  llama_server_register_common_routes() is narrowed to the pure core route
  table (health..slots); llama_server() keeps the streaming/GCP/CORS/MCP/tools
  blocks inline, byte-identical to upstream b10154. llama_server_attach()
  registers the route table + non-router streaming on the new /v1/stream
  paths + GCP compat + 403 stubs for the experimental /cors-proxy + /tools
  endpoints it does not wire.
- 0002/0003/0006/0008 apply unchanged.

No project source change needed. Verified in-sandbox: all 6 patches apply
clean in order against a fresh b10154 checkout; cmake configure passes
(fail-loud patch applier + OuteTTS generator anchors hold); full jllama
shared-library build compiles and links at -O3; all 485 C++ unit tests pass.
Appends the b10107-b10154 row to the breaking-changes history.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MeheJtyQwUzJGLcYpyWURD
@bernardladenthin
bernardladenthin merged commit 78f32c1 into main Jul 27, 2026
10 of 16 checks passed
@bernardladenthin
bernardladenthin deleted the claude/dependency-plugin-updates-audit-lcubyh branch July 27, 2026 19:48
@sonarqubecloud

Copy link
Copy Markdown

vaiju1981 pushed a commit to vaiju1981/java-llama.cpp that referenced this pull request Jul 29, 2026
… old glibc

The b10154 upgrade (PR bernardladenthin#364) broke the Publish pipeline on 6 native jobs.
Two independent root causes, both from upstream's new MCP-server support:

1. Undefined server_mcp symbols (macOS + all Windows jobs; latent on Linux).
   b10154 added tools/server/server-mcp.cpp, and server.cpp (llama_server's
   mcp_mgr lifecycle) + server-tools.cpp (tools.setup(..., mcp_mgr) /
   server_mcp::call_tool) — both already compiled into jllama — now reference
   server_mcp. server-mcp.cpp was missing from the CMake target_sources, so the
   link failed with undefined server_mcp::{start,shutdown,call_tool,list_tools,
   ~server_mcp}. A Linux .so tolerates undefined symbols (why the local build
   and Linux CI 'passed'); macOS/ld64 and Windows/MSVC hard-error. Add
   server-mcp.cpp to the non-Android jllama block (shares the subprocess.h
   posix_spawn Android guard). Not added to jllama_test (links neither
   server.cpp nor server-tools.cpp). Verified: nm now shows server_mcp::* as
   defined (T), and jllama links.

2. posix_spawn_file_actions_addchdir_np undeclared on manylinux2014 (glibc 2.17).
   b10154's vendored subprocess.h calls addchdir_np (glibc >= 2.29 / bionic API
   >= 34 / macOS >= 10.15) but guards it only for macOS. Add patch 0009 with a
   SUBPROCESS_HAVE_ADDCHDIR_NP probe (__GLIBC_PREREQ, nested under
   defined(__GLIBC__)) that falls back to ENOSYS on old glibc — this build never
   spawns with a cwd. Android already compiles it (weak-symbol macro).

Also: /utf-8 for MSVC (C4566). server-tools.cpp embeds a U+2192 arrow in a
narrow literal; MSVC/clang-cl warn C4566 and mangle it under code page 1252.
Scope /utf-8 to jllama (gated on MSVC) — the documented C4566 fix.

Verified locally: all 9 patches apply clean against b10154; cmake configure
(fail-loud patch applier + TTS generator) passes; full jllama build links.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MeheJtyQwUzJGLcYpyWURD
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants