Repository navigation
Conversation
sipsma
force-pushed
the
sipsma/session-bound-results
branch
from
November 18, 2026 02:19
7523e50 to
151fe2e
Compare
A resolver could decline to persist its result, so it wasn't kept past the sessions using it. But its key still didn't name the session, so while anything else held the result, another session's lookup was served it: a second session open at the same time, or a cache usage pass, which holds every result while it measures disk usage, when the first session ended during it. BindToSession declines persistence and also makes the result usable only by the session that computed it. The result requires a handle that only that session holds, and the lookup filter that gates hits on session resources refuses it to any other session, which computes its own beside it. What is built on the result inherits the requirement. Session release drops the handle, so nothing is served the result after that. Signed-off-by: Erik Sipsma <[email protected]>
A listing whose collection's producer is cached per call, session or client declined persistence, so a later session would list the items again. But the listing's key doesn't name the session, so another session was still served it while anything held it: one open at the same time, or the next one when a cache usage pass held the listing past its session's end. That session then planned its checks from items its own producer never returned, and checking one failed with "does not contain key". Bind such a listing to its session, so every other session lists the items its own producer returns. Signed-off-by: Erik Sipsma <[email protected]>
A failed check's run declined persistence so the next session runs the check again. But its key doesn't name the session, so while anything held the run another session was served it: one open at the same time, or the next one when a cache usage pass held the run past its session's end. That session reported the old failure without running the check. Bind a failed run to its session, so every other session runs the check again. Signed-off-by: Erik Sipsma <[email protected]>
When a computation finished and its recipe already had a live entry, its publication adopted that entry and dropped the new value. A value bound to its session is that session's own outcome, though: a check that failed in one session while another session's run of it passed would have reported the pass. A bound value now registers beside the live entry, not indexed, as a value does when its session doesn't cover the entry's requirements, and its session hits it from then on. Signed-off-by: Erik Sipsma <[email protected]>
A bound value that registered beside another session's live entry of its recipe was still not what its session's next lookup returned: lookup takes the first candidate the session may use, by result number, and the other session's older entry came first. A session whose check failed while another's run of it passed would have got the pass on its next request. A lookup now returns a candidate bound to the session when there is one. Only the session holds its handle, so a bound candidate it may use is its own. Once a usable candidate is found, unbound ones are skipped without checking them, so lookups of results nothing binds cost what they did. Signed-off-by: Erik Sipsma <[email protected]>
A value bound to its session can be saved, or sent to another cache, as the dependency of an entry that is kept: a cached module function can return an object holding a failed check, for example. Its record carried the decline mark but not the binding, so after a restart, or in the receiving cache, the value came back unbound and a later session was served the old failure. The record now carries the binding. Restore, and both ways a merge installs a record, put it back on the entry, where it names a session that holds no handle there, so no session is served the value or what is built on it. Dropping a stored value drops it with the value. Signed-off-by: Erik Sipsma <[email protected]>
A merge could drop a bound value's record for an unbound entry the receiving cache already held for its recipe, and point what was built on it at that entry, which no binding restricts. And a cache that restored an imported bound record cleared the binding from its envelope, so a record it later sent from that entry went out unbound. A bound value is no use to another cache, where its session doesn't exist, and what is built on it shares its binding. A transfer now leaves out every root whose closure reaches one, and a restored entry's envelope keeps its binding. Signed-off-by: Erik Sipsma <[email protected]>
…g it busy Signed-off-by: Erik Sipsma <[email protected]>
Its signature gained the test when the Go modules moved to the per-package build; the new subtest called it the old way. Signed-off-by: Erik Sipsma <[email protected]>
sipsma
force-pushed
the
sipsma/session-bound-results
branch
from
November 19, 2026 23:31
b8c8574 to
cf56f5d
Compare
Contributor
Author
|
Everything this held is carried in #15273, which brings together the engine side of the remote cache: all nine commits are there, eight with identical patches and one ( |
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.
What users see today
Two kinds of result were meant never to be reused by another session, but sometimes were:
dagger checkcould be planned from another session's items, and then fail withcollection "..." does not contain key "..." in the current subset. This is the intermittent failure ofTestCheckPlanningFromGitAcrossSessions/items_of_a_collection_cached_per_session_are_checked_againin CI.Both results only declined persistence. That kept them off disk, but their cache keys don't name the session, so another session was served them whenever something else still held them. Two things did:
The change
dagql.BindToSessiondeclines persistence, and also makes the result usable only by the session that computed it. The result requires a handle that only that session holds. The same lookup filter that gates hits on secrets and sockets then refuses it to every other session, which computes its own. Results built on it inherit the requirement, and releasing the session drops the handle.Listings whose producers are cached across sessions, and passing checks, stay shared and kept as before (#15080).
Tests
TestChecks/TestCheckPlanningFromGitAcrossSessionsrundagger checkin the test's own session, which stays open, then again in a new session. One checks a per-session collection, the other a failing check. Both fail on main and pass with this change, with no dependence on timing.Performance
Fresh-engine
dagger check -lof dagger/dagger, followed by the same listing in a new session. 15 interleaved pairs against main, on one machine:The second-listing difference is within run-to-run spread: the per-pair difference has a median of +14 ms and a mean of −39 ms. The listing is still reused across sessions, and all 60 runs produced identical output.