Skip to content

Address.container resolves a dag:// module setting once per call, so every check re-resolves it #14926

Open

Description

@yasyf

What is the issue?

When a workspace wires one module's setting to another module's function with a DAG address, the setting is re-resolved for every artifact evaluation. On a large workspace, that alone takes most of a check run.

[modules.go-tests.settings]
base = "dag://toolchain/go-runtime"

Address.container is registered with WithInput(dagql.PerCallInput) (core/schema/address.go), so each resolution gets a random call ID and dagql never reuses it. resolveModuleRef then runs Workspace.artifacts(include: [path]).filterUri(uri).one() again, which globs the address against every artifact of the target module before evaluating it. The plain progress shows this as "<artifact>".Glob("toolchain/go-runtime") -> no match, once for every artifact on every resolution.

Each check rebuilds the module object, so each check re-resolves base. The random input also gives every downstream call ID a new value, so method calls on the module object never dedupe within the session.

Measured

Dagger main 8afd98b, one m6id.16xlarge engine, warm cache, a commit that changes only README.md:

  • One dagger check of a 364-check Go module does 999 Address.container resolutions of its dag:// base: median 14.2 s each, 14,708 s summed. Its first check starts 40-46 s into the run.
  • During that window the engine is at about 3% CPU, and raising -j from 48 to unlimited gains 12%.

Proposed fix

Resolve Address.container once per session with dagql.PerSessionInput. An address binds to the session's workspace, which does not change within the session, so a per-session result cannot go stale.

With that one-line change, on the same engine and workspace (every module checked, fresh content each run, two runs per arm):

Change PerCallInput PerSessionInput
README-only 345.6 s, 452.9 s 157.7 s, 148.4 s
TypeScript-only 489.4 s, 608.2 s 272.4 s, 286.3 s
Go-only 752.8 s, 873.5 s 547.9 s, 545.5 s

Related: #14903.

Dagger version

main 8afd98b (v1.0.0-beta.22)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions