[GH-ISSUE #2734] [Issue]: REGRESSION (#2730) — sidecar launched with --embeddings breaks ALL local chat generation (llama.cpp backend non-functional) #1374

Closed
opened 2026-10-21 05:32:36 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @kolacheee on GitHub (Jun 21, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/2734

Originally assigned to: @SpicyMarinara on GitHub.

Summary

Regression introduced by #2730 — release-blocker. As part of fixing #2718 (local sidecar embeddings), buildLlamaArgs now appends --embeddings --pooling mean to every llama-server launch. But that single server is the only sidecar server, and it also serves chat. With --embeddings + a non-none pooling type, llama.cpp's llama-server runs in embedding mode and rejects /v1/chat/completions and /completions. The net effect is that all local-model generation is broken on the default desktop (llama.cpp) backend in v2.0.0: local trackers, game scene/asset analysis, and the in-app Local AI Model → Test Message all fail on the first real request.

This is the same shared server, so adding the embedding flags to fix the embed path broke the much larger chat path. The fix for #2718 needs to not co-locate embeddings and chat on one pooled server.

How it degrades the UX

A user running the bundled local model (no API key — the entire reason the sidecar exists) downloads the curated GGUF, the server boots and reports ready (the readiness probe only hits /health), and then every message / tracker / scene-analysis request fails. The headline "run a model locally" feature is non-functional out of the box.

Steps to replicate

  1. Use the llama.cpp (desktop) sidecar backend with the curated default model (unsloth/gemma-4-E2B-it GGUF — a generative model, not an embedding model).
  2. Start the local model; it reaches ready.
  3. Open Local AI Model → Test Message (or send any chat turn / trigger a local tracker / game scene analysis).
  4. The request fails — llama-server refuses completions because it was launched in embedding mode.

Code trace (staging)

  • packages/server/src/services/sidecar/sidecar-launch-plan.ts:40 — args.push("--embeddings", "--pooling", "mean"); is unconditional (added by #2730, commit be161eea). Verified: it runs on every buildLlamaArgs call.
  • Single shared server: packages/server/src/services/sidecar/sidecar-process.service.ts:643 spawns exactly one llama-server; baseUrl is reused for everything.
  • Chat path hits the same server: packages/server/src/services/sidecar/sidecar-inference.service.ts:234 POSTs ${baseUrl}/v1/chat/completions (consumed by runTrackerPrompt, analyzeScene, runTestMessage); LocalSidecarProvider chat delegates to the same base URL.
  • Readiness only probes /health (sidecar-process.service.ts waitForReady), so the server boots "ready" and the failure surfaces only on the first completion request.
  • Per the llama.cpp llama-server README, --embeddings restricts the server to embedding use; with mean/cls/last pooling the server uses non-causal attention and completion requests are rejected.

Note: the disabling behavior comes from --embeddings (with a non-none pooling), not from --pooling mean in isolation.

Suggested fix

Do not serve embeddings and chat from the same pooled server. Any of:

  1. Separate embed server — spin up a short-lived second llama-server with --embeddings on its own port, used only by the embed path; keep the chat server free of the flag. (Cleanest; matches the intent of #2718.)
  2. --pooling none — a single server launched with --embeddings --pooling none keeps causal attention and recent llama-server still answers /v1/embeddings, so chat keeps working. (Smallest change; verify the bundled runtime build serves embeddings with none.)
  3. Gate the flags to embedding-only launches.

Also harden waitForReady to do a minimal completion probe (not just /health) so a chat-disabled server is caught at startup rather than on first use.

Template checklist

  • pnpm check passes (TypeScript + ESLint)
  • Manually verify Local AI Model → Test Message succeeds on the llama.cpp backend
  • Manually verify /v1/embeddings still returns vectors on the llama.cpp backend (the #2718 fix still holds)
  • Manually verify a local tracker run and a game-mode scene analysis both produce output locally

Found by a post-merge verification sweep of #2730 against the merged staging tree; regression confirmed by direct read at the cited file:line. Box left unchecked for human verification.

Originally created by @kolacheee on GitHub (Jun 21, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/2734 Originally assigned to: @SpicyMarinara on GitHub. ## Summary **Regression introduced by #2730 — release-blocker.** As part of fixing #2718 (local sidecar embeddings), `buildLlamaArgs` now appends `--embeddings --pooling mean` to **every** llama-server launch. But that single server is the *only* sidecar server, and it also serves chat. With `--embeddings` + a non-`none` pooling type, llama.cpp's `llama-server` runs in embedding mode and **rejects `/v1/chat/completions` and `/completions`**. The net effect is that **all local-model generation is broken** on the default desktop (llama.cpp) backend in v2.0.0: local trackers, game scene/asset analysis, and the in-app *Local AI Model → Test Message* all fail on the first real request. This is the same shared server, so adding the embedding flags to fix the embed path broke the much larger chat path. The fix for #2718 needs to **not co-locate embeddings and chat on one pooled server**. ## How it degrades the UX A user running the bundled local model (no API key — the entire reason the sidecar exists) downloads the curated GGUF, the server boots and reports **ready** (the readiness probe only hits `/health`), and then every message / tracker / scene-analysis request fails. The headline "run a model locally" feature is non-functional out of the box. ## Steps to replicate 1. Use the llama.cpp (desktop) sidecar backend with the curated default model (`unsloth/gemma-4-E2B-it` GGUF — a generative model, not an embedding model). 2. Start the local model; it reaches **ready**. 3. Open *Local AI Model → Test Message* (or send any chat turn / trigger a local tracker / game scene analysis). 4. The request fails — llama-server refuses completions because it was launched in embedding mode. ## Code trace (staging) - `packages/server/src/services/sidecar/sidecar-launch-plan.ts:40` — `args.push("--embeddings", "--pooling", "mean");` is **unconditional** (added by #2730, commit `be161eea`). Verified: it runs on every `buildLlamaArgs` call. - Single shared server: `packages/server/src/services/sidecar/sidecar-process.service.ts:643` spawns exactly one llama-server; `baseUrl` is reused for everything. - Chat path hits the same server: `packages/server/src/services/sidecar/sidecar-inference.service.ts:234` POSTs `${baseUrl}/v1/chat/completions` (consumed by `runTrackerPrompt`, `analyzeScene`, `runTestMessage`); `LocalSidecarProvider` chat delegates to the same base URL. - Readiness only probes `/health` (`sidecar-process.service.ts` `waitForReady`), so the server boots "ready" and the failure surfaces only on the first completion request. - Per the llama.cpp `llama-server` README, `--embeddings` restricts the server to embedding use; with mean/cls/last pooling the server uses non-causal attention and completion requests are rejected. > Note: the disabling behavior comes from `--embeddings` (with a non-`none` pooling), not from `--pooling mean` in isolation. ## Suggested fix Do **not** serve embeddings and chat from the same pooled server. Any of: 1. **Separate embed server** — spin up a short-lived second llama-server with `--embeddings` on its own port, used only by the embed path; keep the chat server free of the flag. (Cleanest; matches the intent of #2718.) 2. **`--pooling none`** — a single server launched with `--embeddings --pooling none` keeps causal attention and recent `llama-server` still answers `/v1/embeddings`, so chat keeps working. (Smallest change; verify the bundled runtime build serves embeddings with `none`.) 3. **Gate the flags** to embedding-only launches. Also harden `waitForReady` to do a minimal completion probe (not just `/health`) so a chat-disabled server is caught at startup rather than on first use. ## Template checklist - [ ] `pnpm check` passes (TypeScript + ESLint) - [ ] Manually verify *Local AI Model → Test Message* succeeds on the llama.cpp backend - [ ] Manually verify `/v1/embeddings` still returns vectors on the llama.cpp backend (the #2718 fix still holds) - [ ] Manually verify a local tracker run and a game-mode scene analysis both produce output locally --- _Found by a post-merge verification sweep of #2730 against the merged `staging` tree; regression confirmed by direct read at the cited file:line. Box left unchecked for human verification._
bsakaguchi 2026-10-21 05:32:36 +07:00
  • closed this issue
  • added the
    in-pr
    label
Author
Owner

@SpicyMarinara commented on GitHub (Jun 21, 2026):

Addressed in PR #2747.

<!-- gh-comment-id:4763115401 --> @SpicyMarinara commented on GitHub (Jun 21, 2026): Addressed in PR #2747.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#1374
No description provided.