Repository navigation
dagql: defer session release until in-flight operations finish - #13940
Merged
Merged
Conversation
sipsma
force-pushed
the
sipsma/remote-cache-track4-deferred-release
branch
from
August 21, 2026 19:22
4dddcf0 to
7693ac9
Compare
This was referenced Aug 24, 2026
sipsma
force-pushed
the
sipsma/remote-cache-track4-deferred-release
branch
from
August 26, 2026 04:30
e8e6e3b to
5709595
Compare
sipsma
force-pushed
the
sipsma/remote-cache-track4-deferred-release
branch
from
August 26, 2026 04:30
5709595 to
dfaab9d
Compare
sipsma
force-pushed
the
sipsma/remote-cache-track4-deferred-release
branch
from
August 27, 2026 02:10
dfaab9d to
5fafb10
Compare
sipsma
force-pushed
the
sipsma/remote-cache-track4-deferred-release
branch
from
August 30, 2026 19:38
5fafb10 to
2d1f7c9
Compare
sipsma
force-pushed
the
sipsma/remote-cache-track4-deferred-release
branch
from
September 3, 2026 22:16
2d1f7c9 to
d81560e
Compare
Base automatically changed from
sipsma/remote-cache-track3-lazy-retry
to
main
September 3, 2026 23:05
Signed-off-by: Erik Sipsma <[email protected]>
Signed-off-by: Erik Sipsma <[email protected]>
Signed-off-by: Erik Sipsma <[email protected]>
Numeric result IDs are engine-lifetime unique, so the four e-graph mutation helpers' lock-time guards can ask whether the caller's result ID is still registered instead of comparing registry pointers. This removes the last registry pointer-identity comparisons in dagql production code. Signed-off-by: Erik Sipsma <[email protected]>
The two telemetry span writers took sessionMu without checking the session tombstone, unlike the five sibling per-session map writers, which all refuse released sessions. A span write landing after release cleanup would recreate per-session map entries that nothing ever deletes again, since session IDs are single-use. With this layer's operation accounting, every current caller of these writers runs inside a counted operation, and cleanup is deferred until the last operation exits, so no current path writes after cleanup. The guards are defense in depth: they keep these writers safe independent of future token coverage, and they close the window outright for any engine running the earlier session-lifecycle layers without this one. Signed-off-by: Erik Sipsma <[email protected]>
Both cleanup reviewers audited invariant coverage against enabled machinery and converged on the same gaps. Every addition is an invariant line on an existing configuration; no model state changes. - lazy_import gains ReturnedLive, NoUnderflow, and LazyAttemptDefersCollection: it is the only configuration combining release, lazy work, import, and flush, and it previously gated none of the return-boundary or token-deferral properties. - Every release-enabled configuration now checks ReturnedLive, which this layer's late refusal makes hold everywhere. - drain_escape and lazy_release gain OwnershipExact; both run the deferred-cleanup cascade. - lazy_release gains EvalDoneComplete, LazyCompleteSettled, and LazyMutualExclusion, matching the other lazy safety gates. All fourteen widened configurations pass. Signed-off-by: Erik Sipsma <[email protected]>
tla-check gains One: run a single TLC configuration through the same pinned jar and invocation as the CacheLifecycle check, returning the raw TLC output with no expectation applied. An optional invariant replaces the configuration's INVARIANTS line (safety-only, PROPERTY dropped), and an optional define appends a scratch operator to the spec, so reachability probes and red-proof runs go through Dagger instead of a host-side jar. Signed-off-by: Erik Sipsma <[email protected]>
sipsma
force-pushed
the
sipsma/remote-cache-track4-deferred-release
branch
from
September 3, 2026 23:05
d81560e to
f6f4856
Compare
|
will this be backported to 0.26? Its hitting us quite hard (clogging up shared engine) |
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.
Summary
The dagql cache could not see its own in-flight work. Session release could therefore collect a result after a cache operation claimed it but before that operation returned, including work from detached executors that the server handler drain cannot count. The same gap allowed shutdown persistence to observe transient publication ownership.
This is layer four of the cache-remediation stack and depends on #13938, #13936, and #13934.
Design
Contract and cost
Model
The TLA+ model now faithfully represents operation admission and exit, deferred release, shutdown quiescence, and lazy callback attempt tokens, layered over the current two-stage lazy attempt model (callback body, then cache-side bookkeeping). The four former expected-failure configurations for release-in-flight, drain escape, flush-in-flight, and flush-with-drain are strengthened green gates, with a conditional liveness property that assigned cleanup eventually completes. A new lazy_release configuration gates callback-token deferral.
Invariant coverage was widened after review: every release-enabled configuration now checks the live-return property, and the lazy_import configuration (the only one combining release, lazy work, import, and flush) gates the return-boundary and token-deferral properties.
All 25 configurations are green. A one-time exhaustive three-evaluator run of the lazy configuration also passed, at 78,792,507 distinct states; the configuration stays at two evaluators for CI cost.
Validation
go test ./dagql -count=1go test ./engine/server -count=1go test -race ./dagqlcoverage for operation counting, deferred release, lazy callback lifetime, arbitrary-value cleanup, shutdown cancellation, and released-session span capturego vet ./dagql ./engine/server— the dagql package was clean; engine/server reported one pre-existing unrelated context-cancel findingdagger check tla-check:cache-lifecycle— 25 configurations greendagger check dagger-go-sdk:generateNo integration test suite was run.