Skip to content

dagui: read a call the same when later lazy evaluations link the first one - #14874

Merged
sipsma merged 3 commits into
mainfrom
sipsma/dagui-follow-lazy-evaluation-chains
Oct 27, 2026
Merged

sipsma merged 3 commits into
mainfrom
sipsma/dagui-follow-lazy-evaluation-chains

Conversation

@sipsma

@sipsma sipsma commented Oct 27, 2026

Copy link
Copy Markdown
Contributor

What changes

Nothing visible with today's engines. Their traces read exactly as before.

When the engine runs deferred work for a lazy result, such as a withExec that only runs once its output is read, it starts a hidden "resume …" or "open stored part (…)" span. Today every such span carries cause links to the call that returned the result and to every span that installed it. The UI uses those links to show the call's pending state, failure, running time and waiting time.

With this change, the UI also reads the call correctly when only the result's first evaluation carries those links, and later evaluations link that first one instead:

  • a complete evaluation anywhere in the chain clears the call's pending state;
  • waits recorded on any evaluation in the chain count toward the call's waiting time, and their blockers resolve to the call;
  • failure, running state, activity and rollup counts pass through the chain to the call. They don't go to the earlier evaluation, or to the unrelated call that happened to start it;
  • if an evaluation arrives after later ones that link it, as happens with incremental loading, their status is propagated again through it.

Only lazy evaluation spans are followed. Released engines link every evaluation to the call, and none of them puts a cause link on a lazy evaluation span, so their traces take the same paths through the reader as before.

Why

A result's evaluations each carry the same, often long, list of links. On large module workloads, each part of a remote-cached result is evaluated as its own span, and the repeated links grow engine memory and telemetry upload volume considerably. A follow-up engine change will put the full list only on a result's first evaluation per session, and have later ones link that first evaluation. This reader change ships first, so CLIs reading traces from that engine show the same thing.

Tests

TestResumeChainReadsLikeDirectResumes (dagql/dagui) records the same lazy evaluation in both shapes and requires identical readings:

  • What it reads: the call's pending state and reason, running state, failure, active time, time breakdown and rows, plus the activity of the calls that started each evaluation.
  • Cases: the later evaluation succeeds, fails or is still running; all spans arrive in one batch, or the first evaluation arrives in a later batch; three span-name combinations, including a first evaluation that opened a stored part.

All 18 cases fail without the change. Each of the four reader changes, reverted alone, fails exactly the cases it covers. The test runs in the test-split/test-packages check.

Known limit

Rollup counts (the collapsed-row density dots) are kept incrementally. They don't move to ancestry discovered after a span was counted. If a later evaluation arrives before the first one, its counts don't reach the call. This already happens today whenever a span arrives before its parent. It doesn't affect pending state, failure, activity or timing.

A lazy result can be evaluated more than once, for example first for
its metadata and later in full. Each evaluation is a hidden span with
cause links to the call that returned the result. Test that the call
reads the same when only the first evaluation links the call and later
ones link the first: its pending state, failure, running and active
time, waiting time and rows, and the activity of the calls that started
each evaluation. Cover later evaluations that succeed, fail or still
run, and the first evaluation arriving in a later batch.

Signed-off-by: Erik Sipsma <[email protected]>
A later evaluation of a lazy result may link an earlier evaluation
rather than the call that returned the result. Read the call the same
as if every evaluation linked it directly:

- a complete evaluation anywhere in the chain resolves the call's
  pending state;
- the waits of every evaluation in the chain are the call's, and a
  blocker resolves through the chain to the call;
- status, activity and rollup counts pass through evaluations in the
  chain to the call, not to an earlier evaluation or the call that
  started it;
- when an evaluation arrives after later ones that link it, their
  status is propagated again through it.

Only lazy evaluations are followed. Today's engines link every
evaluation to the call, so their traces read as before.

Signed-off-by: Erik Sipsma <[email protected]>
@grouville
grouville self-requested a review October 27, 2026 07:08
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.

2 participants