Skip to content

engine/client, cli: let nested dagger run/dagger session serve their children - #14708

Merged
marcosnils merged 3 commits into
dagger:mainfrom
eunomie:issue2-nested-session-dagger-af599565
Oct 19, 2026
Merged

marcosnils merged 3 commits into
dagger:mainfrom
eunomie:issue2-nested-session-dagger-af599565

Conversation

@eunomie

@eunomie eunomie commented Oct 16, 2026

Copy link
Copy Markdown
Member

dagger run and dagger session inside a withExec that joins the caller's session (the default from the v1.0 API) answered HTTP 401 to the token they gave their own child. A CLI that finds DAGGER_SESSION_PORT replaced its own token with the exec's token, then checked its child against it. The client now keeps the exec's token for its own requests to the engine, and checks its children against its own token.

A Dagger CLI as the child of dagger run or dagger session failed with http2: frame too large, on a host as well as in an exec: these two servers spoke HTTP/1.1, and the CLI speaks only HTTP/2. Serving such a child needs more than HTTP/2: it would reach the engine as its parent's client, so its shutdown would end the parent's client. The two servers now also speak HTTP/2 and refuse a CLI child with connecting a Dagger CLI to the session served by `dagger run` is not supported yet. dagger listen is unchanged.

How it was verified

  • New TestContainer/TestNestedDaggerCLIServesChild: an HTTP child and a CLI child of dagger run and of dagger session, in an exec that joins the caller's session and in one with daggerInDaggerNewSession. Without the first commit, the two nested HTTP cases fail with 401. Without the second, the four CLI cases fail with frame too large. All eight pass with both.
  • New unit tests TestNestedClientServesItsOwnToken and TestSessionServerRefusesCLIClients; TestListen; golangci-lint.
  • v1.0.0-beta.18 shows the same 401 and frame too large failures.

Not covered

  • Serving a Dagger CLI child: it is refused.
  • dagger session no longer sets ReadHeaderTimeout, like dagger listen and the engine, because it caps the lifetime of an unencrypted HTTP/2 connection.
  • No changelog fragment yet.

Walkthrough: https://gistpreview.github.io/?b1e8e650de710e33a96e9de538847ead

A CLI that finds DAGGER_SESSION_PORT replaced its own token with the
exec's, so `dagger run` and `dagger session` in an exec answered 401
to the token they gave their child.

Signed-off-by: Yves Brissaud <[email protected]>
The child failed on an HTTP/2 framing error, since these servers spoke
HTTP/1.1 only. Serving it would make it the parent's own client, whose
shutdown would end the parent's client.

Signed-off-by: Yves Brissaud <[email protected]>
@eunomie
eunomie marked this pull request as draft October 16, 2026 12:57
@eunomie
eunomie marked this pull request as ready for review October 16, 2026 20:35
@marcosnils
marcosnils merged commit ae23d55 into dagger:main Oct 19, 2026
94 checks passed
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.

3 participants