Skip to content

engine: never fail the start over the cache entries the image ships - #15199

Merged
sipsma merged 5 commits into
mainfrom
sipsma/image-entries-expired-root
Nov 17, 2026
Merged

sipsma merged 5 commits into
mainfrom
sipsma/image-entries-expired-root

Conversation

@sipsma

@sipsma sipsma commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Every fresh start or restart of a v1.0.0-beta.26 or v1.0.0-beta.27 engine now fails:

failed to create engine: merge the engine image's entries: root 4875 did not merge (expired true, retained false)

(root 4895 on amd64). beta.26 stopped starting on Nov 16 at 20:46 PT, and beta.27 on Nov 17 at 11:44 PT. An engine that was already running keeps working until it restarts.

Why

Since #15080, an engine image ships ready-made cache entries for Go modules, which the engine merges at every start, and the start failed unless the bundle merged whole. Each entry keeps the expiry its cache gave it when the image was built. In both released images exactly one root has one: the go-includes helper binary. A module function returned it, so it got a module function's default lifetime of one week (MaxFunctionCacheTTLSeconds). A week after each image was built, the merge reported that root expired, and the engine refused to start.

The change

The image's entries only spare the engine work it can do itself, so the start no longer depends on them at all:

  • An expired root is a cache miss, not a broken image. The merge already leaves an expired root out, along with whatever only it needed; the engine now counts it in its log line.
  • Anything else that keeps the entries from merging is logged as a warning, and the engine starts without them, or with the part that merged. That covers an unreadable bundle, a blob the image doesn't hold, a failed merge, stale held rows and a root merged without the image's retention, all of which used to fail the start. A bundle that can't be read or names a missing blob still merges nothing, so no entry reads a part the image doesn't hold. A merge that fails before its commit changes nothing.

TestMergeImageEntries checks what the start leaves in the cache:

  • An image with one expired entry and one unexpired entry: the unexpired one is merged and the expired one is left out. This case fails on main with the error above.
  • An image missing a blob: nothing is merged, and the start goes on.

The release/publish-with-mock-endpoints check runs release publish on the engine the Publish workflow uses, the released beta.27 image, started fresh, so it failed on every pull request. It now mounts an empty directory over that engine's /usr/local/share/dagger/entries, and the engine starts without its entries.

What it doesn't do

  • It doesn't repair the published beta.26 and beta.27 images: their users need a release with this change. Until then, an engine started with an empty directory mounted over /usr/local/share/dagger/entries starts, without the pre-warmed Go module entries.
  • A week after an image is built, its go-includes entry is still left out, so a fresh engine's first Go module call builds it again, which takes a few seconds. Shipping entries without an expiry would keep it warm; that is a separate change.

An engine image's entries keep the expiry their cache gave them when the
image was built. A module function's result gets the function's default
lifetime of a week, and the Go module entries v1.0.0-beta.26 and
v1.0.0-beta.27 ship hold one such result, the go-includes helper. A week
after each image was built, every start of it fails with "root N did
not merge (expired true, retained false)".

The new case ships two entries, one with an expiry that has passed, and
expects the start to go on with the unexpired entry merged and the
expired one left out. It fails on the engine as it is.

Signed-off-by: Erik Sipsma <[email protected]>
An entry an engine image ships keeps the expiry its cache gave it when
the image was built, and the image outlives it: v1.0.0-beta.26 and
v1.0.0-beta.27 ship the go-includes helper with a module function's
default lifetime of a week, and stopped starting a week after their
builds, fresh or restarted alike.

An expired root is a cache miss, not a broken image. The merge already
leaves an expired root out, with whatever only it needed; the engine now
counts it in its log and starts. A root that is unexpired and not
retained, a stale held row or a missing blob still fails the start.

Signed-off-by: Erik Sipsma <[email protected]>
The entries an engine image ships only spare the engine work it can do
itself, yet anything that kept them from merging failed the start: an
unreadable bundle, a blob the image doesn't hold, a failed merge, stale
held rows or a root merged without the image's retention.

Now the start never depends on them. Whatever keeps them from merging
is logged, and the engine starts without them, or with the part that
merged. A bundle that can't be read or names a missing blob still merges
nothing, so no entry reads a part the image doesn't hold, and a merge
that fails before its commit changes nothing.

Signed-off-by: Erik Sipsma <[email protected]>
@sipsma sipsma changed the title engine: start when an entry the image ships has expired engine: never fail the start over the cache entries the image ships Nov 17, 2026
The publish check runs release publish on the engine the Publish workflow
uses, the released v1.0.0-beta.27 image, started fresh. That engine
refuses to start once an entry its image ships has expired, as one did
on Nov 17, so the check failed on every pull request before running
anything.

The check now mounts an empty directory over the image's entries, and
the engine starts without them.

Signed-off-by: Erik Sipsma <[email protected]>
@sipsma
sipsma merged commit 856a3da into main Nov 17, 2026
89 of 97 checks passed
@sipsma
sipsma deleted the sipsma/image-entries-expired-root branch November 17, 2026 21:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants