Repository navigation
Description
Summary
Modules using the Go SDK ("sdk": {"source": "go"} in dagger.json) — including Dagger's own built-in python-sdk runtime, whose Go runtime is itself built via the Go SDK codegen pipeline — are built against unpinned, floating dependency versions, because the Go SDK codegen's post-generation commands run go get -u followed by go mod tidy:
// cmd/codegen/generator/go/generate_module.go
genSt.PostCommands = append(genSt.PostCommands,
exec.Command("go", "get", "-u", daggerImportPath+"@"+g.Config.ModuleConfig.LibVersion))
...
genSt.PostCommands = append(genSt.PostCommands,
exec.Command("go", "mod", "tidy"),
)go get -u re-resolves the entire transitive dependency graph to the latest available versions, ignoring whatever is committed in go.sum. This means every module build is implicitly exposed to any breaking change published upstream by a transitive dependency, at any time, with zero warning and zero way for module authors to pin against it.
Impact observed
On 2026-10-02, go.opentelemetry.io/otel v1.47.0 was published upstream with a self-import cycle bug (reported separately: open-telemetry/opentelemetry-go#9071). Because the engine-builtin python-sdk module's runtime is a Go program built through this exact codegen path, and transitively depends on go.opentelemetry.io/otel (via github.com/dagger/otel-go), every single Dagger module relying on the Python SDK started failing fleet-wide within hours of the otel release, with no change on our end:
failed to get sdk object for sdk module python-sdk: call constructor: exit code: 1
Full build error:
package python-sdk
imports github.com/dagger/otel-go from dagger.gen.go
imports go.opentelemetry.io/otel from init.go
imports go.opentelemetry.io/otel/internal/global from handler.go
imports go.opentelemetry.io/otel/log from logger.go
imports go.opentelemetry.io/otel/internal/global from keyvalue.go: import cycle not allowed
This affected engine v0.20.8 (and would equally affect v0.20.6, since the go get -u behavior is identical — it's not an engine-version-specific regression, it's a build-time dependency resolution issue).
Confusing symptom: apparent "intermittency"
Builds that ran before the upstream otel release (or on engine pods with a module-proxy cache still returning a pre-regression "latest") succeeded; builds on freshly-scheduled pods after the otel release failed deterministically (confirmed 4/4 in manual reproduction via dagger functions). This made the issue initially look like a flaky/intermittent engine problem, when it was actually a fully deterministic point-in-time dependency resolution issue.
Why this is risky
sdk/go/go.mod(thedagger.io/daggerlibrary itself) pinsgo.opentelemetry.io/otelto a fixed version in its own go.mod/go.sum.- But
go get -uon a user's or built-in module's go.mod bypasses this entirely, upgrading to whatever is "latest" on the Go module proxy at build time for every transitive dependency, not justdagger.io/dagger. - This makes Go-SDK-based Dagger module builds fundamentally non-reproducible and non-pinned, unlike declared/locked dependencies in virtually every other package ecosystem.
- Built-in SDKs (like
python-sdk, whose own runtime is written in Go and built via this same path) are not supposed to be subject to "whatever the user's floating deps resolve to today" — they ship with the engine and should build deterministically regardless of what's published upstream on a given day.
Suggested fixes
- Avoid
go get -u(unbounded upgrade) in the codegen post-commands; usego get <path>@<version>for the specific pinned version only, and letgo mod tidyfill in the rest from the existing go.sum without force-upgrading already-pinned transitive dependencies. - For engine-builtin SDK runtimes specifically (python-sdk, typescript-sdk's embedded Go bits, etc.), avoid routing their own build through the generic "user module" Go SDK codegen path that assumes floating/latest dependency resolution — these should build from a fully vendored/locked dependency set shipped with the engine release.
- At minimum, document this behavior clearly so module/SDK maintainers understand that Go SDK-based builds are not reproducible across time, and consider adding a flag/config to disable the
-uupgrade behavior.
Environment
- Engine version: v0.20.8 (also applicable to v0.20.6)
- Affected SDK: Go SDK codegen pipeline (
core/sdk/go_sdk.go,cmd/codegen/generator/go/generate_module.go), specifically impacting the built-inpython-sdkmodule runtime build - Related upstream issue: v1.47.0: import cycle between otel, otel/log, and otel/internal/global (via new internal/global/logger.go) open-telemetry/opentelemetry-go#9071
Activity
gregoryboue commentedon Oct 2, 2026
Correction to this report, and a hard constraint this surfaces
Two updates after further investigation.
1. The otel side is not a bug. I had filed open-telemetry/opentelemetry-go#9071 against
otelv1.47.0; it was closed as not planned, correctly.otelv1.47.0 requiresotel/logv1.47.0, and the cycle only appears because this repo'sreplacedirectives forceotel/logback down to v0.16.0 — below what the release requires, into code the otel team considers experimental. The maintainer also pointed out that a minimumrequirewould not help, since areplaceoverrides it. That's right. So the remaining issue is entirely on Dagger's side, which is this issue.2. The
go get -u+ pinned-replacecombination is now a hard contradiction, not merely fragile. This is the part I'd like to flag, because the obvious fix does not work.The runtime
go.modfiles (84 of them in v0.20.8, includingsdk/python/runtime/go.mod) carry:while codegen runs
go get -u, which floatsotelto latest. Those two settings pull in opposite directions, so the collision was only a matter of time; v1.47.0 merely triggered it.Results
All runs use the real dependency set (
github.com/dagger/otel-go+ the fourreplacedirectives above),go get -u+go mod tidy, go1.26.8, linux/amd64:go.modconfigurationreplace→ v0.16.0 (current,otelfloats to v1.47.0)import cycle not allowedreplace→ v0.21.0 (bump the pin)undefined: log.KeyValueindagger/otel-goreplaceat all (the suggested fix)undefined: log.KeyValueindagger/otel-goreplace→ v0.16.0 andotelcapped at v1.46.0So simply dropping the
replacedirectives is not a viable fix today:Why
log.KeyValuewas removed inotel/logv0.21.0:otel/loglog.KeyValueotel/internal/globalotelv1.47.0github.com/dagger/otel-go(both published versions, v1.41.0 and v1.43.0) useslog.KeyValueinlogging.go, so it requiresotel/log≤ v0.20.0 — precisely the range that cycles againstotel≥ v1.47.0. No version ofotel/logsatisfies both constraints simultaneously. The two requirements are mutually exclusive, so there is nogo.mod-only fix.What this means
The only configuration that builds is capping
otelat v1.46.0. That is what we had to do operationally: a version exclusion on our Artifactory Go proxy, maskingotelv1.47.0 so MVS falls back to v1.46.0. It works, but it is a version freeze — it blocks all futureotelupgrades, and it is not something every Dagger user can implement.Worth noting that
mainstill carriesreplace ... => go.opentelemetry.io/otel/log v0.16.0alongsideotel v1.44.0, so this is not resolved upstream. Any user whose codegen floatsotelpast v1.46.0 hits it.A real fix appears to need
github.com/dagger/otel-goupdated off the removedlog.KeyValueAPI first, after which thereplacepins can be dropped or raised. Until then, every Go-SDK module build is onego get -uaway from this failure.Suggestion
Independently of the otel specifics, the underlying problem is that
go get -umakes module builds non-reproducible: an upstream publish can break every module build fleet-wide, as happened here within hours of the v1.47.0 release, with no change on the user side. Dropping-u(resolving only thedagger.io/daggerbump explicitly) would keep the committedgo.sumauthoritative and make this class of incident impossible — which seems preferable to relying on the dependency graph staying coincidentally compatible.Happy to provide the full reproducers for any row in the table above.
gregoryboue commentedon Oct 2, 2026
Correction: this is already fixed upstream — apologies for the noise
I need to correct my previous comment. I stated this was unresolved on
main; that was wrong. I had checkedsdk/python/runtime/go.mod(where thereplacedirectives are still present) without checking the codegen itself, and drew the wrong conclusion.The
-uflag is gone:Fixed by #13244 ("fix(go): avoid transitive upgrades during module generation", merged 2026-05-28), which is exactly the change I was asking for in this issue. I should have found it before filing.
Verified boundary across released tags:
go get -uimport cycle not allowedgo getReproducing with the actual
sdk/python/runtime/go.modfrom v0.21.10 (github.com/dagger/otel-gov1.41.0 plus the fourotel/logv0.16.0replacedirectives), runninggo get dagger.io/dagger@latest+go mod tidywithout-u:otelcorrectly stays at v1.44.0 instead of floating to v1.47.0, so the pinnedreplacedirectives are no longer in conflict and the cycle never materialises.This also corrects the conclusion of my earlier comment: the
replacepins are not the root cause and do not need to be removed. The-uwas. The claim that "no version ofotel/logsatisfies both constraints" still holds as a static fact aboutotel/log≥ v0.21.0 droppinglog.KeyValue(whichdagger/otel-gouses), but it is not an operational problem, because nothing pushesotelpast v1.46.0 once transitive upgrades are no longer forced. Migratingdagger/otel-goofflog.KeyValueis therefore not urgent.We were hit because we are pinned to engine v0.20.8, which predates the fix. That is on us. The resolution is to upgrade, not to patch anything.
Feel free to close this issue as already resolved by #13244. Thanks for the fix, and sorry for not locating it before opening this.
One small suggestion, take it or leave it: since the affected v0.20.x line is still in use, a note in the v0.21.1 release notes or the troubleshooting docs explicitly linking the symptom to the fix could help. The user-visible failure is opaque —
— and gives no hint that it stems from forced transitive upgrades, nor that upgrading the engine resolves it. It cost us a full day of diagnosis before identifying the mechanism.
ci: fix constrain OpenTelemetry for Dagger spec builds (#664)