GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — core: make WorkspaceGit persistable in the dagql disk cache by shykes · Pull Request #13700 · dagger/dagger

Conversation

@shykes

@shykes shykes commented Jul 21, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

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") and DecodePersistedObject ("unpack me").

Problem

WorkspaceGit, returned by Workspace.git(), never implemented PersistedObject. 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-packable WorkspaceGit, and aborts the whole save:

dagql cache close exiting with error:
  encode persisted object payload: type "WorkspaceGit"
  does not implement persisted object encoding

Nothing persists. After a restart, the engine rebuilds from scratch.

Solution

Teach WorkspaceGit to pack itself.

It's trivial, because a WorkspaceGit is just a pointer to its Workspace:

type WorkspaceGit struct {
	Workspace dagql.ObjectResult[*Workspace]
}

And Workspace already 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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@shykes
core: make WorkspaceGit persistable in the dagql disk cache
e24d110
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
@shykes
stamp VCS via resolved scalars, not a stored Workspace field
1d7923b
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 shykes mentioned this pull request Jul 21, 2026
Inject git commit info in CLI build #13508
Merged
@shykes
shykes requested review from TomChv, Copilot, grouville, sipsma, tiborvass and vito and removed request for Copilot July 21, 2026 11:03
Copilot started reviewing on behalf of shykes July 21, 2026 11:04
View session
tiborvass
tiborvass approved these changes Jul 21, 2026
View reviewed changes
@shykes
shykes merged commit fcf46b7 into main Jul 21, 2026
88 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@shykes
shykes deleted the fix-workspace-git-cache-persistence branch July 21, 2026 12:54
shykes added a commit that referenced this pull request Jul 21, 2026
@shykes
stamp VCS via resolved scalars, not a stored Workspace field
29e6631
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
@shykes
stamp VCS via resolved scalars, not a stored Workspace field
627735a
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
@shykes @marcosnils
stamp VCS via resolved scalars, not a stored Workspace field
43d3c24
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]>
@lukas-mertens lukas-mertens mentioned this pull request Nov 5, 2026
🐞 Drained engine loses entire local cache on restart: CurrentModule cannot be persisted #15082
Open
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@tiborvass tiborvass tiborvass approved these changes
@grouville grouville Awaiting requested review from grouville
@vito vito Awaiting requested review from vito
@sipsma sipsma Awaiting requested review from sipsma
@TomChv TomChv Awaiting requested review from TomChv

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@shykes @tiborvass
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.