GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix: builtin dang dependency module loading by eunomie · Pull Request #13007 · dagger/dagger

Conversation

@eunomie

@eunomie eunomie commented Apr 18, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

Summary

Re-apply the fix from #12975 (reverted in b30af04) on top of the
egraph merge (#11856), which reshaped engine/server/session.go
enough that the original patch no longer applied cleanly.

Background

When a module uses the builtin dang SDK and depends on other modules
(go / python / typescript / dang), loading those dependencies fails.

Internally, evaluating a builtin dang module spawns a synthetic
nested client
. Unlike a "real" client, a synthetic client does not
establish its own buildkit session attachables. So when code looks up
the session caller for that client's own ID (e.g. to resolve host-
backed services like git config) the lookup blocks for 10s and then
times out, and dependency loading never completes.

Fix

In resolveClientCaller, when the requested ID is the current
client's own ID and the client has parents:

  1. Try a non-blocking (noWait=true) lookup for the current client's
    session. If it exists, use it.
  2. Otherwise, fall back to the immediate parent's getClientCaller.

For all other IDs, behavior is unchanged (blocking lookup).

Tests

  • Unit tests in engine/server/session_test.go covering the three
    branches of resolveClientCaller.
  • Integration test core/integration/module_builtin_dang_test.go
    exercising a builtin dang module with go / python / typescript /
    dang child dependencies.

References

  • Original PR: fix: builtin dang dependency module loading #12975
  • Revert: b30af04 ("Revert "fix: builtin dang dependency module loading (fix: builtin dang dependency module loading #12975)" (Revert "fix: builtin dang dependency module loading (#12975)" #12994)")
  • Egraph merge that required the reimplementation: aa719a1 (migrate all caching to dagql, remove buildkit solver #11856)

Test plan

  • dagger call engine-dev test --pkg=./engine/server --run='^TestResolveClientCaller' passes
  • dagger call engine-dev test --pkg=./core/integration --run='^TestModule/TestBuiltinDangDependencyModules$' passes
  • CI green

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
eunomie added 2 commits April 18, 2026 19:15
@eunomie
fix(server): fall back to parent caller for synthetic nested clients
7dcfb95
Synthetic nested clients (e.g. builtin dang evaluation) do not establish
their own session attachables. When host-backed services such as git
config are requested through the current client ID, fall back to the
immediate parent client chain so the lookup succeeds instead of timing
out.

Signed-off-by: Yves Brissaud <[email protected]>
@eunomie
test(integration): add builtin dang dependency module regression
6fddb16
Cover the scenario where a builtin dang module loads dependencies
written in go, python, typescript, and dang. This exercises the parent
caller fallback path for synthetic nested clients.

Signed-off-by: Yves Brissaud <[email protected]>
shykes
shykes approved these changes Apr 28, 2026
View reviewed changes
@shykes
shykes requested a review from vito April 28, 2026 18:34
@shykes

shykes commented Apr 28, 2026

Copy link
Copy Markdown
Contributor

@vito looks good to you?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

vito
vito approved these changes Apr 28, 2026
View reviewed changes
@shykes
shykes merged commit ba9bf37 into dagger:main Apr 28, 2026
2 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@tiborvass tiborvass mentioned this pull request May 4, 2026
chore: prep for v0.20.7 #13069
Merged
@sipsma sipsma mentioned this pull request May 6, 2026
Remove stale graph handles from execution metadata #13087
Merged
sipsma added a commit to sipsma/dagger that referenced this pull request May 6, 2026
@sipsma
Fix nested client session caller resolution
f3c8cea
PR dagger#13007 made nested clients fall back to parent sessions when their own session caller was not yet available. That solved the synthetic builtin Dang case, where the nested runtime does not open its own attachables but still needs host-backed services such as git config. The fallback was too broad though: normal nested clients also briefly have no registered session caller while their upgraded session connection is still being handed to BuildKit. During that window, exact session operations could accidentally use a parent caller or later fail with missing requester sessions.

Split exact client caller lookup from host-service caller lookup. Exact session operations now keep using the requested client ID and wait for that session. Host-backed service operations get a separate lookup path that may proxy to an explicitly configured ancestor, and only synthetic clients opt into that behavior through the nested-client server path.

Builtin Dang now passes an explicit host-service proxy opt-in when it creates its synthetic nested client. The server maps that to a concrete HostServiceProxyClientID on client initialization, validates that reused clients do not change proxy target, and resolves host-service callers through that explicit ancestor chain. Normal container-exec nested clients pass no proxy opt-in, so their exact session operations remain tied to their own session attachables.

Normal clients also wait for their own caller before executing GraphQL queries, which closes the race where workspace loading or return-value export could start before the session attachables were registered. The old sleep-based repro hook has been removed. Focused session, engineutil, core, schema, and sdk checks pass with the new exact-vs-host-service split.

Signed-off-by: Erik Sipsma <[email protected]>
@sipsma sipsma mentioned this pull request May 6, 2026
Fix nested client session race #13108
Merged
sipsma added a commit that referenced this pull request May 7, 2026
@sipsma
Fix nested client session race (#13108)
74c2889
* Fix nested client session caller resolution

PR #13007 made nested clients fall back to parent sessions when their own session caller was not yet available. That solved the synthetic builtin Dang case, where the nested runtime does not open its own attachables but still needs host-backed services such as git config. The fallback was too broad though: normal nested clients also briefly have no registered session caller while their upgraded session connection is still being handed to BuildKit. During that window, exact session operations could accidentally use a parent caller or later fail with missing requester sessions.

Split exact client caller lookup from host-service caller lookup. Exact session operations now keep using the requested client ID and wait for that session. Host-backed service operations get a separate lookup path that may proxy to an explicitly configured ancestor, and only synthetic clients opt into that behavior through the nested-client server path.

Builtin Dang now passes an explicit host-service proxy opt-in when it creates its synthetic nested client. The server maps that to a concrete HostServiceProxyClientID on client initialization, validates that reused clients do not change proxy target, and resolves host-service callers through that explicit ancestor chain. Normal container-exec nested clients pass no proxy opt-in, so their exact session operations remain tied to their own session attachables.

Normal clients also wait for their own caller before executing GraphQL queries, which closes the race where workspace loading or return-value export could start before the session attachables were registered. The old sleep-based repro hook has been removed. Focused session, engineutil, core, schema, and sdk checks pass with the new exact-vs-host-service split.

Signed-off-by: Erik Sipsma <[email protected]>

* migrate + cleanup session manager code

The engine still routed client attachable connections through the root
internal/buildkit/session package. That kept real engine code tied to
BuildKit's Manager, Caller, and Attachable abstractions even though the
runtime session model is now Dagger-owned: clients connect to a Dagger
session, publish a set of attachable gRPC services, and engine code needs
to find the active caller for a client ID.

Replace that root BuildKit session dependency with a Dagger-owned session
attachables manager in engine/server. The manager tracks active callers by
client ID, records supported method URLs, wakes waiters when a caller
arrives or leaves, and closes callers from the actual attachable connection
lifecycle. The engine utility layer now depends on a small SessionCaller
interface with Conn and Supports methods instead of buildkit/session.Caller,
and server/client plumbing passes context-aware lookup functions directly.

Update the client-side attachable server naming to match the new model,
including ConnectSessionAttachables and SessionAttachablesServer. Keep the
existing auth, filesync, secrets, and sshforward protocols, but stop using
the root BuildKit session package for registration, caller lookup, or
manager state.

Move filesync sender construction into engineutil with platform-specific
helpers so callers no longer need the old session caller type just to send
a filesystem diff. The Unix implementation forwards the socket path through
the existing DiffCopy options and Windows keeps an explicit unsupported
stub.

Refresh session tests around the new manager behavior, including waiter
wakeups, context cancellation, reconnect replacement, and support lookups.
Remove obsolete cache test coverage that asserted BuildKit session-manager
wiring rather than current Dagger behavior.

Verification:
- dagger --progress=plain call engine-dev test --pkg ./core/integration --run='TestModule' passed.
- dagger --progress=plain call engine-dev test --pkg ./core/integration --run='TestContainer|TestDockerfile' was attempted and then stopped after known local Docker/kernel network failures dominated the run; no session-not-found, missing-shared-result, panic, or fatal signatures appeared in the log.

Signed-off-by: Erik Sipsma <[email protected]>

* remove grpcerrors session plumbing

The session attachables refactor still left a small amount of BuildKit-era gRPC plumbing in the production Dagger code. The attachables server and client were still installing the internal BuildKit grpcerrors interceptors, and a few session proxy implementations still used grpcerrors.Code when checking for canceled streams.

This removes those interceptors entirely and switches the remaining cancellation checks to the standard gRPC status.Code helper. Session attachables now use ordinary gRPC client/server setup without the custom error wrapper layer.

While touching this area, keep the earlier cleanup direction consistent by using engine/slog in the updated session and engineutil code, and keep the attachables client on grpc.NewClient instead of the deprecated grpc.DialContext path. This leaves real Dagger code detached from internal/buildkit/util/grpcerrors while preserving the observed cancellation behavior.

Verification:
- go test ./engine/client ./engine/server ./engine/engineutil ./engine/session/...
- dagger --progress=plain call engine-dev test --pkg ./core/integration --run='TestModule'

Signed-off-by: Erik Sipsma <[email protected]>

* gofmt session lint suppression

The gocyclo nolint added for getOrInitClient needed the formatting shape expected by gofmt around the preceding function comment. Running gofmt inserts the blank comment line between the function documentation block and the lint directive.

This is a formatting-only follow-up for the session race branch and does not change behavior.

Signed-off-by: Erik Sipsma <[email protected]>

---------

Signed-off-by: Erik Sipsma <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@vito vito vito approved these changes
@shykes shykes shykes approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@eunomie @shykes @vito
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.