Repository navigation
ci: keep dev-engine clients off the outer engine's session; state nesting and GPU gates as v1.0 - #14342
Merged
Conversation
…ssion Container execs now reach their engine by default: the engine injects DAGGER_SESSION_PORT and DAGGER_SESSION_TOKEN into every exec on the v1.0 API. The CLI and the Go SDK used that session whenever it was present, even when the process had selected a different engine explicitly. A client pointed at a dev engine with _EXPERIMENTAL_DAGGER_RUNNER_HOST silently joined the outer session instead. This broke Dagger's own CI once native CI's outer engine included default nesting: engine-dev's integration tests and schema introspection talked to the outer engine rather than the dev engine under test, so tests failed with "cannot configure workdir for existing session" and generated clients were built from the outer engine's older schema. Treat an explicit engine selection as outranking the injected session: - the CLI connects to its runner host when --engine, --cloud, DAGGER_ENGINE, DAGGER_CLOUD_ENGINE or _EXPERIMENTAL_DAGGER_RUNNER_HOST selects an engine; - the Go SDK skips the session env when a runner host is configured or one of those variables is set, and drops the session variables from the CLI it starts, so an older CLI routes the same way. Without an explicit selection, nested clients keep using the injected session. Signed-off-by: Erik Sipsma <[email protected]> Signed-off-by: Erik Sipsma <[email protected]>
API views are base-version granular: the engine strips prerelease suffixes when deriving a view, so every v1.0.0 prerelease, from v1.0.0-0 through v1.0.0-beta.15, gets the v1.0.0 view. The nesting default and Container.withGPU were gated at v1.0.0-beta.15, which reads as if beta.14 and earlier callers keep the old behavior, but no view can fall below that boundary while being a v1.0.0 prerelease. Both already apply to every v1.0.0 prerelease caller. State the gates as v1.0.0-0 so the code says what callers get. Add engine.APIViewVersion as the single declared-version-to-view mapping, and build the gate tests' views through it instead of from raw prerelease strings that the engine never produces. Correct the changelog entries and the version-gating internal doc accordingly. Signed-off-by: Erik Sipsma <[email protected]> Signed-off-by: Erik Sipsma <[email protected]>
Signed-off-by: Erik Sipsma <[email protected]> Signed-off-by: Erik Sipsma <[email protected]>
…sion" This reverts commit 2af77bc. Signed-off-by: Erik Sipsma <[email protected]>
…ected session" This reverts commit 5931ca1. DAGGER_SESSION_PORT and DAGGER_SESSION_TOKEN are not only injected by the engine for nesting. `dagger listen` and `dagger api with-session` hand them to clients on purpose, and with-session passes the user's whole environment along. With an engine selector such as _EXPERIMENTAL_DAGGER_RUNNER_HOST or DAGGER_ENGINE also set, the reverted change made the client skip that deliberate session and start its own: TestListen/TestDaggerListen/serves_explicit_workspace_entrypoint failed with `unknown command "hello" for "dagger call"`. A client cannot tell an injected session from a deliberate one, so keep the existing precedence and opt out where a caller must reach another engine. Signed-off-by: Erik Sipsma <[email protected]>
On the v1.0 API, container execs get DAGGER_SESSION_PORT/TOKEN for the engine running them, and Dagger clients prefer that session over _EXPERIMENTAL_DAGGER_RUNNER_HOST. engine-dev (v1.0.0-0), engine-lab (v1.0.0-0) and dagger-dev (v1.0.0-beta.12) all get the v1.0.0 view, so once native CI's outer engine nested by default, their clients joined the outer CI engine instead of the dev engine under test: integration tests failed with "cannot configure workdir for existing session" and similar errors, and the Python, Rust and Elixir clients were generated from the outer engine's older schema. Unset the session at the process boundary for the execs that must reach a dev engine: engine-dev's schema introspection and test runner, engine-lab's dagger and query commands, and dagger-dev's smoke check. WithoutEnvVariable cannot do this because the engine sets the variables when the process starts. This works with outer engines that nest by default and with those that do not. Signed-off-by: Erik Sipsma <[email protected]>
grouville
approved these changes
Sep 25, 2026
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.
Why
Since native CI's outer engine moved from v1.0.0-beta.14 to a main build (3924c43) on 2026-09-25, most PRs and main fail the same checks:
python-client,rust-clientandelixir-clientup-to-date, plus about twelvetest-splitshards.The cause is default nesting (#14082). On the v1.0 API, every container exec gets
DAGGER_SESSION_PORT/DAGGER_SESSION_TOKENfor the engine running it. engine-dev declaresengineVersion = "v1.0.0-0". Views drop the prerelease suffix, so it gets the v1.0.0 view and its execs are nested. Dagger clients (the CLI and the Go SDK) prefer that session over_EXPERIMENTAL_DAGGER_RUNNER_HOST. So the test binaries andcodegen introspect, which InstallClient points at the dev engine, joined the outer CI engine instead:cannot configure workdir for existing session,Cannot query field "withGPU", missing test services, and similar errors.withGPUfrom core: add Container.withGPU, deprecate experimental GPU fields #14320, so the up-to-date checks reported changes. Go, TypeScript and PHP generate from v0.21.9 modules, which are not nested, so they passed.What changes
ci: keep dev-engine clients off the outer session. The execs that must reach a dev engine now unset the session at the process boundary (env -u DAGGER_SESSION_PORT -u DAGGER_SESSION_TOKEN):daggerandquerycommands;WithoutEnvVariablecannot do this, because the engine sets the variables when the process starts. This works whether or not the outer engine nests by default, so main and PRs go green on the current CI engine without re-pinning.core: gate nesting andwithGPUon the v1.0 view.engine.BaseVersionstrips prereleases when deriving views, so every v1.0.0 prerelease caller gets the v1.0.0 view. The previousv1.0.0-beta.15gates read as if beta.14 and earlier callers keep the old behavior, but that boundary cannot be reached. Every v1.0.0 prerelease caller already gets nesting by default andwithGPU.v1.0.0-0. Behavior is unchanged.engine.APIViewVersionis the single mapping from declared version to view, used at the existing call sites.internal-docs/version-gating.mdare corrected. The doc now explains that views cannot separate prereleases of one version, and points to exact declared-version checks (such ascallerPastChangesetCwdCutover) when behavior must differ.Reverted in this PR: client-side precedence. An earlier commit here made an explicit engine selection outrank an injected session in the CLI and Go SDK. CI caught a regression:
TestListen/TestDaggerListen/serves_explicit_workspace_entrypoint.dagger listenanddagger api with-sessionhandDAGGER_SESSION_PORT/TOKENto clients on purpose, and a client cannot tell those from an injected session. That change is reverted, and client precedence matches main.Validation
Run locally against the same outer engine native CI uses (CLI and engine at 3924c43):
dagger check python-client:client-library:up-to-datedagger generateshows the diff removes exactly core: add Container.withGPU, deprecate experimental GPU fields #14320'swithGPU.dagger api call engine-dev test --pkg ./core/integration --run='TestAddress/TestLocalFile|TestFile/TestExport|TestListen'TestAddress/TestLocalFilefails withcannot configure workdir for existing session.dagger check smoke(dagger-dev) passes, anddagger api call engine-lab --helploads the module.go test -run 'TestNesting|TestGPU' ./core/schema/passes.TestListen, which the revert addresses. Eight failures there were Cloud connection resets or removed outer sessions after the checks' own work had passed, and all of them passed on rerun.Not in this PR
DAGGER_ENGINE,DAGGER_CLOUD_ENGINE). That would remove this footgun for users without changing clients. It needs a decision from the owners of default nesting.v1.0.0-beta.10,-beta.11and-beta.12(Git bundles,Filebytes, lookup locking, latest-release and version queries) have the same unreachable-boundary problem. Their unit tests set raw prerelease views and assert differences between them that production views cannot have, so they need their owners' review.