Repository navigation
fix(dash): show the text behind the header warning badge - #793
Conversation
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>
juhovainio
left a comment
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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).
There was a problem hiding this comment.
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>
|
Thanks for the review. Pushed c9e9dc7 for the inline comments (replies are in each thread). On the smaller notes in the review body:
|
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>
f11675c to
018d656
Compare
juhovainio
left a comment
There was a problem hiding this comment.
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 theOpenWarningsaction. !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:linuxonly; a short note on why Windows is excluded would help. - Nit: the
draw_footercomment 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).
| // 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!( |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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>
|
Thanks for the approval. The On the other notes:
|
tests/e2e-cucumber/expectations.tomlfor the fixed ticket ID and removed/narrowed any now-stale xfail rows. (No row concerns this issue.)docs/architecture.md. (Not applicable: a popup inside the existing dash TUI.)(!)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
⚠ Nwhen 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 (agpu_idsjoin 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.Helpmodal: it overlays and dims the screen, is sized to its content, and swallows keys other than quit and close.(!)only where the key works. The click is gated like the footer chips, through a sharedAppState::global_hotkeys_reachable, so it never opens over an open modal, a manager overlay, a pending approval, the quit prompt or focused chat input.Help, because a title marker is silently dropped on popups narrower than about 38 columns.Verification
mainfailed); the popup renders it.dash-38replays 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.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 --checkandprek runpass.Not verified: the badge click in a real terminal (it is tested by sending mouse events to
resolve_mouseand 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 thatdash-38already exercises.Scope
Helpis 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.Escmenu → Help) does not list!: it has no spare row at 80x20, where an added row is cut. The contextual?help lists it.