Skip to content

fix(deps): share llama backend in tests#208

Closed
saagpatel wants to merge 4 commits into
masterfrom
codex/fix/llama-backend-init
Closed

fix(deps): share llama backend in tests#208
saagpatel wants to merge 4 commits into
masterfrom
codex/fix/llama-backend-init

Conversation

@saagpatel

@saagpatel saagpatel commented Jul 10, 2026

Copy link
Copy Markdown
Owner

What

  • Update llama-cpp-2 and llama-cpp-sys-2 to 0.1.151.
  • Share one test-only LlamaBackend through OnceLock across the Rust test suite.
  • Add a regression test and ADR for the process-wide backend contract.
  • Silence the harmless origin/HEAD lookup error before the CI gate uses its existing master fallback.

Why

llama-cpp-2 0.1.151 permits backend initialization only once per process. The dependency-only update in #204 causes later engine tests to fail with BackendAlreadyInitialized. The first PR run also showed that the existing policy requires explicit test and ADR evidence for changes under the Rust KB path.

How

A test-only helper initializes the backend once and returns cloned Arc handles to the embedding and LLM tests. Production initialization and CI policy classification are unchanged.

Testing

  • cargo test --manifest-path src-tauri/Cargo.toml test_engine_creation -- --nocapture (2 passed)
  • cargo test --manifest-path src-tauri/Cargo.toml (312 unit tests passed, 1 ignored, plus all integration and doc tests)
  • cargo test --manifest-path src-tauri/Cargo.toml --test llama_backend_singleton_policy (passed)
  • node scripts/ci/require-tests-and-docs.mjs (passed)
  • GitHub CI must be fully green before merge.

Risks

Low. The backend helper is compiled only under cfg(test); production backend ownership and initialization are untouched.

Performance impact

No production impact. The shared test backend avoids repeated native backend initialization.

Lockfile rationale

Cargo.lock is refreshed by normal Cargo resolution for llama-cpp-2 0.1.151 and its transitive native build dependencies.

Screenshots

Not applicable; no UI changes.

@saagpatel

Copy link
Copy Markdown
Owner Author

Superseded by #209. The replacement carries the same verified llama-cpp 0.1.151 compatibility fix, regression test, and ADR in one commit with an allowed commitlint scope. Replacing the branch avoids force-pushing published history.

@saagpatel saagpatel closed this Jul 10, 2026
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.

1 participant