Skip to content

fix(vram): persist remote probe metadata - #11487

Open
localai-org-maint-bot wants to merge 4 commits into
masterfrom
bot/issue-11483-persistent-vram-cache
Open

fix(vram): persist remote probe metadata#11487
localai-org-maint-bot wants to merge 4 commits into
masterfrom
bot/issue-11483-persistent-vram-cache

Conversation

@localai-org-maint-bot

Copy link
Copy Markdown
Collaborator

Description

This PR fixes #11483.

The gallery startup warmer previously rebuilt process-memory-only size and GGUF metadata caches after every restart. Successful HTTP(S) probes now persist for 24 hours under the LocalAI cache directory, so frequent restarts reuse them.

The persistent cache:

  • bypasses local model files
  • keeps at most 4,096 entries
  • uses atomic, versioned records without storing source URLs
  • rejects corrupt or incomplete records and falls back to the remote probe
  • purges records when the gallery changes
  • rejects stale in-flight writes that finish after invalidation

The VRAM management documentation now describes persistence, expiry, and the entry limit.

Notes for Reviewers

Verification:

  • go test -count=1 ./pkg/vram
  • go test -count=1 ./core/application
  • go test -count=1 ./core/gallery -ginkgo.focus="refresh|cached gallery"
  • go test -race -count=1 ./pkg/vram
  • go vet ./pkg/vram ./core/gallery ./core/application
  • git diff --check

The full core/gallery suite also ran 375 passing specs; three unrelated network-dependent specs failed because GitHub raw/gist requests return HTTP 403 in this environment.

Signed commits

  • Yes, I signed my commits.
  • Documentation updated (docs/content/) for user-facing changes, or not applicable

@mmelvin0

Copy link
Copy Markdown

Does it make sense to either add an option to disable this entirely (at startup) or if the existing LOCALAI_AUTOLOAD_GALLERIES is set to false?

@mudler

mudler commented Aug 13, 2026

Copy link
Copy Markdown
Owner

Does it make sense to either add an option to disable this entirely (at startup) or if the existing LOCALAI_AUTOLOAD_GALLERIES is set to false?

it does indeed make sense. @localai-org-maint-bot update the PR, incorporate the feedback, and also add a runtime toggle wired in the setting section of the webui

@localai-org-maint-bot

Copy link
Copy Markdown
Collaborator Author

Implemented and pushed in 998f40ec3.

  • Added a Persist remote VRAM estimates runtime toggle under Settings > Galleries.
  • Added --vram-persistent-cache / LOCALAI_VRAM_PERSISTENT_CACHE (default: true).
  • autoload_galleries=false now suppresses both startup warming and persistent-cache setup.
  • Runtime changes take effect immediately and keep in-memory estimation available when disk persistence is off.
  • Updated the VRAM, runtime-settings, and CLI docs.

Verified with go test ./pkg/vram ./core/config, the focused Settings endpoint suite, focused UI ESLint, the inline-style gate, and a production UI build. The full endpoint package additionally needs rootless Docker for its unrelated node/Postgres specs.

@mudler

mudler commented Aug 13, 2026

Copy link
Copy Markdown
Owner

@localai-org-maint-bot we want also a toggle to disable automatic loading and pre-warm on boot

The startup warmer repeated remote size and GGUF metadata probes after every restart because both caches lived only in memory. Store successful HTTP probes for 24 hours so frequent restarts reuse the prior results.

Bound the cache, reject invalid records, and purge it when gallery data changes. Local model files continue to bypass persistence.

Assisted-by: Codex:gpt-5
The lint gate rejects the unchecked cleanup call in the persistent cache writer.

Assisted-by: Codex:gpt-5.6 [golangci-lint]
Remote metadata probes can transfer enough data that operators need
control over disk reuse and startup warming. Gallery autoload now gates
both behaviors, and the runtime setting applies changes immediately.

Assisted-by: Codex:gpt-5
The existing gallery autoload setting also gates the startup metadata warmer. Name both effects in Settings so operators can find the requested boot control.

Assisted-by: Codex:gpt-5
@localai-org-maint-bot
localai-org-maint-bot force-pushed the bot/issue-11483-persistent-vram-cache branch from 998f40e to 99c80d5 Compare August 13, 2026 23:02
@localai-org-maint-bot

Copy link
Copy Markdown
Collaborator Author

Implemented and pushed in 99c80d5d2.

The existing autoload_galleries control already gates both gallery loading and metadata pre-warming at boot. I renamed its Settings toggle to Load and pre-warm galleries on boot, clarified the behavior in the description and runtime-settings docs, and added a focused UI regression test.

@mudler mudler self-assigned this Aug 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

WarmEstimateCache fetches > 1 GB every start

3 participants