Skip to content

feat(tui): tool detail, live tails, errors and diffs render in the code panel (U7) - #115

Merged
lg2m merged 4 commits into
feat/eng-855-u6-turn-geometryfrom
feat/eng-856-u7-tool-panels
Sep 22, 2026
Merged

lg2m merged 4 commits into
feat/eng-855-u6-turn-geometryfrom
feat/eng-856-u7-tool-panels

Conversation

@lg2m

@lg2m lg2m commented Sep 22, 2026 •

Copy link
Copy Markdown
Collaborator

U7: tool detail, live tails, errors and diffs render in the code panel

Spec: docs/plans/tui-redesign.md#s7-tool-rows-and-detail (detail bullets) Linear: ENG-856 (parent ENG-843)

Stacked on #111 (U6). Review the top three commits only until #111 merges.

What changed

  • Every expanded tool body, error tail, live output tail, edit diff, and MCP argument block renders inside the S4 code panel: ┃ rail in border on surface, padding cell, character-wrapped content with ↪ on continuation rows, blank surface rows above and below. Output is visibly output.
  • One panel implementation. markdown::panel_rows / panel_rows_at serve fenced code and tool detail; tool panels sit at the content column with their margin carried in Line::indent (no per-row span).
  • Timing line stays muted above the panel. Error text keeps the error foreground on the surface. Diff +/- rows keep line numbers and add/remove backgrounds inside the panel (a span's own background wins over the surface). Live output panels have their padding rows from the first frame so nothing jumps on completion. No label (the summary row already names the tool).
  • Row budgets unchanged: each detail kind shows the same content rows; each expanded call gains exactly TOOL_PANEL_PADDING_ROWS (2). Approval block untouched.
  • Review pass (second commit): PanelStyles reads the theme once per panel instead of once per row; wrap::indent_lines dropped a row's own indent when prefixing (latent, surfaced by the inspector) — fixed with a regression test.

Before / after (tools-expanded-120x40)

before                                    after
 ● Run    cargo test -p crate_2            ● Run    cargo test -p crate_2
     → 00:00:00                                → 00:00:00
     test result: ok. 12 passed                ┃
                                               ┃  test result: ok. 12 passed
                                               ┃

Goldens

  • Moved: tools-expanded-* (all five): gutter/tint columns and +2 rows per expanded call; 80×24 and 120×40 are tail-anchored so earlier rows scroll off.
  • Unchanged: approval-* and every other family.

How verified

  • cargo test -p qq-tui --all-features 306 lib + 6 golden; fmt; clippy -D warnings.
  • New tests: timing line above a surface panel; live tail keeps its padding rows as it grows; error color on surface; diff tints + line numbers inside the panel; ↪ on wrapped rows; budget = N + 2 against the constants; indent_lines keeps a row's margin. The L3 same-content (inline vs inspector) golden test passes.

Measurements (target/qq-perf/tui-U7-2026-09-21/after-cached.txt, core 5; host shared with another lane's training job, load 4–10)

Gate Parent U7 uncached U7 (this PR) Budget
tool_calls_32_expanded (best of 3) 53.9 µs 77.6 54.3 ±5 %
tool_calls_32_expanded_inspector ~39 43.6 39.0 ±5 %
tool_calls_32_rows / folded 24.1 / 12.5 24.6 / 13.1 24.8 / 12.6 ±5 %
steady_state_frame 21.8 — 21.9 ±5 %
keystroke 26.4 26.8 27.0 ±5 %
golden_path 39.4 — 40.9 ±5 %
streaming_focused 34.2 — 35.1 ±5 %

Why the third commit exists. The uncached panels measured +44 % on the expanded scene, reproducible across 8 paired runs: a panel row costs ~2× a plain row (extra span, per-span surface merge, fill), and 32 expanded calls rebuilt every panel each frame while completed message bodies were already cached. ToolRow now carries the laid-out panel for one width (RefCell<Option<(width, Vec<Line>)>>), invalidated with the row's ToolRowKey (arguments, result, diff, state) or on a width change; the timing line is still built per frame since it carries the live clock. Test: reuse across frames, re-layout at a new width, back to the first width. Content budgets were not trimmed.

compact_80x24 and wide_160x48 read high in the final run (28.9 / 46.1) at load 10.8; earlier runs in the same session had them at 19.7 / 38.9. Rerun on a quiet host before merging if you want a clean receipt for those two.

Docs

  • docs/design/transcript.md new § Tool Detail; § Diffs and § Streamed Tool Output amended. Ledger receipt records the open gate.

Compatibility

  • PROTOCOL / DESCRIPTOR / schema: unchanged.

…de panel (U7)

Slice U7 of docs/plans/tui-redesign.md (ENG-856), stacked on U6.

WIP checkpoint: code, tests, and goldens complete (305 lib + 6 golden
green); design doc and ledger receipt still to write.
…gin as indent (U7)

Slice U7 of docs/plans/tui-redesign.md (ENG-856), stacked on U6.

Review pass over the panel cut: PanelStyles reads the palette once per
panel rather than per row; tool panels put their three-cell margin in
Line::indent instead of inserting a span into every row (panel_rows_at);
the rail glyph and padding cell are one span. wrap::indent_lines dropped a
row's own indent when prefixing, which the inspector surfaced; fixed with
a regression test. Tests that indexed the rail as spans[1] now use
spans[0].

Design doc: transcript.md gains § Tool Detail and amends § Diffs and
§ Streamed Tool Output. Ledger row and receipt.

Known: tool_calls_32_expanded is +48 % (52.6 -> 78.2 us best-of-3 on a
pinned core). Panel rows cost about twice a plain row and 32 expanded
panels rebuild every frame. The next step is caching laid-out panel rows
for settled calls beside tool_rows; recorded in the receipt.
@lg2m
lg2m added this pull request to stack #112 September 22, 2026 02:01
@lg2m
lg2m marked this pull request as ready for review September 22, 2026 02:02
tool_calls_32_expanded read 77.6 us against a 53.9 us parent: a panel row
costs about twice a plain row and every expanded call rebuilt its panel
each frame, while completed message bodies were already cached. ToolRow
now carries the laid-out panel for one width, invalidated with the row's
ToolRowKey (arguments, result, diff, state) or when the width changes.
The timing line is still built per frame since it carries the live clock.

Best-of-3 on a pinned core: 54.3 us, parity with the parent. Regression
test covers reuse across frames, re-layout on a new width, and returning
to the first width.
@lg2m
lg2m merged commit 37bd03b into main Sep 22, 2026
4 checks passed
@lg2m
lg2m deleted the feat/eng-856-u7-tool-panels branch September 22, 2026 02:28
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.

1 participant