Repository navigation
Conversation
sipsma
force-pushed
the
sipsma/dagql-removal-keeps-frame-generation
branch
from
October 30, 2026 19:02
41431cb to
fe95854
Compare
ModuleResultIDs memoizes each frame's answer for the frame generation it was computed in, and every frame replacement starts a new generation. Removing a result from the cache counted as one, since it stores a nil frame. A session's release removes hundreds of results, so on a per-package Go build every memo went stale between builds: about 430 removals per unchanged rebuild of dagger's CLI and 630 per edit, against about 20 real replacements. A removed result's ID is never registered again, so no lookup can reach another frame under it, and the answers memoized while it was registered still hold. Removal now clears the frame without starting a generation. Signed-off-by: Erik Sipsma <[email protected]>
Signed-off-by: Erik Sipsma <[email protected]>
sipsma
force-pushed
the
sipsma/dagql-removal-keeps-frame-generation
branch
from
October 30, 2026 20:53
fe95854 to
58acd65
Compare
This was referenced Oct 30, 2026
Contributor
Author
|
Superseded by #15007, which carries these commits unchanged. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Every time a session ended, the dagql cache threw away the memos keyed on its frame generation, because removing a result counted as replacing its frame. So the module-dependency memo from #14920 never survived from one build to the next. This change stops removal from starting a new generation.
Why
Cache.ModuleResultIDskeeps each frame's answer for the frame generation it was computed in. Replacing any result's frame starts a new generation, since an equivalent replacement can reference different Module results.removeResultFromEgraphLockedcleared a removed result's frame withstoreResultCall(nil), and that counted as a replacement. A session's release removes hundreds of results, mostly module type definitions that each session rebuilds, so every build ended with all memos stale.Here are the generations started per build, counted per call site on a per-package Go build of dagger's CLI with dagger/go (one c8gd.4xlarge, fresh engine):
On each edit, ~8,500 frames found a stale memo and recomputed.
How
A removed result's ID is never registered again. So no
resultCallByResultIDlookup can reach another frame under it, and the answers memoized while it was registered still hold. Removal now clears the frame withdropResultCall, which starts no generation. Clearing the frame of a result that stays registered, as stored-value pruning does, still starts one, since that row can later get a new frame.There is one behavior change. A frame held outside the cache, whose graph references a removed result by ID, now gets its memoized answer where a fresh walk would fail. A live root keeps the results it references through dependency edges, so
ModDepsForCalldoesn't reach this case.Effect
After the change, an unchanged rebuild starts no generations and an edit ~22. Those ~22 are real replacements: content digests taught to directories, and frames stored on results that aren't in the cache yet.
Build times don't change, because the memo is cheap: 0.1 ms per unchanged rebuild, and 60–110 ms per edit summed over ~3,300 calls that run in parallel. Medians in seconds, 4 runs per arm in alternating order, one c8gd.4xlarge, a fresh engine per run:
Each difference is inside its 95% interval around zero.
Testing
TestModuleResultIDsSurviveResultRemovalreleases a session, checks that its result was removed and its frame cleared, and checks that a memo computed before the release is served without recomputing. Without the change, it recomputes 3 frames and fails.