Skip to content

fix(dash): show the text behind the header warning badge - #793

Merged
jussielo-amd merged 5 commits into
ROCm:mainfrom
jussielo-amd:fix/dash-warnings-popup
Oct 29, 2026
Merged

jussielo-amd merged 5 commits into
ROCm:mainfrom
jussielo-amd:fix/dash-warnings-popup

Conversation

@jussielo-amd

Copy link
Copy Markdown
Collaborator
  • If this PR fixes a bug, searched tests/e2e-cucumber/expectations.toml for the fixed ticket ID and removed/narrowed any now-stale xfail rows. (No row concerns this issue.)
  • If this PR adds a new subcommand or subsystem, its domain implementation lives in its own file per docs/architecture.md. (Not applicable: a popup inside the existing dash TUI.)
  • Every new or changed user-facing message was read against the code path that runs after it, and its test asserts the resulting state — not only the wording — per AGENTS.md §3. (The (!) key hint, the "N more line(s)" count and the truncation marker are each asserted together with the state they describe; see Verification.)

Why

Fixes #286. The dashboard header shows ⚠ N when the daemon reports warnings, but nothing lets the user read them. The warning text is drawn in exactly one place, the GPUs panel on the Observe tab, and only while no GPU is reported. So on the default Home tab the badge is a dead end, and a warning that appears next to a working GPU (a gpu_ids join that matches nothing, a VRAM attribution fallback, a failed scrape) is shown on no screen at all.

What changes

Clicking the badge, or pressing !, opens a Warnings popup that lists the current warnings in full, from any tab. Esc, Enter or ! closes it.

  • The popup follows the existing Help modal: it overlays and dims the screen, is sized to its content, and swallows keys other than quit and close.
  • The badge advertises (!) only where the key works. The click is gated like the footer chips, through a shared AppState::global_hotkeys_reachable, so it never opens over an open modal, a manager overlay, a pending approval, the quit prompt or focused chat input.
  • The badge moves to just after the brand, ahead of the connection target and status. At 80 columns those two already fill the header, so a trailing badge was cut off along with its click target.
  • A warning with several lines (a failed amd-smi call carries its raw stderr) is split into rows and cut to four lines with a count of the rest, so one warning cannot push the others off a popup that does not scroll. A warning only one line over the cap is shown whole.
  • On a terminal too short for everything, the close hint goes first; only when the warnings themselves do not fit does the last row say "truncated — resize". That marker is in the body, not the border title as in Help, because a title marker is silently dropped on popups narrower than about 38 columns.

Verification

  • With a GPU and a warning in the snapshot, the unmodified dashboard renders the warning text on no screen (a unit test against main failed); the popup renders it.
  • New cucumber scenario dash-38 replays a recording that carries one warning next to a working GPU and reads the text through the popup, under a real PTY at the pinned 80x24. It passes.
  • Deleting the chat-focus term of global_hotkeys_reachable, deleting the gate from the badge click, shifting the badge's click region by one column, raising the line cap, flipping the > at the cap boundary, and drawing the marker over the last body row each fail at least one new test.
  • cargo test --workspace --all-targets (4576 tests), cargo clippy --workspace --all-targets -- -D warnings, cargo fmt --check and prek run pass.

Not verified: the badge click in a real terminal (it is tested by sending mouse events to resolve_mouse and by asserting the stored region against the drawn badge), and a live daemon on WSL producing the warnings from the issue. The cap and the truncation marker are covered by unit tests rather than a Gherkin scenario, since they are rendering details of a popup that dash-38 already exercises.

Scope

  • The Observe GPUs panel is unchanged: it still shows the warnings in full when no GPU is reported.
  • The popup does not scroll. Warnings are few and short-lived, and Help is sized the same way; the line cap keeps one long warning from hiding the rest. A scrollable popup could reuse the instance detail modal's handling if that proves too tight.
  • ! is the only keyboard route to the popup, next to the click. An Esc-menu row would add a keyboard path that does not depend on a letter, and is left for a follow-up.
  • The global keyboard card (Esc menu → Help) does not list !: it has no spare row at 80x20, where an added row is cut. The contextual ? help lists it.
  • With the badge ahead of the status, a long connection line is what gets truncated at 80 columns instead of the badge.

The header showed "⚠ N" when the daemon reported warnings but gave no way to
read them. The text was drawn in one place only, the Observe tab's GPUs panel,
and only while no GPU was reported, so a warning next to a working GPU (an
unmatched gpu_ids join, a VRAM attribution fallback, a failed scrape) was
visible nowhere.

Clicking the badge, or pressing `!`, now opens a Warnings popup that lists every
current warning in full, from any tab. The badge advertises the key only where
it works, and the click is gated like the footer chips: it never fires over an
open overlay, a pending approval, the quit prompt or focused chat input, where
opening the popup would discard what owns the screen.

The badge moves to just after the brand. At 80 columns the connection target
and status already filled the header, so a trailing badge was cut off.

Adds a dash cucumber scenario (dash-38) that replays a recording with a warning
and a GPU and reads the text through the popup.

Signed-off-by: Jussi Elo <jussi.elo@amd.com>
Round of review follow-ups on the warnings popup:

- `OpenWarnings` replaces the toggle action. Closing is already `CloseModal`
  from the popup's own key arm, so the close branch could never run. The
  action also no longer closes overlays: both entry points are gated, and a
  debug assertion now pins that.
- Multi-line warnings (an amd-smi failure carries its raw stderr) are split
  into rows and cut to four lines with a count, so one of them cannot push
  the others off a popup that does not scroll. A warning only one line over
  the cap is shown whole.
- On a terminal too short for everything, the close hint is dropped before
  any warning is cut, and the truncation marker moves from the border title,
  which is dropped on narrow popups, to the last body row.
- Tests: the chat-typing gate is exercised with chat accepted and focused on
  and off, so deleting its tab check or its focus check now fails a test;
  the badge region is asserted exactly, including its padding; the cap, its
  boundary and the marker row are pinned. Stale comments are corrected.

Signed-off-by: Jussi Elo <jussi.elo@amd.com>
@jussielo-amd
jussielo-amd marked this pull request as ready for review October 29, 2026 10:52
@jussielo-amd
jussielo-amd requested a review from a team as a code owner October 29, 2026 10:52

@juhovainio juhovainio left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I went through this PR and found nothing that blocks merge, but there are a few things worth tightening, left as inline comments. Please also check the Strix Halo Ubuntu nightly/release E2E failures (I could not see the logs) to confirm dash-38 is not among them.

Smaller notes: the debug_assert in the open-warnings action only catches a future caller that skips the gate in debug builds, it does not guard release builds. The badge click region may be off by one column on terminals that draw the warning glyph two cells wide.

fn warning_lines<'a>(warning: &'a str, theme: &Theme) -> Vec<Line<'a>> {
let bullet = Style::default().fg(theme.warn);
let text = Style::default().fg(theme.fg);
let all: Vec<&str> = warning

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Warning text (often raw amd-smi stderr) goes into Spans unfiltered. Control characters/ANSI escapes in it would reach the terminal; consider stripping control chars (keep the line split) before rendering.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Checked this against the renderer rather than adding a filter: ratatui-core 0.1.2 drops any grapheme containing a control character when it writes the buffer (Buffer::set_stringn) and when it iterates a span's graphemes for a Paragraph (Span::styled_graphemes), and the crossterm backend prints the buffer's cell symbols. So an ESC, BEL, CR, DEL or C1 byte in a warning never reaches the terminal; what is left is the harmless printable residue (e.g. [31m). A second filter here would duplicate that, so instead c9e9dc7 adds warnings_modal_paints_no_control_character_from_a_warning, which paints a warning full of escapes and asserts no control character lands in the buffer while the surrounding text survives. If ratatui ever stops filtering, that test trips and a filter belongs here.

if all.is_empty() {
return vec![Line::from(Span::styled("• ", bullet))];
}
let shown = if all.len() <= WARNING_MAX_LINES + 1 {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The cap counts source lines, not wrapped rows, so one very long single-line warning can still fill a popup that does not scroll. The truncation marker covers it, but the doc comment's guarantee is narrower than it reads.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Agreed, the doc comments read as a wider guarantee than the code gives. c9e9dc7 rewords WARNING_MAX_LINES and draw_warnings to say the cap counts lines of the warning's text, not the rows they wrap to, that a warning one line over the cap is shown whole, and that a popup which runs out of room says so with its truncation marker. The behaviour is unchanged.

# reached when nothing else owns the keyboard, which is the event loop's
# existing arm order and is not re-tested here.
@id:dash-warning-badge-opens-the-warning @requires-os:linux
Scenario: dash-38 - A user reads the warning behind the header badge

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Scenario covers ! only; the click path and the (!) hint are unit-only, as the comment says. Fine, but confirm this lane runs on the Linux PTY lanes that passed (Strix Halo nightly/release E2E are red; check dash-38 is not in the failures).

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

dash-38 passes on every Linux lane that reached it. In the CI E2E tests job it is green, and in the self-hosted run it is green on both Strix Halo Ubuntu lanes (nightly and release): all nine steps pass, logged at 10:18 UTC. Those two jobs ended as cancelled, not failed, at about 10:48 UTC while still in the serve-* scenarios (serve-27, an AIM restart); the ✘ steps in their logs are serve-* and model-name scenarios that need a served model, none in dash. The MI300X and W7900 jobs are still queued, so they have not run dash-38 yet.

The cap is on lines of a warning's text, not on the rows they wrap to, so one
very long line can still fill a popup that does not scroll; the doc comments
claimed more than that. Also pin that a control character in warning text
cannot reach the terminal: ratatui drops it when writing the buffer, so the
popup needs no filter of its own, and a test now trips if that changes.

Signed-off-by: Jussi Elo <jussi.elo@amd.com>
@jussielo-amd

Copy link
Copy Markdown
Collaborator Author

Thanks for the review. Pushed c9e9dc7 for the inline comments (replies are in each thread). On the smaller notes in the review body:

  • debug_assert in the open-warnings action: agreed that it only guards debug builds. Release builds are protected by the callers: the ! key arm only runs when nothing owns the keyboard, and the badge click goes through global_hotkeys_reachable, both covered by unit tests. The assert is a tripwire for a future caller, not the gate.
  • Badge click region on terminals that draw ⚠ two cells wide: the region is the badge span's width as ratatui measures it, which is also how every other header glyph (⏸, ▶, ×, ·) is laid out. A terminal that renders ⚠ wider than that shifts the rest of the header too, not just the click region, so I have left it as is rather than special-casing one glyph.
  • Strix Halo Ubuntu nightly/release: dash-38 passed on both before those jobs were cancelled during serve-27; details in the thread on the feature file.

clippy::too_long_first_doc_paragraph, denied by the workspace's
`-D warnings`, rejected the summary paragraph of `draw_warnings`. Split it
into a one-line summary and the detail that followed it.

Signed-off-by: Jussi Elo <jussi.elo@amd.com>

@juhovainio juhovainio left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I read through this PR and found nothing blocking. Reusing the shared global_hotkeys_reachable gate for both the footer and the badge click avoids duplicating logic, the popup is built on the existing popup helpers, and the (!) hint, the "N more line(s)" marker and the truncation marker are each asserted together with the state they describe. dash-38 covers open and close end to end. Scope matches #286.

A few non-blocking notes:

  • One inline comment on the debug_assert! in the OpenWarnings action.
  • ! is the only keyboard route and needs Shift on many non-US layouts. Fine given the Esc-menu row is deferred, but worth a follow-up ticket.
  • dash-38 is @requires-os:linux only; a short note on why Windows is excluded would help.
  • Nit: the draw_footer comment rewrap leaves a short orphan line.

This reflects a diff-only read, not a build or a real-terminal click test; CI was green on everything completed when I checked (windows-build-and-test was still running).

Comment thread crates/rocm-dash-tui/src/app/actions.rs Outdated
// on `global_hotkeys_reachable`. So there is nothing open to close first;
// an opener that skipped that gate would hide the popup under an approval.
KeyAction::OpenWarnings => {
debug_assert!(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This debug_assert! panics in debug and test builds but is a no-op in release, so the two profiles disagree if a caller ever skips the gate. An early if !state.global_hotkeys_reachable() { return; } would behave the same in both. Non-blocking.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Agreed, and done in c3a60ee: the action now returns early unless global_hotkeys_reachable() holds, so debug and release behave the same. I used the full gate rather than only overlay_or_approval, since both callers (the ! arm and the badge click) already satisfy it. opening_warnings_is_refused_while_something_else_owns_the_keyboard covers an open modal, a pending quit prompt and focused chat input.

…the keyboard

The open-warnings action only asserted its gate in debug builds, so a
future caller that skipped it would behave differently in release. Check
the gate at runtime instead, and cover the modal, pending prompt and
focused chat cases. Also rewrap a footer comment that left a short line.

Signed-off-by: Jussi Elo <jussi.elo@amd.com>
@jussielo-amd

Copy link
Copy Markdown
Collaborator Author

Thanks for the approval. The debug_assert! and the draw_footer comment orphan line are addressed in c3a60ee.

On the other notes:

  • dash-38 is @requires-os:linux like every scenario in dash.feature: the feature header already records that the PTY-driven dashboard scenarios are Linux-only until the ConPTY path is promoted to a blocking contract, so I did not repeat that on this scenario.
  • ! being the only keyboard route (Shift on many non-US layouts) is noted for a follow-up alongside the deferred Esc-menu row.

@jussielo-amd
jussielo-amd added this pull request to the merge queue Oct 29, 2026
Merged via the queue into ROCm:main with commit 1f4eed1 Oct 29, 2026
24 checks passed
@jussielo-amd
jussielo-amd deleted the fix/dash-warnings-popup branch October 29, 2026 14:36
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.

[Issue]: Dashboard warning badge shows count (⚠ 1) but not the warning message

2 participants