Repository navigation
core: read cache-evidence frame facts without cloning the frame - #14627
Merged
Merged
Conversation
sipsma
added a commit
to sipsma/dagger
that referenced
this pull request
Oct 10, 2026
Signed-off-by: Erik Sipsma <[email protected]>
vito
approved these changes
Oct 13, 2026
sipsma
added a commit
to sipsma/dagger
that referenced
this pull request
Oct 13, 2026
Signed-off-by: Erik Sipsma <[email protected]>
sipsma
added a commit
to sipsma/dagger
that referenced
this pull request
Oct 14, 2026
Signed-off-by: Erik Sipsma <[email protected]>
sipsma
added a commit
to sipsma/dagger
that referenced
this pull request
Oct 14, 2026
Signed-off-by: Erik Sipsma <[email protected]>
recordCacheEvidence runs at the end of every recorded call span and read the output content digest and type name through ResultCall, which clones the frame's whole recipe DAG. On a long receiver chain that clone dominated the function: 207 allocations per call for a 32-step chain. Read both facts from the shared frame, which is immutable once stored, via a new dagql.ResultFrameFacts. The recorded evidence is unchanged. Signed-off-by: Erik Sipsma <[email protected]>
Signed-off-by: Erik Sipsma <[email protected]>
sipsma
added a commit
to sipsma/dagger
that referenced
this pull request
Oct 20, 2026
…en its producer's session is removed Add a test for a failure first seen when a superseded check was cancelled: a php-client/test run of dagger#14627 failed with "acquire shared client scope: session ... is closed", naming the session of dagger#14626's php-client/php-stan check on the same engine (traces 51ab194ff7d2c48ac494ff453b55daf7 and 68db9b2801268c97c90d34fcc9d617f5). dagger#14047 gave client work typed lifecycle leases: a call shared across sessions runs under a lease cloned from the session that started it, and a session marked removed refuses every further clone, even from a lease it still holds. Session removal marks the session removed before it waits for its leases to drain, so shared work can still be running when its producer's session is marked removed. A nested call that work then makes fails to clone the producer's scope, and the call's other waiters receive that error although their own sessions are alive. The test builds two sessions with the client lifecycle tests' harness, a real dagql cache, and a call both share. It waits for the second session to join the call, marks the producer's session removed as session removal begins, then lets the shared work make its nested call, and asserts the desired behaviour: the surviving waiter gets the call's value, whether from the shared work or by taking it over. It fails today with the producer's closure, every run. It covers the early teardown window, before the cache releases the producer's session. Signed-off-by: Erik Sipsma <[email protected]>
sipsma
added a commit
to sipsma/dagger
that referenced
this pull request
Oct 21, 2026
…en its producer's session is removed Add a test for a failure first seen when a superseded check was cancelled: a php-client/test run of dagger#14627 failed with "acquire shared client scope: session ... is closed", naming the session of dagger#14626's php-client/php-stan check on the same engine (traces 51ab194ff7d2c48ac494ff453b55daf7 and 68db9b2801268c97c90d34fcc9d617f5). dagger#14047 gave client work typed lifecycle leases: a call shared across sessions runs under a lease cloned from the session that started it, and a session marked removed refuses every further clone, even from a lease it still holds. Session removal marks the session removed before it waits for its leases to drain, so shared work can still be running when its producer's session is marked removed. A nested call that work then makes fails to clone the producer's scope, and the call's other waiters receive that error although their own sessions are alive. The test builds two sessions with the client lifecycle tests' harness, a real dagql cache, and a call both share. It waits for the second session to join the call, marks the producer's session removed as session removal begins, then lets the shared work make its nested call, and asserts the desired behaviour: the surviving waiter gets the call's value, whether from the shared work or by taking it over. It fails today with the producer's closure, every run. It covers the early teardown window, before the cache releases the producer's session. Signed-off-by: Erik Sipsma <[email protected]>
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.
At the end of every recorded call span,
core.recordCacheEvidencestamps the output's content digest and type name. It read both throughres.ResultCall(), which deep-clones the call's whole recipe DAG. On a long receiver chain, such as a container built up step by step, that clone dominated the function.This change adds
dagql.ResultFrameFacts, which reads the two facts from the result's stored call frame directly. The recorded evidence is unchanged:ResultCallis implemented only byResult[T](andObjectResult[T], which embeds it), so the facts come from the same frame as before;Measurements
Microbenchmark (
BenchmarkRecordCacheEvidence, a 32-step receiver chain with content): 17.6 µs → 0.32 µs per span, 21.9 KB → 1 KB and 207 → 5 allocations.End to end, on per-package Go builds (yq v4.49.2, one exec per package, 262 packages, concurrency 16, 12-CPU VM): an ABBA series (4 fresh engines per arm) measured this together with a second, independent telemetry fix (span attributes no longer JSON-encoded twice; separate PR). Medians of wall time, main → both fixes:
The edit result is suggestive rather than established. Nothing regressed, and every run rebuilt exactly the expected packages.
Tests
TestResultFrameFactschecks that the facts match cloning the frame withResultCall, with and without a content digest, and the nil case.test-split/test-packages).BenchmarkRecordCacheEvidencecovers the cost.In CI (on this PR's head commit, rebased onto main):
TestResultFrameFactsand the existing cache-evidence tests ran and passed in thetest-split/test-packagescheck (trace):dagger trace 101ff9d4d5d564984f07c50f526ea6a6 --test TestResultFrameFacts. All checks are green.