Repository navigation
core: make WorkspaceGit persistable in the dagql disk cache - #13700
Merged
Merged
Conversation
WorkspaceGit (returned by Workspace.git()) was the only type in the
workspace/git family that did not implement dagql.PersistedObject.
Workspace, GitRef, Changeset, WorkspaceModule, etc. all do. As a result,
any build whose dagql cache closure touched Workspace.git() failed to
persist its cache to disk on engine shutdown:
dagql cache close exiting with error:
encode persisted object payload: type "WorkspaceGit"
does not implement persisted object encoding
...which aborted the whole cache-close, so nothing persisted and the
build could not be reused across an engine restart.
WorkspaceGit's entire state is a reference to its Workspace, which is
already persistable, so encode/decode reduce to persisting that one ref,
mirroring Workspace.EncodePersistedObject and the other core encoders.
Signed-off-by: Solomon Hykes <[email protected]>
shykes
added a commit
that referenced
this pull request
Jul 21, 2026
The previous approach stored the auto-injected Workspace as a field on EngineDev (and Builder), and passed it down to the go/cli-dev toolchains. Because a module object's cache key is its field values, holding a session-scoped Workspace tainted the cache key of *every* EngineDev method — so their build results could not be reused across a session or an engine restart. Resolve the Workspace to scalar commit/dirty values once, at the point where it is auto-injected, and thread only those strings through the toolchains. No module stores or receives a Workspace object for stamping anymore, so builds stay content-addressed. go/cli-dev gain optional vcsCommit/vcsDirty args (which take precedence over ws); dev/docs-dev/ release are unchanged and keep passing the Workspace, which is now resolved to scalars internally. Regenerated the affected dagger runtime bindings. Note: cross-restart cache persistence for git-touching builds also requires WorkspaceGit to be persistable in the dagql disk cache, fixed separately in #13700. Signed-off-by: Solomon Hykes <[email protected]>
tiborvass
approved these changes
Jul 21, 2026
shykes
added a commit
that referenced
this pull request
Jul 21, 2026
The previous approach stored the auto-injected Workspace as a field on EngineDev (and Builder), and passed it down to the go/cli-dev toolchains. Because a module object's cache key is its field values, holding a session-scoped Workspace tainted the cache key of *every* EngineDev method — so their build results could not be reused across a session or an engine restart. Resolve the Workspace to scalar commit/dirty values once, at the point where it is auto-injected, and thread only those strings through the toolchains. No module stores or receives a Workspace object for stamping anymore, so builds stay content-addressed. go/cli-dev gain optional vcsCommit/vcsDirty args (which take precedence over ws); dev/docs-dev/ release are unchanged and keep passing the Workspace, which is now resolved to scalars internally. Regenerated the affected dagger runtime bindings. Note: cross-restart cache persistence for git-touching builds also requires WorkspaceGit to be persistable in the dagql disk cache, fixed separately in #13700. Signed-off-by: Solomon Hykes <[email protected]>
shykes
added a commit
that referenced
this pull request
Jul 21, 2026
The previous approach stored the auto-injected Workspace as a field on EngineDev (and Builder), and passed it down to the go/cli-dev toolchains. Because a module object's cache key is its field values, holding a session-scoped Workspace tainted the cache key of *every* EngineDev method — so their build results could not be reused across a session or an engine restart. Resolve the Workspace to scalar commit/dirty values once, at the point where it is auto-injected, and thread only those strings through the toolchains. No module stores or receives a Workspace object for stamping anymore, so builds stay content-addressed. go/cli-dev gain optional vcsCommit/vcsDirty args (which take precedence over ws); dev/docs-dev/ release are unchanged and keep passing the Workspace, which is now resolved to scalars internally. Regenerated the affected dagger runtime bindings. Note: cross-restart cache persistence for git-touching builds also requires WorkspaceGit to be persistable in the dagql disk cache, fixed separately in #13700. Signed-off-by: Solomon Hykes <[email protected]>
marcosnils
pushed a commit
that referenced
this pull request
Jul 22, 2026
The previous approach stored the auto-injected Workspace as a field on EngineDev (and Builder), and passed it down to the go/cli-dev toolchains. Because a module object's cache key is its field values, holding a session-scoped Workspace tainted the cache key of *every* EngineDev method — so their build results could not be reused across a session or an engine restart. Resolve the Workspace to scalar commit/dirty values once, at the point where it is auto-injected, and thread only those strings through the toolchains. No module stores or receives a Workspace object for stamping anymore, so builds stay content-addressed. go/cli-dev gain optional vcsCommit/vcsDirty args (which take precedence over ws); dev/docs-dev/ release are unchanged and keep passing the Workspace, which is now resolved to scalars internally. Regenerated the affected dagger runtime bindings. Note: cross-restart cache persistence for git-touching builds also requires WorkspaceGit to be persistable in the dagql disk cache, fixed separately in #13700. Signed-off-by: Solomon Hykes <[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.
Blocker for #13508
Context
The engine caches computed results so it doesn't redo expensive work. That cache lives in memory. On shutdown, the engine writes it to disk, so a restart can resume instead of rebuilding everything.
Writing to disk means each result has to be serializable — packed into bytes on the way out, rebuilt on the way back in. Types that support this implement
dagql.PersistedObject:EncodePersistedObject("pack me") andDecodePersistedObject("unpack me").Problem
WorkspaceGit, returned byWorkspace.git(), never implementedPersistedObject. Every other type in the family does —Workspace,GitRef,Changeset,WorkspaceModule.So any build whose cache touched
Workspace.git()couldn't be saved. On shutdown the engine walks the cache, hits the un-packableWorkspaceGit, and aborts the whole save:Nothing persists. After a restart, the engine rebuilds from scratch.
Solution
Teach
WorkspaceGitto pack itself.It's trivial, because a
WorkspaceGitis just a pointer to itsWorkspace:And
Workspacealready persists. So packing is "write down a reference to that Workspace," and unpacking is "load it back and wrap it" — the pattern the other types already follow.