Skip to content

heartbeat status in report mode - #13425

Merged
grouville merged 3 commits into
dagger:mainfrom
kpenfound:tui_report_heartbeat
Jun 12, 2026
Merged

grouville merged 3 commits into
dagger:mainfrom
kpenfound:tui_report_heartbeat

Conversation

@kpenfound

Copy link
Copy Markdown
Contributor

This drops a heartbeat status while in report mode. Agents using report mode (the default if CLAUDECODE=1) dont get enough feedback that their checks are still running, so this is an attempt to solve that.

Every 30s during report mode, a heartbeat will print like so

[dagger] 5m30s elapsed · checks: 8/20 done (1 failed) · running: go:test (5m29s), docs:lint (2m01s) (+3 more)

@kpenfound
kpenfound requested a review from vito June 11, 2026 18:14

@shykes shykes left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love it. Nice incremental improvement, we can layer more on top of needed - wdyt @vito

@grouville
grouville self-requested a review June 11, 2026 21:39

@grouville grouville left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM ✅

Added a small fix to a (very unlikely) race: if the report heartbeat ticked right as the command completed, it could still be writing a progress line while final rendering started, risking interleaved output. The stopper now waits for that in-flight heartbeat to finish, and the regression test covers that timing window.

@grouville
grouville force-pushed the tui_report_heartbeat branch from ae1c614 to 991dc32 Compare June 11, 2026 21:43
kpenfound and others added 3 commits June 11, 2026 17:16
Report mode starts a heartbeat goroutine so long-running commands still show
liveness. The stopper only closed the `done` channel, which requested shutdown
but did not wait for the goroutine to exit.

That left a timing window:

    Run goroutine                         heartbeat goroutine
    -------------                         -------------------
    close(done)  ---------------------->  asked to stop
    return from stopHeartbeat()
    FinalRender starts                    still inside Fprintln(...)

If the ticker fired at the same time the command completed, the heartbeat could
still be reading frontend state and writing to stderr while the final report was
rendering. That could interleave output and race with final rendering.

Fix this by treating the heartbeat goroutine as owned work:

    Run goroutine                         heartbeat goroutine
    -------------                         -------------------
    close(done)  ---------------------->  finish current write, then return
    wg.Wait()   <----------------------   wg.Done()
    FinalRender starts                    stopped

The returned stop function still uses `sync.Once` so callers can stop the
heartbeat more than once, but it now waits on a `sync.WaitGroup` before
returning.

Add a regression test with a blocking writer. The test waits until a heartbeat
write is in flight, calls `stopHeartbeat`, verifies it does not return while the
write is blocked, then releases the writer and verifies shutdown completes.

Signed-off-by: Guillaume de Rouville <[email protected]>
The Go toolchain source customization excluded the repository root `.git`
directory, but it did not exclude `.git` directories nested deeper in the
workspace. That left the generator vulnerable to local test artifacts that
look like embedded repositories.

The failure mode showed up while running `dagger generate
go:generate-dagger-runtimes` after the idtui telemetry goldens had created
`dagql/idtui/.git`. Those tests initialize a temporary git repository in the
package directory so Dagger calls can pick up stable module metadata, and they
clean it up at the end. If the test process is interrupted, the nested `.git`
directory can remain in the checkout.

`go:generate-dagger-runtimes` builds a source snapshot and returns a
`Directory.changes` result. The changeset implementation stages the snapshot
with git. When the snapshot contains a nested repository with no commit checked
out, `git add -A` treats that path as an embedded repository and fails with:

    error: 'dagql/idtui/' does not have a commit checked out

Exclude `**/.git` from the Go toolchain source argument so nested VCS metadata
never enters the generator input. This keeps the checked-in source content
unchanged while making the generator robust against local git metadata left by
tests, ad-hoc fixtures, or nested checkouts.

Signed-off-by: Guillaume de Rouville <[email protected]>
@grouville
grouville force-pushed the tui_report_heartbeat branch from 991dc32 to 9bca372 Compare June 12, 2026 00:16
@grouville
grouville merged commit d87b131 into dagger:main Jun 12, 2026
79 checks passed
@vito

vito commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Nice! Yeah I think this makes the report frontend way more useful.

marcosnils pushed a commit that referenced this pull request Jun 16, 2026
* checks heartbeat in report mode

Signed-off-by: kpenfound <[email protected]>

* dagql: wait for report heartbeat to stop

Report mode starts a heartbeat goroutine so long-running commands still show
liveness. The stopper only closed the `done` channel, which requested shutdown
but did not wait for the goroutine to exit.

That left a timing window:

    Run goroutine                         heartbeat goroutine
    -------------                         -------------------
    close(done)  ---------------------->  asked to stop
    return from stopHeartbeat()
    FinalRender starts                    still inside Fprintln(...)

If the ticker fired at the same time the command completed, the heartbeat could
still be reading frontend state and writing to stderr while the final report was
rendering. That could interleave output and race with final rendering.

Fix this by treating the heartbeat goroutine as owned work:

    Run goroutine                         heartbeat goroutine
    -------------                         -------------------
    close(done)  ---------------------->  finish current write, then return
    wg.Wait()   <----------------------   wg.Done()
    FinalRender starts                    stopped

The returned stop function still uses `sync.Once` so callers can stop the
heartbeat more than once, but it now waits on a `sync.WaitGroup` before
returning.

Add a regression test with a blocking writer. The test waits until a heartbeat
write is in flight, calls `stopHeartbeat`, verifies it does not return while the
write is blocked, then releases the writer and verifies shutdown completes.

Signed-off-by: Guillaume de Rouville <[email protected]>

* fix: ignore nested git metadata in go source

The Go toolchain source customization excluded the repository root `.git`
directory, but it did not exclude `.git` directories nested deeper in the
workspace. That left the generator vulnerable to local test artifacts that
look like embedded repositories.

The failure mode showed up while running `dagger generate
go:generate-dagger-runtimes` after the idtui telemetry goldens had created
`dagql/idtui/.git`. Those tests initialize a temporary git repository in the
package directory so Dagger calls can pick up stable module metadata, and they
clean it up at the end. If the test process is interrupted, the nested `.git`
directory can remain in the checkout.

`go:generate-dagger-runtimes` builds a source snapshot and returns a
`Directory.changes` result. The changeset implementation stages the snapshot
with git. When the snapshot contains a nested repository with no commit checked
out, `git add -A` treats that path as an embedded repository and fails with:

    error: 'dagql/idtui/' does not have a commit checked out

Exclude `**/.git` from the Go toolchain source argument so nested VCS metadata
never enters the generator input. This keeps the checked-in source content
unchanged while making the generator robust against local git metadata left by
tests, ad-hoc fixtures, or nested checkouts.

Signed-off-by: Guillaume de Rouville <[email protected]>

---------

Signed-off-by: kpenfound <[email protected]>
Signed-off-by: Guillaume de Rouville <[email protected]>
Co-authored-by: Guillaume de Rouville <[email protected]>
social4hyq pushed a commit to social4hyq/homebrew-core that referenced this pull request Sep 20, 2026
dagger 0.21.7

Created-by: HarmonybrewBot
Commit-by: HarmonybrewBot
Merged-by: HarmonybrewBot
Description: Created by `brew bump`

---

Created with `brew bump-formula-pr`.<details>
  <summary>release notes</summary>
  <pre>## v0.21.7 - 2026-06-17

### Changed

- Bump default CNI IP address pool size to reduce address exhaustion under high container concurrency. by @sipsma in dagger/dagger#13394
- Bump Dang to v2.1.1, moving JSON encoding behind the `JSON` namespace (with a deprecated top-level `toJSON`) and picking up constructor scope and nullable input fixes. by @vito in dagger/dagger#13482

### Fixed

- `.env` file handling so non-matching variables are kept as hidden expansion context instead of being dropped, allowing later variables to expand against them. by @marcosnils in dagger/dagger#13490
- Filesync so syncing a re-included file under a gitignored directory (e.g. `foo/` ignored with `!foo/bar.txt`) no longer fails with `no such file or directory`; ignored parent dirs are now created on demand for visible descendants. by @grouville in dagger/dagger#13439
- A concurrent map panic during GC by guarding session client map iteration, preventing fatal `concurrent map iteration and map write` crashes. by @sipsma in dagger/dagger#13474
- Go SDK codegen so SDK auth config is forwarded to typedef generation, allowing modules with private transitive Go dependencies to resolve during codegen. by @grouville in dagger/dagger#13457
- Core enum handling to preserve conventional enum member names. by @shykes in dagger/dagger#13435
- The Apple `container` driver to honor the privileged option by granting all capabilities (`--cap-add ALL`), so the engine can bind-mount `/etc/resolv.conf` on startup with `container` 1.0.0's reduced default capability set. by @eunomie in dagger/dagger#13460
- Dang directive argument resolution so `@cache` (and other directive) arguments resolve against the declaring type's file scope, fixing `FunctionCachePolicy not found in env` errors in multi-file modules. by @vito in dagger/dagger#13455
- The report-mode heartbeat so it waits for its goroutine to exit before final render, avoiding interleaved output. by @kpenfound in dagger/dagger#13425
- Nullable result unwrapping for SDK input so nullable values are passed correctly into SDK functions. by @shykes in dagger/dagger#13401

### What to do next?

- Read the [documentation](https://docs.dagger.io)
- Join our [Discord server](https://discord.gg/dagger-io)
- Follow us on [Twitter](https://twitter.com/dagger_io)

</pre>
  <p>View the full release notes at <a href="https://github.com/dagger/dagger/releases/tag/v0.21.7">https://github.com/dagger/dagger/releases/tag/v0.21.7</a>.</p>
</details>
<hr>

See merge request: Harmonybrew/homebrew-core!11763
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.

4 participants