[PR #15809] create: prune imported blobs and startup invalid leftovers #62012

Open
opened 2026-04-29 16:58:16 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/15809
Author: @stationeros
Created: 4/25/2026
Status: 🔄 Open

Base: mainHead: main


📝 Commits (1)

  • e8de8d9 create: prune imported blobs and startup invalid leftovers

📊 Changes

4 files changed (+131 additions, -12 deletions)

View changed files

📝 server/create.go (+36 -0)
📝 server/images.go (+11 -12)
📝 server/images_test.go (+22 -0)
📝 server/routes_create_test.go (+62 -0)

📄 Description

Solves #15803

  • Fixes the main regression from the issue body: successful safetensors imports no longer leave their uploaded source blobs behind.
  • Restores restart-time cleanup for broken temporary blob files by pruning invalid blob names before applying the recent-blob grace period.
  • Keeps the current race-avoidance behavior for valid recent blobs, so it should not undo the newer create-vs-gc protection.
  • Stays tightly scoped to create/prune behavior with focused tests.

What changed

  1. In server/create.go, defer cleanup of request Files and Adapters blobs after create completes.
    • Uses manifest.RemoveLayers(), so blobs that are referenced by any manifest are preserved.
    • This safely handles reused GGUF inputs while removing converted/replaced imports.
  2. In server/images.go, validate blob names before applying the one-hour grace period.
    • Invalid blob files like *-partial or interrupted temp uploads are removed immediately during startup prune.
    • Valid digest-named blobs still keep the grace period.
  3. Added tests for:
    • safetensors create cleanup of imported source blobs
    • immediate pruning of recent invalid blob files

🔄 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/ollama/ollama/pull/15809 **Author:** [@stationeros](https://github.com/stationeros) **Created:** 4/25/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `main` --- ### 📝 Commits (1) - [`e8de8d9`](https://github.com/ollama/ollama/commit/e8de8d9e290ec24eeed17492f5640d5a68405ce2) create: prune imported blobs and startup invalid leftovers ### 📊 Changes **4 files changed** (+131 additions, -12 deletions) <details> <summary>View changed files</summary> 📝 `server/create.go` (+36 -0) 📝 `server/images.go` (+11 -12) 📝 `server/images_test.go` (+22 -0) 📝 `server/routes_create_test.go` (+62 -0) </details> ### 📄 Description Solves #15803 - Fixes the main regression from the issue body: successful safetensors imports no longer leave their uploaded source blobs behind. - Restores restart-time cleanup for broken temporary blob files by pruning invalid blob names before applying the recent-blob grace period. - Keeps the current race-avoidance behavior for valid recent blobs, so it should not undo the newer create-vs-gc protection. - Stays tightly scoped to create/prune behavior with focused tests. What changed 1. In server/create.go, defer cleanup of request Files and Adapters blobs after create completes. - Uses manifest.RemoveLayers(), so blobs that are referenced by any manifest are preserved. - This safely handles reused GGUF inputs while removing converted/replaced imports. 2. In server/images.go, validate blob names before applying the one-hour grace period. - Invalid blob files like *-partial or interrupted temp uploads are removed immediately during startup prune. - Valid digest-named blobs still keep the grace period. 3. Added tests for: - safetensors create cleanup of imported source blobs - immediate pruning of recent invalid blob files --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-29 16:58:16 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#62012