From 09b85ee00e21ef189831e24c31926f02849807a9 Mon Sep 17 00:00:00 2001 From: localai-org-maint-bot Date: Sun, 19 Jul 2026 11:49:07 +0200 Subject: [PATCH] fix(ci): build Bonsai backend images (#10939) (#10951) fix(ci): build Bonsai backend images Register the Bonsai C++ source path with the backend matrix filter so changes select its image jobs. Also make shared llama.cpp changes rebuild the Bonsai and Turboquant fork images in the actual matrix, not only their test flags.\n\nAssisted-by: Codex:gpt-5 [Codex] Co-authored-by: localai-org-maint-bot <306269227+localai-org-maint-bot@users.noreply.github.com> --- backend/cpp/bonsai/patches/README.md | 3 +++ scripts/changed-backends.js | 23 ++++++++++++++++------- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/backend/cpp/bonsai/patches/README.md b/backend/cpp/bonsai/patches/README.md index 989f3b59a..3bfb74183 100644 --- a/backend/cpp/bonsai/patches/README.md +++ b/backend/cpp/bonsai/patches/README.md @@ -6,6 +6,9 @@ which branched from upstream some commits earlier. Any upstream API change that gRPC server depends on, but that the fork does not yet carry, is back-ported here as a `*.patch` file and applied to the cloned fork checkout by `../apply-patches.sh`. +CI treats both this directory and `backend/cpp/llama-cpp/` as Bonsai inputs, since +the wrapper copies and builds the shared llama.cpp backend sources. + Rules: - One upstream commit (or minimal hunk) per patch, named `NNNN-short-description.patch`. diff --git a/scripts/changed-backends.js b/scripts/changed-backends.js index eb0fb6178..732880757 100644 --- a/scripts/changed-backends.js +++ b/scripts/changed-backends.js @@ -63,6 +63,11 @@ function inferBackendPath(item) { // via a thin wrapper Makefile. Changes to either dir should retrigger it. return `backend/cpp/turboquant/`; } + if (item.dockerfile.endsWith("bonsai")) { + // bonsai is a llama.cpp fork that reuses backend/cpp/llama-cpp sources + // via a thin wrapper Makefile. Changes to either dir should retrigger it. + return `backend/cpp/bonsai/`; + } if (item.dockerfile.endsWith("privacy-filter")) { return `backend/cpp/privacy-filter/`; } @@ -119,6 +124,15 @@ function getAllBackendPaths() { const allBackendPaths = getAllBackendPaths(); +function backendChanged(backend, pathPrefix, changedFiles) { + if (changedFiles.some(file => file.startsWith(pathPrefix))) return true; + + // Fork backends reuse backend/cpp/llama-cpp sources via thin wrappers; + // changes to either directory must retrigger their pipelines. + return (backend === "turboquant" || backend === "bonsai") && + changedFiles.some(file => file.startsWith("backend/cpp/llama-cpp/")); +} + const token = process.env.GITHUB_TOKEN; const octokit = new Octokit({ auth: token }); @@ -305,7 +319,7 @@ function emitFilteredMatrix(changedFiles) { const filtered = includes.filter(item => { const backendPath = inferBackendPath(item); if (!backendPath) return false; - return changedFiles.some(file => file.startsWith(backendPath)); + return backendChanged(item.backend, backendPath, changedFiles); }); const filteredDarwin = includesDarwin.filter(item => { @@ -337,12 +351,7 @@ function emitFilteredMatrix(changedFiles) { // Per-backend boolean outputs for (const [backend, pathPrefix] of allBackendPaths) { - let changed = changedFiles.some(file => file.startsWith(pathPrefix)); - // turboquant reuses backend/cpp/llama-cpp sources via a thin wrapper; - // changes to either directory should retrigger its pipeline. - if (backend === "turboquant" && !changed) { - changed = changedFiles.some(file => file.startsWith("backend/cpp/llama-cpp/")); - } + const changed = backendChanged(backend, pathPrefix, changedFiles); fs.appendFileSync(process.env.GITHUB_OUTPUT, `${backend}=${changed ? 'true' : 'false'}\n`); } }