[PR #6702] [MERGED] feat(sidecar): load existing GGUF files and control KV cache #7292

Closed
opened 2026-10-23 04:18:20 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/6702
Author: @SpicyMarinara
Created: 9/26/2026
Status: ✅ Merged
Merged: 9/26/2026
Merged by: @SpicyMarinara

Base: staging ← Head: codex/local-gguf-6675


📝 Commits (5)

  • fd5b70a feat(sidecar): configure existing GGUF files and KV cache types
  • f87ce38 feat(sidecar): select local GGUFs and report runtime allocations
  • 49beffe Merge remote-tracking branch 'origin/staging' into codex/local-gguf-6675
  • 4974948 Merge remote-tracking branch 'origin/staging' into codex/local-gguf-6675
  • b5f6fde test(sidecar): prove existing local model rate limit

📊 Changes

13 files changed (+707 additions, -29 deletions)

View changed files

📝 CHANGELOG.md (+1 -0)
➕ e2e/sidecar-local-gguf.e2e.ts (+93 -0)
📝 packages/client/src/components/modals/ModelDownloadModal.tsx (+120 -15)
📝 packages/client/src/localization/locales/en.json (+17 -2)
📝 packages/client/src/stores/sidecar.store.ts (+5 -0)
📝 packages/server/src/routes/sidecar.routes.ts (+52 -4)
➕ packages/server/src/services/sidecar/sidecar-gpu-memory.ts (+31 -0)
📝 packages/server/src/services/sidecar/sidecar-launch-plan.ts (+5 -0)
📝 packages/server/src/services/sidecar/sidecar-model-files.ts (+28 -1)
📝 packages/server/src/services/sidecar/sidecar-model.service.ts (+85 -7)
📝 packages/server/src/services/sidecar/sidecar-process.service.ts (+11 -0)
📝 packages/shared/src/types/sidecar.ts (+14 -0)
➕ scripts/regressions/sidecar-local-gguf.regression.ts (+245 -0)

📄 Description

Linked issue

Closes #6675

Why this change

An existing GGUF should be usable without downloading another copy, and local-model users need control over KV-cache memory and a useful view of loaded allocations.

What changed

  • Select an absolute GGUF path on the server device. Validate the main-model filename and GGUF header, use the file in place, and preserve it when switching/removing the selection. Borrowed files cannot be overwritten by a later download to the same path.
  • Add f16, q8_0 and q4_0 cache choices to existing runtime settings. Preserve f16 launch defaults; quantized caches set both K/V types and enable Flash Attention.
  • Read GPU weights, KV and compute/output allocations from the current llama.cpp process logs. Show missing measurements as unavailable and totals only when all categories are reported; Metal uses shared memory. No new polling, GPU probe, or model call.
  • Serialize model selection with the existing download stream, restore the current runtime after a failed selection, and persist configuration by rename before accepting a new local selection.

Validation

Passed pnpm check, the agent-runtime regression, the focused local-GGUF regression, seven UI smoke cases, and desktop Chromium/mobile Chromium/mobile WebKit coverage. Rechecked server types after review fixes and the desktop browser after the final draft-reset fix; inspected light desktop and dark mobile screenshots.

The focused regression covers persisted selection across restart, invalid and symlinked projector paths, preserving borrowed files, failed config persistence, download collisions and concurrent selection, recovery when a file disappears during shutdown, unchanged f16 arguments, quantized launch flags, and CPU/GPU/Metal allocation parsing. Browser proof covers mocked runtime status, KV selection, late-loaded paths, preserving edited drafts, failed selection and successful selection.

Local CodeRabbit completed three reviews: four initial findings, three follow-up findings, and one final draft-reset finding. All eight were addressed and validated; none were dismissed.

The new route also passed a regression through the existing privileged-sidecar limiter: request 21 receives HTTP 429. CodeQL alert 568 was dismissed as a false positive because the global hook already enforces this rule before authorization.

No real GPU/model inference or live model download was performed. The displayed figures estimate allocations reported by llama.cpp; they are not free-VRAM measurements and exclude driver overhead/other applications.

  • Manually load an existing GGUF on the server device, restart Engine, and remove the selection while confirming the source file remains intact.
  • Manually verify q8_0/q4_0 on the intended GPU/model and inspect the runtime allocation figures after loading.
  • Manually inspect the controls in the preferred desktop/mobile theme.

Docs and release impact

Unreleased changelog entry and localized in-app guidance included. No version bump or docs-tree changes.

Summary by CodeRabbit

  • New Features
    • Select an existing GGUF model file on your device without importing or copying it into the app.
    • Choose an f16, q8_0, or q4_0 KV-cache type for local llama.cpp models. Changing this setting may require a restart.
    • View reported GPU memory allocations for model weights, cache, and other buffers after the runtime is ready; readings may not always be available.
    • Setup guidance now explains local GGUF selection and runtime differences on Apple Silicon.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/6702 **Author:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Created:** 9/26/2026 **Status:** ✅ Merged **Merged:** 9/26/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `codex/local-gguf-6675` --- ### 📝 Commits (5) - [`fd5b70a`](https://github.com/Pasta-Devs/Marinara-Engine/commit/fd5b70af0773316a59cd40bcd8839377e721a20f) feat(sidecar): configure existing GGUF files and KV cache types - [`f87ce38`](https://github.com/Pasta-Devs/Marinara-Engine/commit/f87ce38f2ffb478575134287f90cff4b760acde9) feat(sidecar): select local GGUFs and report runtime allocations - [`49beffe`](https://github.com/Pasta-Devs/Marinara-Engine/commit/49beffe5e08c288d94b36c31313aa03da7fa7a42) Merge remote-tracking branch 'origin/staging' into codex/local-gguf-6675 - [`4974948`](https://github.com/Pasta-Devs/Marinara-Engine/commit/49749481ff77265446ecbe3f65d83bf9c34258b1) Merge remote-tracking branch 'origin/staging' into codex/local-gguf-6675 - [`b5f6fde`](https://github.com/Pasta-Devs/Marinara-Engine/commit/b5f6fde4fa744c145430ad0cd17ff2c9bbcbc9c7) test(sidecar): prove existing local model rate limit ### 📊 Changes **13 files changed** (+707 additions, -29 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+1 -0) ➕ `e2e/sidecar-local-gguf.e2e.ts` (+93 -0) 📝 `packages/client/src/components/modals/ModelDownloadModal.tsx` (+120 -15) 📝 `packages/client/src/localization/locales/en.json` (+17 -2) 📝 `packages/client/src/stores/sidecar.store.ts` (+5 -0) 📝 `packages/server/src/routes/sidecar.routes.ts` (+52 -4) ➕ `packages/server/src/services/sidecar/sidecar-gpu-memory.ts` (+31 -0) 📝 `packages/server/src/services/sidecar/sidecar-launch-plan.ts` (+5 -0) 📝 `packages/server/src/services/sidecar/sidecar-model-files.ts` (+28 -1) 📝 `packages/server/src/services/sidecar/sidecar-model.service.ts` (+85 -7) 📝 `packages/server/src/services/sidecar/sidecar-process.service.ts` (+11 -0) 📝 `packages/shared/src/types/sidecar.ts` (+14 -0) ➕ `scripts/regressions/sidecar-local-gguf.regression.ts` (+245 -0) </details> ### 📄 Description ## Linked issue Closes #6675 ## Why this change An existing GGUF should be usable without downloading another copy, and local-model users need control over KV-cache memory and a useful view of loaded allocations. ## What changed - Select an absolute GGUF path on the server device. Validate the main-model filename and GGUF header, use the file in place, and preserve it when switching/removing the selection. Borrowed files cannot be overwritten by a later download to the same path. - Add f16, q8_0 and q4_0 cache choices to existing runtime settings. Preserve f16 launch defaults; quantized caches set both K/V types and enable Flash Attention. - Read GPU weights, KV and compute/output allocations from the current llama.cpp process logs. Show missing measurements as unavailable and totals only when all categories are reported; Metal uses shared memory. No new polling, GPU probe, or model call. - Serialize model selection with the existing download stream, restore the current runtime after a failed selection, and persist configuration by rename before accepting a new local selection. ## Validation Passed `pnpm check`, the agent-runtime regression, the focused local-GGUF regression, seven UI smoke cases, and desktop Chromium/mobile Chromium/mobile WebKit coverage. Rechecked server types after review fixes and the desktop browser after the final draft-reset fix; inspected light desktop and dark mobile screenshots. The focused regression covers persisted selection across restart, invalid and symlinked projector paths, preserving borrowed files, failed config persistence, download collisions and concurrent selection, recovery when a file disappears during shutdown, unchanged f16 arguments, quantized launch flags, and CPU/GPU/Metal allocation parsing. Browser proof covers mocked runtime status, KV selection, late-loaded paths, preserving edited drafts, failed selection and successful selection. Local CodeRabbit completed three reviews: four initial findings, three follow-up findings, and one final draft-reset finding. All eight were addressed and validated; none were dismissed. The new route also passed a regression through the existing privileged-sidecar limiter: request 21 receives HTTP 429. CodeQL alert 568 was dismissed as a false positive because the global hook already enforces this rule before authorization. No real GPU/model inference or live model download was performed. The displayed figures estimate allocations reported by llama.cpp; they are not free-VRAM measurements and exclude driver overhead/other applications. - [ ] Manually load an existing GGUF on the server device, restart Engine, and remove the selection while confirming the source file remains intact. - [ ] Manually verify q8_0/q4_0 on the intended GPU/model and inspect the runtime allocation figures after loading. - [ ] Manually inspect the controls in the preferred desktop/mobile theme. ## Docs and release impact Unreleased changelog entry and localized in-app guidance included. No version bump or docs-tree changes. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Select an existing GGUF model file on your device without importing or copying it into the app. * Choose an f16, q8_0, or q4_0 KV-cache type for local llama.cpp models. Changing this setting may require a restart. * View reported GPU memory allocations for model weights, cache, and other buffers after the runtime is ready; readings may not always be available. * Setup guidance now explains local GGUF selection and runtime differences on Apple Silicon. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-23 04:18:20 +07:00
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#7292
No description provided.