Skip to content

feat: enable container nesting by default - #14082

Merged
grouville merged 11 commits into
dagger:mainfrom
grouville:grouville/default-nesting
Sep 23, 2026
Merged

grouville merged 11 commits into
dagger:mainfrom
grouville:grouville/default-nesting

Conversation

@grouville

@grouville grouville commented Sep 9, 2026 •

Copy link
Copy Markdown
Member

Enable nesting by default, with disableDaggerInDagger: true to opt out.

Applies to withExec, asService, up, terminal, and withDefaultTerminalCmd. API views before v1.0.0-beta.15 keep experimentalPrivilegedNesting and their existing opt-in behavior. Newer views still accept it, deprecated and ignored, so existing callers keep working. This matters because views drop the prerelease suffix: every v1.0.0-beta.N module gets the v1.0.0 view.

Regenerate SDKs and remove redundant opt-ins from current callers. Keep legacy fixtures unchanged.

Compatibility uses the call's API view: internal SDK calls use the latest view even when loading older modules.

Verification

Schema regressions cover the version boundary, internal calls, and terminal defaults:

go test ./core/schema -run 'TestBaseSchemaAllowlist|TestNesting' -count=1

Engine-backed checks cover exec/service nesting, opt-out, legacy opt-in, nested services, module versions, terminals, and SDK startup:

./bin/dagger api call engine-dev test --pkg ./core/integration --run='Test(Container|Services|Module|Up)/Test(NestedExec|Nesting|ExecServicesNestedExec|ExecServicesNestedHTTP|ExecServicesNestedGit|ModuleSchemaVersion|DaggerTerminal|UpDirectSDK)$'

Fixes #13668

@grouville
grouville requested review from a team as code owners September 9, 2026 00:44
@grouville
grouville force-pushed the grouville/default-nesting branch from 2e1df8b to 06a79ff Compare September 9, 2026 00:47
@grouville

grouville commented Sep 9, 2026 •

Copy link
Copy Markdown
Member Author

Does disableNesting as the opt-out match what you had in mind? Would you prefer disableExperimentalNesting?

cc @shykes @vito

@grouville
grouville force-pushed the grouville/default-nesting branch 2 times, most recently from 5e1e012 to 6480b08 Compare September 9, 2026 01:29
@grouville grouville modified the milestone: v1.0.0-beta.12 Sep 9, 2026
@vito

vito commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

@grouville Don't think we need Experimental - disableNesting seems fine but I wonder if disableDagger would be clearer?

@shykes wdyt?

@grouville
grouville force-pushed the grouville/default-nesting branch from 6480b08 to e3df00d Compare September 9, 2026 22:09
@tiborvass

Copy link
Copy Markdown
Contributor

There is a legacy compatibility issue in core/schema/container.go around terminalLegacy (the internal srv.Select near line 4706). The forwarded selector has no View, so it invokes the latest terminal API. A pre-v0.12 caller that supplies experimentalPrivilegedNesting will then pass an argument absent from the latest schema and fail. Without that argument, the latest resolver also enables nesting by default, which changes the legacy opt-in behavior. Could this forward through an explicit compatible view (for example, v0.12.0) or translate the legacy option to disableNesting while preserving the old default?

@marcosnils

Copy link
Copy Markdown
Contributor

@shykes: disableDaggerInDagger as a proposal from Solomon.

@shykes shykes left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assuming ASR (Adversarial Self-Review) :)

Also assuming disableDaggerInDagger as argument name

@grouville
grouville force-pushed the grouville/default-nesting branch 2 times, most recently from b6acd79 to b79c9ab Compare September 22, 2026 22:03
@grouville

grouville commented Sep 23, 2026 •

Copy link
Copy Markdown
Member Author

Rebased on #14291 and went through the review.

Renamed disableNesting to disableDaggerInDagger as @shykes / @marcosnils suggested, and regenerated the SDKs and docs.

@tiborvass good catch on terminalLegacy. stdoutLegacy, stderrLegacy and terminalLegacy now forward at v0.12.0. That's where those legacy fields end and the modern ones begin, and it's still below the nesting boundary, so old callers keep the opt-in. TestNestingLegacy{Terminal,Output}Forwarding covers it.

While re-checking compat, I noticed that views drop the prerelease suffix, so every v1.0.0-beta.N module actually gets the v1.0.0 view. Removing experimentalPrivilegedNesting would have broken released beta modules that still pass it, so I kept it as deprecated in the new view instead, where it's accepted and ignored. I also migrated two callers I had missed: the terminal exec from #14291, where the opt-out was silently dropped, and tui-qa.

To check it end to end, I opened a playground on this branch with a scratch dir mounted:

dagger -W ~/dagger --x-release=v1.0.0-beta.14 \
  api call playground \
    with-directory --path=/root/target --source=./nesting-play \
    with-workdir --path=/root/target \
    terminal

and called core directly (printenv DAGGER_SESSION_PORT only succeeds when the exec can reach the engine):

dagger -M api call container from --address=alpine with-exec --args=printenv,DAGGER_SESSION_PORT stdout
# prints the port

dagger -M api call container from --address=alpine with-exec --args=printenv,DAGGER_SESSION_PORT --disable-dagger-in-dagger stdout
# exit 1

dagger -M api call container from --address=alpine with-exec --args=printenv,DAGGER_SESSION_PORT --experimental-privileged-nesting --disable-dagger-in-dagger stdout
# accepted, still exit 1

For older versions, I wrote three tiny Dang modules with the same code, where only engineVersion differs (latest, v1.0.0-beta.14, v0.21.9). Each runs that probe with and without the nesting args, via dagger -m .dagger/modules/<name> api call report. The results are what we want:

  • v0.21.9 stays isolated unless it opts in with experimentalPrivilegedNesting, same as before.
  • v1.0.0-beta.14 loads fine even though it passes the old arg, and nests by default.
  • latest nests by default, disableDaggerInDagger isolates it, and the old arg is simply ignored.

The earlier red checks were infra (registry 500 on provision/helm, plus the known TestAgentRestore race) and went green on rerun. The targeted integration set from the description also passes on engine-dev.

@grouville
grouville force-pushed the grouville/default-nesting branch from b79c9ab to 90132de Compare September 23, 2026 02:09
Commands should be able to call Dagger without explicitly enabling
experimentalPrivilegedNesting. From API v1.0.0-beta.12, enable nesting by
default and expose disableNesting for commands that need an independent
engine. A false-default opt-out also works with Go's zero-value options.

Keep the old argument and opt-in behavior in older API views. Apply the
same boundary to exec, services, up and terminals.

Check each operation's API view with core.Supports. Internal SDK calls
use the latest API even while loading older modules; checking the
surrounding server's version instead breaks Python SDK setup. Cover
this distinction, terminal defaults and the schema boundary in tests.

Refs dagger#13668

Signed-off-by: Guillaume de Rouville <[email protected]>
Regenerate Go, TypeScript, Python, Elixir, PHP and Rust clients for the
new API. Go exposes DisableNesting as a plain bool, with no pointer or
new() required.

Remove redundant opt-ins and empty options from current callers. Keep
explicit opt-outs in helpers that connect to independent engines, and
retain old arguments in fixtures pinned to older API versions.

Cover default nesting, explicit opt-out and legacy opt-in through real
execs and services. The nested-terminal test now exercises the default
instead of passing the removed CLI flag.

Verified with the targeted engine-dev integration set covering nesting,
nested services, module versions, terminals and up across SDKs.

Signed-off-by: Guillaume de Rouville <[email protected]>
Document v1.0.0-beta.12 as the migration boundary. New API callers can
remove experimentalPrivilegedNesting: true; callers that must avoid the
current engine use disableNesting: true instead. Older API views retain
their opt-in behavior.

Update the GraphQL and PHP API references alongside the release note
so reviewers and users can see the same option across all entry points.

Refs dagger#13668

Signed-off-by: Guillaume de Rouville <[email protected]>
Signed-off-by: Guillaume de Rouville <[email protected]>
Review feedback: name the opt-out after what it turns off, so the
argument reads as "disable Dagger in Dagger" rather than a generic
"nesting". Applies to withExec, asService, up, terminal, and
withDefaultTerminalCmd, plus the regenerated SDK clients and docs.

Signed-off-by: Guillaume de Rouville <[email protected]>
v1.0.0-beta.12 through beta.14 shipped while this branch was open, so
gating there would retroactively enable nesting for three released
versions. Move the boundary to the next unreleased version and pin the
schema test rows on either side of it.

Signed-off-by: Guillaume de Rouville <[email protected]>
Views drop the prerelease suffix, so every v1.0.0-beta.N client and
module gets the v1.0.0 view. Removing experimentalPrivilegedNesting
from that view broke released beta modules that still pass it: Go
codegen no longer compiled and raw GraphQL calls failed on an unknown
argument.

Keep the argument in the new view, deprecated and ignored, since
nesting is already the default. Older views keep the opt-in behavior.
Regenerate SDKs and docs.

Signed-off-by: Guillaume de Rouville <[email protected]>
terminalExec selects withExec at the latest view, where
experimentalPrivilegedNesting is ignored, so the default terminal
command's opt-out was lost. Pass disableDaggerInDagger instead.

tui-qa targets v1.0.0 and passed the old argument, so nesting: false
was silently ignored.

Signed-off-by: Guillaume de Rouville <[email protected]>
@grouville
grouville force-pushed the grouville/default-nesting branch from 1c442e1 to a00b28f Compare September 23, 2026 18:34
@grouville
grouville merged commit acf9127 into dagger:main Sep 23, 2026
86 checks passed
TomChv added a commit to dagger/typescript-sdk that referenced this pull request Oct 8, 2026
….15 (#73)

* fix: drop experimentalPrivilegedNesting from the Dang entrypoint

The generated entrypoint/main.dang passed it on the exec that runs the
TypeScript dispatcher, so the dispatcher could open its own session back
to the engine. Container nesting has been on by default since
dagger/dagger#14082, which makes the argument redundant everywhere the
entrypoint can be loaded at all.

Signed-off-by: Tom Chauveau <[email protected]>

* feat: generate a module entrypoint by default

The `entrypoint` setting becomes `legacyRuntime`, inverted: a module now
declares an `[entrypoint]` with entrypoint/main.dang and the
__dagger.dispatch.ts it shells out to, and the `[runtime]` layout — sdk/
as the package, a committed __dagger.entrypoint.ts — is what you opt into
for an engine too old to load one.

The 16 branch sites keep reading in terms of the path they pick, through
one private derived field rather than an inverted condition each.

The check suite stays on the path it was written against. Gen.scope
defaults to `legacyRuntime: true` and says why; the checks that assert
the legacy layout by path pin it, the three entrypoint checks pass
`legacyRuntime: false`, and the engine-e2e CLI checks pass
`--legacy-runtime` because their second half calls the module — which an
`[entrypoint]` manifest cannot do until the builder emits a
manifestVersion (dagger/dagger#14038).

Signed-off-by: Tom Chauveau <[email protected]>

* chore: target engine v1.0.0-beta.15

The entrypoint a module now generates by default is only read by an engine
carrying dagger/dagger#14038, which first shipped in beta.15 — so that is
the release this SDK's bundle is paired with. The nine managed fixture
manifests move with it, which is what fixture-engine-version-check holds.

The pairing moves without the vendored sources, and library/VENDOR.md
records why rather than letting its "move together or not at all" rule go
quietly stale: client.gen.ts is regenerated here and already matches
beta.15's schema, and the runtimes checks run the committed bundle in a
beta.15 engine. Upstream's beta.12–15 changes to the runtime sources are
vendoring lag, and taking them is its own change.

The SDK module's own engineVersion stays at beta.11: nothing here uses a
newer core API, and raising it would lock out the engines --legacy-runtime
exists to serve.

Signed-off-by: Tom Chauveau <[email protected]>

* chore: lock sdk-helpers at v1.0.6

The dependency is the range `dagger.io/sdk/helpers@v1`, so only the two
lockfiles held v1.0.5. No call site changes: v1.0.6 makes the generic
`withLegacyRuntime` public, and `withLegacyTypescriptRuntime` — which this
SDK calls — was already a wrapper around it and is byte-identical in the
release.

`dagger lock update` also re-resolved four unrelated base-image digests
(alpine, busybox, golang 1.26, verdaccio). Those are put back: moving the
images everything builds on is its own change, not a dependency bump.

The playground's workspace.lock is written by engine-e2e's generator, so
the hand-applied edit there is only correct if the generator agrees —
`engine-e-2-e:generate/stale` is what says it does.

Signed-off-by: Tom Chauveau <[email protected]>

* refactor: use legacyRuntime directly instead of a derived field

Review: the private `entrypoint` alias was one name for the inverse of
another, and a reader had to hold both. Gone — the 16 branch sites test the
setting, keeping their branch order so the comment above each one still
describes the branch under it.

Two sites read better for it: the self-target condition is `legacyRuntime
or selfRecorded` rather than a negation of a negation.

Signed-off-by: Tom Chauveau <[email protected]>

---------

Signed-off-by: Tom Chauveau <[email protected]>
eunomie added a commit that referenced this pull request Oct 20, 2026
Default nesting (#14082) gave the shell the outer engine's session, so
its CLI skipped the dev engine and failed the ClientVersion check.

Signed-off-by: Yves Brissaud <[email protected]>
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.

Clean up longstanding API warts and pending breaking changes

5 participants