Repository navigation
cli: fix memory, duplicate logs and dropped collector spans; fix two dagger check reports - #15100
Merged
Merged
Conversation
sipsma
added a commit
that referenced
this pull request
Nov 7, 2026
Five of the fixes change what users see. The dagger check report fix restores behavior from before #15088, which hasn't been released, so it has no entry of its own. Signed-off-by: Erik Sipsma <[email protected]>
tiborvass
approved these changes
Nov 9, 2026
sipsma
added a commit
that referenced
this pull request
Nov 9, 2026
Four of the fixes change what users see. The CLI CPU fix reached main with #15080, which added no entry, so its entry names #15080. The dagger check report fix restores behavior from before #15088, which hasn't been released, so it has no entry of its own. Signed-off-by: Erik Sipsma <[email protected]>
sipsma
force-pushed
the
sipsma/cli-fixes-memory-logs-checks
branch
from
November 9, 2026 20:48
3718dc0 to
773eb58
Compare
Since collection items are grouped under one check, the failing report's RUN LOCALLY section named the group, which reruns the whole collection. Suggest the address of each failed item instead, as before the grouping. The native CI re-run still targets the group, the unit Cloud reports. Signed-off-by: Erik Sipsma <[email protected]>
A zoom to one collection item scopes the surfaced checks to that item, so the CI re-run line named the item instead of its group. Find the group through the item's span ancestors instead. Name the test's items the way the engine does. Signed-off-by: Erik Sipsma <[email protected]>
Since collection items are grouped under one check, the report's top CHECKS header counted the whole collection as one check, so a run with several failing items read "1 failed" while the nested header held the real totals. Count a group as the items that ran, as the tally read before the grouping. Signed-off-by: Erik Sipsma <[email protected]>
'dagger check <name>' decided that nothing matched by counting the results of the checks it ran. A check whose collection has no items, such as a Go test check in a repository without tests, runs nothing, so it failed with "no checks matched pattern" even though 'dagger check -l' lists it. When a run produces no results and the command names no collection keys, in an address or a dimension flag, and skips no items by key, every selected check was fully expanded and has no items. The run then passes and says on stderr that each check has no items to check. Patterns that select no check, and keys or keyed skips that leave out every item, still fail with the existing error. Signed-off-by: Erik Sipsma <[email protected]>
A span's log kept every byte twice for the whole run: the raw bytes, and a midterm screen that stores each character as a rune plus its format. That's about 7.5 bytes of heap per byte logged, and most logs are never shown. A long test run streams hundreds of megabytes of logs, mostly the results of calls that return strings, which the engine logs onto their spans, so the CLI grew by gigabytes. Now a log of plain writes keeps only its raw bytes until something reads its screen (drawing it, a report, the pager, a search), which replays them into a new screen. Resizes made before then are replayed where they happened, since midterm doesn't reflow rows already written. What is shown doesn't change. Signed-off-by: Erik Sipsma <[email protected]>
The CLI forwards every engine span it receives to each of its span processors, including the one for a collector configured with OTEL_EXPORTER_OTLP_*. telemetry.Init's Detect gave that collector the OpenTelemetry SDK's default batch processor, whose 2048-slot queue drops spans without a word when full. A burst of forwarded engine spans then arrives at the collector cut short: in a reproduction forwarding 5,000 finished spans to a local collector, 2,560 arrived. Configure the collector's exporters in the CLI instead, as it already does for Cloud, and give its spans the same 16Ki-slot bounded queue as the Cloud exporter. Batches keep the SDK's default size, since a collector may limit how large a request it accepts. Logs and metrics are set up as Detect did. Signed-off-by: Erik Sipsma <[email protected]>
The queue for a collector configured with OTEL_EXPORTER_OTLP_* is bounded, and drops spans rather than stall the build when a burst outgrows it. Count what it takes in and hands on, as the engine does for its own span queues, and once telemetry has shut down tell the user on stderr how many spans never reached the collector's exporter: those dropped when the queue was full, and any still queued when exiting ran out of time. Signed-off-by: Erik Sipsma <[email protected]>
The warning was written while the pretty frontend could still own the terminal. On a terminal without synchronized output it may be drawing on the alternate screen, and stopping the TUI then restores the normal screen, losing the warning. Report it once Frontend.Run has returned, after the final render, from both places that set up engine telemetry. Signed-off-by: Erik Sipsma <[email protected]>
A CLI run in an exec with privileged nesting, or under `dagger run`, joins its parent's session as a nested client. The engine writes a nested client's spans, logs and metrics to every ancestor client's store as well as its own, so the parent already receives everything the engine streams to the nested CLI. The nested CLI also forwarded that stream to the collector exporters it configures from OTEL_EXPORTER_OTLP_*, which lead to the same parent: the exec's telemetry proxy, or the parent CLI's. Spans are stored by ID, so the second copy went unnoticed, but every log record reached the parent, its frontend and Dagger Cloud twice: each call result and each exec's output under a nested CLI showed up doubled. A nested client now forwards the engine's telemetry without the collector exporters. Its own telemetry still goes to them, and it still shows the stream and publishes it to Cloud as before. Signed-off-by: Erik Sipsma <[email protected]>
Four of the fixes change what users see. The CLI CPU fix reached main with #15080, which added no entry, so its entry names #15080. The dagger check report fix restores behavior from before #15088, which hasn't been released, so it has no entry of its own. Signed-off-by: Erik Sipsma <[email protected]>
golangci-lint flagged three spots in this PR's changes. The new dagger check helpers deliberately answer "keyed" when a key doesn't resolve, so the run reports its own error. The rerun section grew past the complexity limit with the collection-item suggestions. The telemetry config test needs only the config. Signed-off-by: Erik Sipsma <[email protected]>
sipsma
force-pushed
the
sipsma/cli-fixes-memory-logs-checks
branch
from
November 9, 2026 21:38
773eb58 to
4f27d6c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Five CLI fixes, each in its own commit or commits. Three make the CLI cheaper and more reliable on large runs and with telemetry. Two fix
dagger checkoutput.CLI memory on heavy runs
The CLI kept every log twice: as raw output, and as a terminal screen built as it arrived, even for logs nothing ever shows. Now a log's screen is built only when something shows it.
On a heavy run (nine
core/integrationsuites against a dev engine), peak CLI memory:On the same run, CLI CPU time writing to a file went from 208 s to 147 s. Wall time was not slower: 693 s to 615 s to a file, 807 s to 620 s at a terminal. That is one run per mode, so the wall-time gain may be noise.
Cost: searching in the TUI builds every log's screen, so for the rest of that run memory returns to what it was before.
CLI CPU while many spans are running (now in #15080)
This PR first carried a fix for the CLI's CPU use while thousands of spans are running. #15080 merged the same change, so the commit left this PR at its rebase. Its changelog entry, which #15080 didn't add, is here and names #15080. With that fix alone, a heavy run's CLI kept up with the engine's telemetry but held so much of it that it was killed for memory on a 16 GB machine. The memory fix above cuts what the CLI holds.
Logs sent twice under a nested CLI
A
daggerCLI run inside a container, or underdagger run, joins its parent's session. The engine already sends that nested CLI's telemetry to the parent, but the nested CLI also forwarded the engine's stream to the parent's collector. Every log record, such as a call result or an exec's output, reached the parent's display and Dagger Cloud twice. The nested CLI now forwards the engine's stream without that collector; its own telemetry still goes there.On the
TestCallsuite, the CLI exported 15,747 duplicate log records before (34 MB, 29% of that suite's log text) and none after. Total log text went from 118 MB to 83 MB.Tradeoff: if a user points a nested CLI at their own collector (with
OTEL_EXPORTER_OTLP_*set inside the container, or underdagger run), that collector no longer receives the nested CLI's engine-side records, only the CLI's own telemetry. The top-level CLI's collector still receives everything.Spans dropped on the way to your own OpenTelemetry collector
A collector configured with
OTEL_EXPORTER_OTLP_*got the OpenTelemetry SDK's default span queue of 2,048, which silently drops a burst of the engine spans the CLI forwards. It now gets the same bounded queue of 16,384 spans as the Dagger Cloud exporter. In a reproduction forwarding a 5,000-span burst to a collector, 2,560 spans arrived before and all 5,000 after.Bursts beyond 16,384 still drop, as they do for Dagger Cloud. When any do, the CLI now says so on stderr after its final output:
Cost, only while the collector falls behind a burst: up to about 8x more spans held in memory (17 MiB instead of 4 MiB in the test), and a longer flush at exit (6.8 s instead of 1.0 s with a collector taking 200 ms per request, still capped at 30 s). It never blocks the command. Log export to the collector is unchanged.
dagger check <name>on a check with no itemsA check whose collection has no items failed with
no checks matched pattern. It now passes with nothing run, and prints on stderr:This matches what Dagger Cloud CI does for such checks. A name that matches no check still fails, and so do collection keys or
--skipfilters that leave out every item.dagger checkreport after #15088#15088 grouped a collection's checks under one check, which changed two parts of the report. This restores what came before it, while keeping the items nested under their collection. For a collection
packages/tests/verifywhose items Foo and Bar both fail:dagger checkline per failed itemdagger check "packages/tests/verify", which reruns the whole collectiondagger checkline per failed itemThe "RE-RUN IN CI" line still names the collection, which Dagger Cloud reports as the group. Only the report text changes.
Notes for review
internal/cmd/daggerunit tests, and the check and nested-CLI tests incore/integration.dagger check -lof dagger/dagger in under 5 s: per-package Go builds, a pre-warmed engine cache, and faster module loading and check planning #15080.