GeezerVison is showing github.com — [backport-0.21] engine: prune DAGQL cache by metadata size by sipsma · Pull Request #13886 · dagger/dagger
Conversation
sipsma
commented
Aug 12, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
Summary
Backports the complete metadata-aware DagQL cache-pruning behavior from #13846 to v0.21:
- tracks a coarse structural metadata estimate (
3072*results + 512*terms + 768*class slots)
- prunes cold persisted roots toward a metadata target independently of disk usage
- protects active-session and engine-lifetime/unpruneable closures
- schedules structural checks for startup, session completion, graceful shutdown, explicit GC, and the pressure monitor
- handles zero-disk metadata pressure, estimator correction, forced sparse-class compaction, and monitor no-progress blocking
- adds
gc.dagqlCache.maxEstimatedBytes / targetEstimatedBytes, the dagger_dagql_cache_metadata_estimated_bytes metric, bounded aggregate observability, tests, scale benchmarks, docs, and a v0.21.9 change entry
This bounds retained metadata growth and may mitigate scale-related symptoms. It does not claim to directly fix the reported egraphMu / startup contention.
The separate bounded manual structural-prune API discussed with Erik is intentionally not included because it was not part of #13846. The source defaults remain unchanged at 4 GiB maximum / 3 GiB target.
Source PR and commits
- Source: engine: prune DAGQL cache by metadata size #13846
- Exact source series:
615a02dbdaf6ef107f8a1dfa3c45d39624403645^..b19467f2b032bb4c000c5c80bbe21ac062ac03f5 (20 commits; parent ba839a98077aef4398415ccc805f57fd694c2e4b)
- Metadata-pruning backport series:
f021d54d4c0824061690fa4669fc39d39183d4d1^..0371e77ae8210df2f7583e2fa0ac39b08019f32f, followed by v0.21 adaptation commit 5479f384e8bff0e2d87d981838528adbe755ef2c
- CI fixture source: fix(ci): use project
deploy tokens for GitLab #13849; source PR commit 0c656b9ca6395fdec1f051d34987bb4f8864196a; merged main commit 66337ba5d3d01ae10a0d7fb97ebe4dec9326e8bc
- Proven v0.21 fixture backport:
becaa3a33542ccc7e96dbf3f430d887f41958e52, validated on [backport-0.21] fix: hide registry HTTP probe errors #13885 and initially cherry-picked unchanged as f951484dde70cd431a5e19f84027aa4eaa946367; after two byte-identical CI head refreshes, the current equivalent tip is 89af13099acc7a46885023b096b25372e32931f4 (tree 631aa606fb061a4464f838559c2569c25bb9eb9b)
All 20 metadata-pruning source commits, including the design-review history, are preserved in order with cherry-pick -x; none were squashed or omitted. The additional v0.21 adaptation and fixture-propagation commits are also DCO-signed. The fixture commit preserves Guillaume de Rouville as author and the source traceability footer.
Prerequisite
#13375's GC pressure-monitor machinery is already present on backport-0.21 as 78fc50e58a4f417825e414463829c1bc7c2053d2. Its stable patch ID matches source commit 838b7c73ab69fb5bc97cfa1139478ae7d305e4ed, so this backport relies on the existing v0.21 implementation rather than duplicating it.
v0.21 adaptations
- Preserved v0.21's existing
stateMu graceful-stop/session lifecycle and namespace-worker initialization while applying the new scheduler/config state. Main-only core.SetWorkspaceInvalidator, recursive-read-only-mount context, and a session-test field rename are absent from v0.21 and were not pulled in as unrelated changes.
- Kept the cache-pruning reference in its v0.21 location under
skills/cache-expert/references/.
- Adapted restart documentation and the large persistence benchmark from main's schema 17 to v0.21's unchanged schema 16; no persistence schema bump or worker reset was introduced.
- Adapted the active zero-disk integration workload from main's
dagger api with-session spelling to the equivalent v0.21 dagger run command.
- Added the v0.21.9 unreleased change entry with source attribution
Author: sipsma, PR: 13846.
- Added exactly the proven six-file v0.21 GitLab fixture backport from [backport-0.21] fix: hide registry HTTP probe errors #13885 with no further adaptation. It replaces revoked user PAT usage with read-only project deploy tokens and propagates each required username through the existing integration-test authentication paths; no product code or diagnostics changed.
Validation run
./dagql: 295 tests passed — pruning semantics, trigger/target correction, active/unpruneable protection, no-detail structural mode, compaction, persistence/restart, and estimator accounting. trace
./engine/server: 61 tests passed — defaults/config resolution, no-disk-stat behavior, lifecycle scheduling, pressure monitoring, blocked/no-progress recovery, explicit/session reset behavior. trace
./engine/config: compiled successfully (no package tests). trace
./cmd/engine: 7 tests passed. trace
TestEngine/TestPrometheusMetrics: 2 tests passed and observed the new metadata gauge. trace
TestLocalCache/TestDagqlMetadataGCProtectsActiveZeroDiskResults: 2 tests passed; the workload remained active through a pressure-monitor interval, produced metadata growth with only 4 KiB disk use, stayed protected while active, then closed and was structurally pruned. trace
- All seven one-shot metadata benchmarks passed at their defined 200k/1M scales: allocation-free estimate, metadata-vs-disk snapshots, full prune, four fixture calibrations, correction/churn, sparse forced compaction, and schema-16 import. The 1M import retained schema 16 and peaked at 4,526,727,168 B additional
HeapInuse; 1M metadata pruning removed all roots in ~14.7 s with ~893.8 MB peak scratch. trace
- Root Go
check-tidy passed. trace
- Historical CI on
5479f384e8bff0e2d87d981838528adbe755ef2c passed DCO and 69 Dagger Cloud contexts; five split suites failed only where GitLab rejected the revoked private-fixture PAT. base trace, call/shell trace, CLI/engine trace, container trace, modules trace.
- Canary [backport-0.21] fix: hide registry HTTP probe errors #13885 proved
becaa3a33542ccc7e96dbf3f430d887f41958e52: all 75 applicable checks passed, including all five formerly failing shards and TestPrivateGitRepoArgCaching in real CI.
- The propagated patch is byte-for-byte equivalent by stable patch ID (
c5ece8f8d50919d36bdb6abad1e312d65ae8a2bf), changed only the same six integration-test files (35 additions, 30 deletions), and passed git diff --check. Final head 89af13099acc7a46885023b096b25372e32931f4 passed all 75 applicable statuses (74 Dagger Cloud contexts plus DCO). Initial failures were trace-classified rather than dismissed: Linux/arm64 Wolfi release exited 139 (failed trace, final pass); telemetry saw a runtime-only 13.6% dropped golden suffix (failed trace, final pass); and one 441/442 module-runtime run failed during pinned Python 3.13.1 initialization (failed trace, final pass). dagger cloud rerun could not resolve the cross-fork PR or synthetic merge SHA from this runner, so the two retries used committer-timestamp-only tip refreshes, byte-identical tree checks, and explicit --force-with-lease.
- During final stewardship,
backport-0.21 advanced from 9f68624bf69c23c01861e298651656ecac780285 to 269c47d7708b4623c3fbfdcd2440d19a055dc7e0 via [backport-0.21] fix: hide registry HTTP probe errors #13885, which independently absorbed the same six-file fixture patch (stable patch ID c5ece8f8d50919d36bdb6abad1e312d65ae8a2bf) alongside its registry-observability fix. Final green synthetic merge 86bdee550d36867afd02cfdd8d44b08ccebaae79 has exact parents base 269c47d7708b4623c3fbfdcd2440d19a055dc7e0 and head 89af13099acc7a46885023b096b25372e32931f4; the retained traceable head commit merges without conflict or behavioral duplication. Upstream squash commit 49559d42c9c9dc2588dc53f834e15ea572f69ae7 has the identical tree 3821ccc63bdbed5ee821980aa6893b9eea7044be.
- GitHub's
check-for-changelog job was intentionally skipped because the PR has no needs/changelog label; the release entry is present and Dagger Cloud's changelog:generate check passed.
- Changed Go files are
gofmt-clean; git diff --check passed; all 22 commits have DCO signoff; gc: prune local cache during disk pressure #13375 prerequisite patch IDs and all 20 -x source footers were audited.
Release note
Adds .changes/unreleased/Fixed-20260812-213129.yaml for v0.21.9, attributed to source PR #13846. The GitLab fixture propagation is test-only and adds no separate release entry.
Risk and remaining work
This was published and fully validated as a draft because it is a large engine/cache backport. GitHub records sipsma as squash-merging it at 2026-08-13T02:58:09Z, after the final green run. The revoked GitLab fixture credential was addressed by propagating the exact six-file v0.21 patch proven on #13885, and the final combined-head matrix has converged green. The complete integration suite beyond the published split coverage remains unrun.
The root full-lint command was attempted but is currently blocked by unrelated generated docs snippets (default-address/go) that cannot import their generated internal package. Targeted go vet was also attempted; it reports pre-existing context-cancel findings in dagql/cache.go (blamed to aa719a10d52, before this series) and engine/server/session_attachables.go (74c2889afc6, untouched here). Those unrelated findings were not changed to keep this backport scoped.
The estimator is deliberately coarse and structural rather than RSS-based. A pre-existing oversized schema-16 graph is fully imported before the one-second startup prune, so a temporary upgrade/startup memory peak remains possible. This patch bounds retained metadata after pruning; it does not establish a direct fix for lock contention.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Lower the class-slot coefficient to 768 bytes after the required 200k churn benchmark measured the 1024-byte hypothesis at a 2.199 estimate-to-post-GC-heap ratio. The calibrated coefficient measures 1.649 while preserving the approved structural formula and keeping a common one-million-entry graph above the 4 GiB trigger.
Signed-off-by: Erik Sipsma <[email protected]>
(cherry picked from commit c81de1c)
GitLab automatically revokes user PATs when it detects that they were leaked.
That is what these private repository tests used, and both tokens were
revoked. GitLab does not document the same automatic response for project
deploy tokens.
Replace the PATs with read-only deploy tokens scoped to the test project.
Deploy tokens use a username and token pair, so pass the matching username
through each Git authentication path.
These credentials are intentionally committed for end-to-end tests. They can
only read one disposable test repository, which contains no private code or
data, so exposing them does not grant access beyond the test fixture.
Keep both credentials in the shared VCS fixture so future rotations happen in
one place. The second token is still needed to test two different credentials
for the same repository.
Signed-off-by: Guillaume de Rouville <[email protected]>
(cherry picked from commit 66337ba)
Signed-off-by: Erik Sipsma <[email protected]>
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|