Skip to content

feat(storage): adapt rollback retention and build caches to disk capacity - #1351

Merged
Hydralerne merged 3 commits into
mainfrom
feat/automatic-artifact-retention-20261019
Oct 19, 2026
Merged

Hydralerne merged 3 commits into
mainfrom
feat/automatic-artifact-retention-20261019

Conversation

@Hydralerne

Copy link
Copy Markdown
Member

Problem

Count-only rollback retention can keep disposable release artifacts while builds and running apps compete for the same disk. Small Cloud spaces also inherit the same fixed build-cache ceiling as larger filesystems.

Behavior

  • Inherited project retention is Automatic, keeping up to the existing instance default (five past releases initially). Explicit project counts and pins remain authoritative.
  • During the existing locked retention reconciliation, a Docker filesystem below the 20% free-space target may reclaim older eligible artifacts, oldest first within each project. Projects on the same host observe that filesystem’s current free space. Re-measure after each successful release cleanup; do not add shared Docker image sizes and claim those bytes were freed.
  • The existing restore planner must establish a Git commit/configuration rebuild or immutable registry recovery path. Upload-only, missing-config and legacy-redacted releases are preserved. The existing purge implementation remains the only removal path, and its archive marker is cleared only after successful cleanup.
  • Preserve active/pinned/reconciling releases and shared artifact references. Defer while builds or role handovers own the project. Pressure cleanup never stops/removes containers or volumes, and only selects generated images verified by project labels or managed static release files.
  • Verify that each historical release resolves to the same stable host as the measured runtime. Use that exact verified connection for removal and the owned executor for fresh disk reads. A repointed server alias cannot redirect the operation between verification and cleanup. Socket-based local Docker measurements reuse the existing pooled host channel; a remote runtime without its own executor defers pressure cleanup.
  • Scale managed idle-cache retention down to 10% of the filesystem, capped at the existing 5 GiB ceiling. Configure project BuildKit workers with that ceiling and a native 20% free-space GC target. Active/attached/command-protected cache state remains excluded from reclamation.
  • Reuse the shared project/wizard controls and existing nullable rollback override to explain Automatic mode and allow returning to it. Keep commit/configuration history and the normal rebuild/reacquisition rollback flow.

There are no migrations, new endpoints, cleanup workers, billing changes, daemon rewrites, CPU/RAM cap changes or production operations. Other runtimes retain their existing count policy. Cleanup targets are not filesystem quotas and cannot reclaim active build layers or guarantee a large build will fit.

Validation

  • 14 regression cases fail with main’s original retention orchestrator, then pass with the feature.
  • Focused retention tests cover actual free-space recovery, shared service images, pins, reconciling/legacy releases, missing/redacted/upload configuration, immutable registry sources, static files, old/unverified hosts, in-flight work and cleanup failures. A separate regression verifies fresh reads through an already-owned executor without re-resolving the server alias. Additional safety regressions fail before legacy-reference normalization and local-channel selection, then pass afterward. They cover protected container/role references, unowned images, local hosts without server aliases and remote runtimes without executors.
  • Existing cache ownership/attachment/command protections run alongside a small-filesystem cache-budget regression.
  • Shared UI tests cover the automatic label and resetting a fixed count to the existing nullable override.
  • bun run test: 11 workspace tasks passed, including 9,564 API, 5,121 adapter and 3,587 dashboard tests.
  • API, dashboard, platform and adapters TypeScript checks: passed.
  • bun run build:sdk: SDK, CLI, native/server assets and declarations verified.
  • bun run docs:check: 214 pages, 512 MCP tools, 634 SDK methods / 824 HTTP routes, 692 CLI command paths, 310 CLI examples and 131 SDK examples passed.
  • Structured error-boundary audit and git diff --check: passed.
  • Localization keys remain complete; all new prose is translated. The localization checker still exits 1 for the repository’s existing 510 untranslated-value warnings; the before/after warning set is unchanged (no missing/extra keys or new untranslated warnings).

Closes #1346

@Hydralerne
Hydralerne merged commit 5be2572 into main Oct 19, 2026
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Improvement] Adapt automatic rollback retention to available storage

1 participant