Skip to content

fix(tui): one short row per step, drag-select, and resize-safe frames - #4457

Merged
kovtcharov-amd merged 3 commits into
amd:mainfrom
kovtcharov:kalin/tui-byte-sized-transcript
Sep 29, 2026
Merged

kovtcharov-amd merged 3 commits into
amd:mainfrom
kovtcharov:kalin/tui-byte-sized-transcript

Conversation

@kovtcharov

@kovtcharov kovtcharov commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

A bugfix turn in the TUI used to bury its result in a wall of text. Successive model messages ran together ("first.Reproduced: …Now the fix."), the model's narration printed row after row, and every confirmation showed up four times. Tool rows also carried 100-column temp paths. Now each step is one short row relative to the project, with narration folded (Ctrl+O shows everything). A confirmation is asked once and its answer is recorded as a word on the step. The answer sits apart below the steps.

Also in this PR, from driving it in a real terminal:

  • Drag-to-select works: the mouse now belongs to your terminal by default, so you can drag to select and copy with the terminal's own keys. The wheel still scrolls, via alternate scroll mode. Ctrl+T gives the mouse to GAIA for clickable links.
  • No leftover rows after a resize: every frame used to stop 2 rows short of the window, and a narrowed window left a stale status bar in those rows. The frame now fills the window, and a real resize repaints it.
  • Status-bar hints are never cut mid-word: from 38 to 150 columns the last hint used to read "Ctrl+C q…".
  • Answers re-flow when the window narrows: before, an answer kept its old width and was clipped.
  • Folded steps name every file: "Editing dates.py x2" for edits to two different files now names both.
  • Readable screen captures: larger text, looser lines, and a real monospace font on every OS.

Both frames come from the same request ("fix the lowercase-z bug in toybox/dates.py, add a regression test, run pytest") on DeepSeek V4.1 Flash via Fireworks. They were captured from live sessions over the control API (screen?format=plain). The finished-turn transcript went from 92 rows to 50, and from 24 [!] lines to 0.

Before, mid-turn:

  [!] approved decision for 'edit_file' delivered
  [x] run_shell_command failed: error: 'python -m pip' is not allowed: -m may only be black, isort, pytest, ruff.
  [!] confirmation needed: write_file — Run 'write_file' with content="import importlib.util, sys spec =
  importlib.util.find_spec("pytest") print("python:", sys.executable) ...",
  file_path="C:\Users\Kalin\AppData\Local\Temp\gaia-scratch-ecd455f35f32\check_pytest.py"?
  [!] confirmation for 'write_file' resolved: approved — running it
  [!] approved decision for 'write_file' delivered

  ✻ Let me just check.
  ▪ Running command: python -m pip show pytest 2>&1; echo "---"; python -c "import pytest" 2>&1; ech…
    └ failed: error: 'python -m pip' is not allowed: -m may only be black, isort, pytest, ruff.
  ✻ Let me write the scratch script.
  ▪ Writing file: C:\Users\Kalin\AppData\Local\Temp\gaia-scratch-ecd455f35f32\check_pytest.py
    └ success · 328ms
  ▪ confirm write_file: approved — running it
  ⣟  Writing your answer  1:02
  Now let me reproduce the bug.Reproduced: uppercase `Z` parses, lowercase `z` raises `ValueError: unconverted data
  remains: z`. Now the fix.Only one `Z`-handling site in the codebase, and it's the one I fixed. Now the regression
  test.Now run the whole suite.pytest isn't on PATH. Let me check whether it's installed anywhere (a venv, or

After, mid-turn with a confirmation up:

  ▪ Running browse directory: tests x2
    └ Listing 6 items in toybox (1 folders, 5 files)
  ▪ Reading file: tests\test_dates.py x5
    └ 1 header
  ▪ Running python: import sys sys.path.insert(0, r".") from toybox.dates import parse_updated for v in [… · approved
  ⣽  Editing file: toybox\dates.py · waiting for you  0:41

  WRITE  Confirm: edit_file          ← the modal, unchanged: still shows the exact call

After, the finished turn:

  ▪ Reading file: toybox\dates.py
    └ 3 symbols
  ▪ Running browse directory: tests x2
    └ Listing 6 items in toybox (1 folders, 5 files)
  ▪ Reading file: tests\test_dates.py x5
    └ 1 header
  ▪ Running python: import sys sys.path.insert(0, r".") from toybox.dates import parse_updated for v in [… · approved
  ▪ Editing file: toybox\dates.py x2 · approved
  ▪ Searching file content: . x2
    └ Found 2 matches in 8 files
  ▪ Running command: python -m pytest -q tests/
    └ exit 0 · 2 lines


  Fixed and verified — all 4 tests pass.

  The bug:  parse_updated  stripped only an uppercase  Z  ( v.endswith("Z") ), so a lowercase  z  survived into
  ...
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────
  ● agent gaia connected 236.0k tok this session · ↑↓/wheel scroll · Ctrl+T select text · Ctrl+O details · Ctrl+C quit
🔍 Technical details
  • Concatenation: a tool_call or needs_confirmation now moves the streamed buffer into the log as a folded note. If a final arrives with an empty answer, it falls back to the buffer, then to the last stashed text.
  • Work record: the live log is committed as a RoleWork message at every turn end (final, error, done, cancel, force-abort, legacy events). That replaces the RoleToolError [x] lines. A failed step keeps up to 3 rows of detail even when folded, because the remedy is usually in its tail.
  • Confirmations: the three [!] transcript lines and the confirm activity row are gone. The outcome goes onto the gated step via ActivityItem.Approval. Delivery failures still surface as errors. The modal still receives the raw, unshortened summary.
  • Paths: paths.go shortens paths relative to the TUI's start directory, then under ~, then keeps the tail. Windows paths match case-insensitively. unclipArg restores an argument the sidecar clipped before shortening it (seen live: …\claude\C--Users-Kalin-Work-gaia--claude-workt…).
  • Hints: the status bar shows Ctrl+O details only when idle; mid-turn it gave way to the --dev step count. The key is also in the /help overlay and in docs/guides/terminal-hub.mdx.
  • Existing tests: the wrap-layout tests now pin the Ctrl+O view. Tests that asserted the old [!] and [x] lines assert the step row instead, keeping each acceptance criterion: remedy durable after final, control bytes stripped, no panel for a recovered failure.

Test plan

  • cd tui && go test ./...: internal/ui/chat/transcript_test.go asserts each fix(tui): a single turn becomes a wall of text — show one short line per step #4445 behaviour on the rendered frame.
  • Build (go build -o bin/gaia-drive.exe ./cmd/gaia) and run a multi-step coding request. Check that model messages never run together, no ✻ rows or [!] lines appear, and each confirmation's step ends in · approved / · denied.
  • Press Ctrl+O after the turn: narration, full commands and timings appear. Press it again to fold.
  • In Windows Terminal (or any terminal): drag across the transcript and copy it with the terminal's own keys. The wheel still scrolls. Ctrl+T makes links clickable, and Ctrl+T again gives drag-select back.
  • Narrow and widen the window mid-session: exactly one status bar, and no answer clipped on the right.
  • Launch from a project folder: work-log paths inside it show relative (toybox/dates.py), and the confirmation modal still shows the full path.

Closes #4445

@github-actions github-actions Bot added documentation Documentation changes tui Go terminal UI (gaia-tui) labels Sep 29, 2026
A single bugfix turn used to paint successive model messages run together
("first.Reproduced: …Now the fix."), narration rows, three transcript lines
per confirmation, a red [x] line per retried call and 100-column temp paths.

- Text streamed before a tool call is that step's preamble: it is stashed as
  a folded note, so only what follows the last step is the answer.
- The work log is one row per step, narration folded; Ctrl+O shows it all.
  It stays in the transcript after the turn as the record of every step,
  failure (with its remedy) and confirmation answer.
- A confirmation is asked once, by the modal; the step it gated records the
  answer as a word (approved / denied / always allowed '<scope>').
- Absolute paths in the work log show relative to the start directory or ~,
  restoring an argument the sidecar clipped before shortening it.

Closes amd#4445
SVG stills and recordings drew 14px text on a 17px line with a font stack
that named nothing outside Safari and macOS, so on Windows and Linux every
viewer fell back to whatever `monospace` meant to it. Captures now use 15px
on a 22px line, a 0.6em cell that matches a monospace advance, and a stack
naming Cascadia Mono, SF Mono/Menlo, JetBrains Mono, Consolas and DejaVu
Sans Mono before the generic fallback.
Selecting text did nothing and a narrowed window showed the status bar
twice. Several display defects, one frame at a time:

- The mouse is the terminal's by default, so drag-select and the
  terminal's own copy/paste work; alternate scroll mode keeps the wheel
  scrolling the transcript. Ctrl+T gives the mouse to GAIA for clickable
  links and double-click copy; overlays still take it while open.
- Every frame was two rows shorter than the window (a chrome budget with
  rows View never drew), and those unpainted rows kept whatever the
  terminal reflowed into them on resize. The budget is now what View
  draws, and a real size change forces a full repaint.
- The status bar thinned its hints against a guessed width, so from 38 to
  150 columns the last one was cut mid-word ("Ctrl+C q…"). It now thins
  against the bar's own layout.
- An answer rendered before the window narrowed kept its old width and
  was clipped; it is re-rendered at the new measure.
- A folded run of calls named only its first target ("Editing
  dates.py x2" for edits to two files); it now names each one.
@kovtcharov kovtcharov changed the title fix(tui): show one short row per step instead of a wall of text fix(tui): one short row per step, drag-select, and resize-safe frames Sep 29, 2026
@kovtcharov-amd
kovtcharov-amd added this pull request to the merge queue Sep 29, 2026
Merged via the queue into amd:main with commit 1b972a7 Sep 29, 2026
45 of 47 checks passed
@kovtcharov-amd
kovtcharov-amd deleted the kalin/tui-byte-sized-transcript branch September 29, 2026 17:56
kovtcharov added a commit to kovtcharov/gaia that referenced this pull request Sep 29, 2026
This follows up amd#4457. Driving the TUI in a real terminal turned up
display bugs across the chat screen and the secondary screens; most were
already in `main`. The worst: typing while the agent worked wrapped the
**whole screen** at every width. Each fix below has a regression test
that fails without it.

**Chat screen**
- **Answers stop wrapping early at hyphens.** Any paragraph with a flag,
a hyphenated word or `-m` ended rows well short of the window and
stranded words (`python -` / `m` / `pytest`). The cause is a line-length
miscount in `muesli/reflow`, the wrapper glamour uses; it has no
maintained release, so it's vendored under `tui/third_party` with the
one-line fix (the README there says when to drop it).
- **Typing mid-turn no longer wraps every row.** The Enter hint was
appended after a composer that already spanned the pane, so every row of
the frame overran the terminal.
- **A failed command now shows as failed.** `python -m pytest` exiting 2
drew as a passed step, because the shell tool reports success whenever
the command runs.
- **A long or multi-line question hangs under its text** instead of
wrapping to column 0, where it read as stray output.
- **Answers lost their extra blank rows.** Glamour pads every document
top and bottom, which doubled each gap and dropped the finished answer a
row below its streamed copy.
- **Inline code lost its padding.** It had doubled the spaces around
every path and flag (`run pytest now`).

**Other screens**
- **Agents panel:** the highlighted agent could be off screen in a long
list, and Enter switched to a row you couldn't see.
- **Gateway screen:** it ignored the window size; with 76 models the
title and cursor scrolled off, and narrow windows overflowed.
- **Question panel:** a long URL or path shifted the click targets, so a
click could pick the wrong option.
- **Provider panel:** the key hint was cut mid-word at 69–73 columns.
- **Overlays:** resizing while the gateway, provider panel or an
agent-switch gate was up left the screen underneath laid out for the old
size.

## Test plan
- [ ] `cd tui && go test ./...`
- [ ] Ask for a paragraph full of commands and flags (e.g. "explain
`python -m pytest -q -x`"): rows fill to the width, and no word is
stranded alone on a row.
- [ ] During a turn, type in the composer at 60, 80 and 120 columns:
nothing wraps, and the `⏎` hint shows beside the text.
- [ ] Ask for something that runs a failing command (e.g. pytest on a
broken test): its step reads `failed — exit N` in red.
- [ ] `/agents` with more agents than fit, and `/gateway` in a short
window: the highlighted row stays visible.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Documentation changes tui Go terminal UI (gaia-tui)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(tui): a single turn becomes a wall of text — show one short line per step

2 participants