Repository navigation
fix(tui): draw a retried step error calm, not red - #5151
Conversation
An agent that fixes its own script and runs it again was drawn as a string of red failures, so a successful turn read as broken. A failed step now reads "error" in amber while the turn runs, "error, retried" once a later call of the same kind succeeds, and turns red as "failed" only when the turn ends with nothing having recovered it. - Same kind is the tool, plus a shell command's program and first argument, so a later `dir` does not recover a failed `pip install`. - A user's denial is never softened. - A standing failure no longer folds under the next call of the same tool, where the next call's outcome replaced it on screen.
Skill audit
✅ All audited skills cleared the tier they claim. Per-finding detail is withheld here on purpose. Read it in the Security > Code scanning tab, or download the |
|
Verdict: Approve with suggestions A failed step the agent recovers from now shows in amber as
Real-world evidenceN/A: no evidence bundle was produced for this run. This is a Go TUI change, and the automated evidence stage doesn't drive the TUI. My verdict rests on static review plus a local 🔍 Technical detailsIssues 🟢 An immediate retry folds the retried error away (
🟢 The retry key's "first argument" is often a flag ( 🟢 Copy text disagrees with the screen ( 🟢 Non-shell tools key on the tool name alone Strengths
|
A failed run of clean.py read "error, retried" once any other script ran cleanly, and back to back it folded under that success as "x2" with its error gone. The retry key now includes a file tool's file_path/path (normalized, so scripts\clean.py and ./scripts/clean.py match).
An unrecovered failure could still vanish from the finished work log: `npm run build` failing then `npm run lint` passing drew one "x2" row with no error, because the retry key stopped at the first word after the program, and tools with no command or file matched on the tool name alone. - The retry key skips flags (-m, /c, -Command) and `run`, so wrappers like `python -m`, `cmd /c`, `powershell -Command` and `npm run` key on the real subcommand. - A call with no command or file to match on (fetch, query) is never marked retried; it stays red and reads failed when the turn ends. - A failed row never folds into the next one, so a retried step keeps its one-line error; a failure folds under an earlier row only as a retry of the same call. - Copied work text reads "error, retried" where the screen does.
|
All four review findings and the verifier's are fixed in e86c51f. A failure nothing recovered now always stays on screen, red, with its error. A retried one keeps its one-line error instead of folding into an
🔍 Technical details
|
`cd build && make` failing then `cd build && ls` passing still drew the make failure as "error, retried", and so did `cd build; npm test` before `cd build; npm ls`. The shell tool tells the model to write commands that way, so the retry key now reads the whole line: - Every command joined by &&, || or ; counts, quotes respected; a cd becomes the folder the job runs in, and only the left side of a pipe counts (`npm test | tail -5` is the same job as `| tail -50`). - Every positional word counts, so a flag's value is part of the job: `pip install --target out pkgA` is not settled by `... pkgB`, while an added valueless flag (`--user`) still recovers the same job. - cmd /c, powershell -Command and bash -c key on the command they run.
|
The verifier's last finding is fixed in 7058edc. A retried shell step is now matched on its whole command line, so 🔍 Technical details
|
|
Verdict: Approve with suggestions A step error the agent fixes and retries no longer paints a successful turn red. It reads
Real-world evidenceN/A: no evidence bundle for this run. This is a TUI rendering change, and the PR's proof is unit tests on the rendered rows plus snapshot updates. The verdict rests on static review and the passing Go tests. No live TUI capture was checked here. 🔍 Technical details🟢 "always allowed" approvals are treated as refusals ( (If other refusal wordings exist besides 🟢 File-tool retry key ignores the edit itself ( Strengths
|
Before, a running turn printed raw tool calls with `args {…}` / `out
{…}` JSON, repeated the plan headline before every step, showed `Step
15/150`, and `--dev` piled more debug output onto the screen. After,
each step is one bullet that says what it did in plain words ("Read the
vendor's DPA in full", "Run a 42-line Python script that reads 3
spreadsheets"). One shimmering status line at the bottom shows what is
running now and for how long. A finished turn ends with the files it
made (size, sheets and rows, a clickable link) and a one-line recap.
Detail stays one key away with Ctrl+O, and the screen under `--dev` is
the same one every user sees.
Screenshots from the same contract-review task, run on `main` and on
this branch:
- **Before, running:** each tool call is followed by two lines of JSON,
a `✻` plan line, and `⣾ Step 7/150`.
- **After, running:** goal bullets ("Read the vendor's SLA and DPA in
full") with the file under each, then `⣟ Reasoning · 941 words… (2m
58s)`.
- **After, done:** the script write shows as a green-banded,
syntax-coloured diff. Below the answer, `Created contract_review.xlsx 7
KB · 1 sheet: Issues (13 rows)` and `✓ Read 6 files · ran 1 Python
script · 2m 48s · ↓ 7.7k tokens`.
<details>
<summary>🔍 Technical details</summary>
- **Where a headline comes from**, best first: a `description` argument
on the call, then the agent's announced goal (not stage lines, musing,
or template text), then a summary derived from the call. The agent-side
`description` parameter is a separate, eval-gated change; this PR only
reads it if present.
- **Motion** runs on the spinner's 20 fps tick and redraws only the
status line, a waiting prompt's title, and the recap line, which sweeps
once. It is off with `reduced_motion` (new `gaia config` key),
`GAIA_TUI_REDUCED_MOTION`, `NO_COLOR`, or a non-TTY.
- Measured: about 0.2 ms per frame with 400 messages on screen, and
about 2.3 % of one core during a live turn.
- **`--dev`** turns on the control API (`--debug` is still its alias)
and changes nothing on screen.
- Transport diagnostics go to `gaia-tui.log` under `--dev`, as on main.
- `--dev` or `--trace` puts an agent the TUI spawns at DEBUG logging.
- The per-turn metrics block and full stats moved behind Ctrl+O.
- **Failed steps follow main's retry rule** (amd#5151): `error` while the
turn runs, `error, retried` once a later run of the same file or command
succeeds, and a red `✗ failed` only if nothing recovered it.
- **Created block:**
- It lists only files changed during the turn.
- A path that is only named in text is looked at only under the start
folder or home, never on the network.
- Ctrl+F opens the newest file a turn made, and only documents that
cannot carry code. Ctrl+G keeps main's "reveal media in its folder".
- **Compatibility:**
- No step denominator is shown, with or without a limit (amd#5153).
- `continue_long_turn` renders as "Keep going? · 200 steps so far on
<model>".
- Fixes amd#5089 and amd#5122 on the TUI side.
</details>
## Test plan
- [ ] `cd tui && go vet ./... && go test ./...`
- [ ] Review the golden frames in
`tui/internal/ui/chat/testdata/frames/`: running, finished, diff,
recovered error, real failure, permission prompt, 40 columns, and
over-1-hour turns
- [ ] `cd tui && make build && ./bin/gaia-tui --dev`, then run a
multi-step task. Check that bullets lead with plain words, there is no
JSON, the status line shimmers, and the Created block plus recap appear
under the answer
- [ ] Press Ctrl+O on the finished turn and check that the commands,
timings and metrics are there
- [ ] `GAIA_TUI_REDUCED_MOTION=1 ./bin/gaia-tui` shows no shimmer and no
pulse
- [ ] With a permission prompt up, `/control/v1/screen?format=plain`
still shows `once`, `deny`, `n/esc` and the `›` composer line
- [ ] `python -m pytest tests/unit/test_cli_config.py`
This is a TUI presentation change. It overlaps the chat-view redesign in #5155 (still a draft); whichever lands second reconciles.
When the agent's own script raised an error and it fixed the script and ran it again, every attempt showed as a red
failed:line, so a successful turn looked broken. Now a step error readserrorin amber while the turn is still running, anderror, retriedonce a later call of the same kind succeeds. It turns red and readsfailedonly when the turn ends and nothing recovered it. The one-line error stays visible in every state, and a refusal by the user is never softened.🔍 Technical details
settleFailures), so nothing guesses about the future. A failure counts as recovered only by a later success with the same retry key: the tool plus a shell command's whole job, or the tool plus a file tool's file. A shell job is every command in a&&/||/;chain (quotes respected), the folder acdin it moved to, and each command's program and positional words, so a flag's value counts. Bare flags,runand a pipe's right side don't count, andcmd /c,powershell -Commandandbash -ckey on the command they run.npm run lintdoes not recovernpm run build,cd build && lsdoes not recovercd build && make,--target out pkgBdoes not recover--target out pkgA, andreport.pydoes not recoverclean.py. A call with no command or file to match (a fetch, a query) is never marked retried.collapseActivityused to fold a failed call into the next call of the same tool, where the newer outcome replaced the failure on screen. A failed row, retried or not, no longer folds, so a retried step keeps its one-line error. Copied work text readserror, retriedwhere the screen does.args/outlines are already--devonly. They are filled in only whenm.devis set (canonical.go,setToolOutputAt). The snapshots show them because the runner launches with--dev.Test plan
go test ./internal/ui/chat/: a retried script error that ends in success has no red; a script error with no retry before the turn ends is red and readsfailed; an error followed by a different tool's success stays red; a success before the failure does not recover it; a standing failure is never folded away; another file's success neither recovers nor hides a file tool's failure;npm run build/lint,python -m pip/pytest,cmd /candpowershell -Commandpairs stay failed; a fetch or query with other args is never retried; a same-job retry recovers and keeps its error; copied text matches the screen;cd build && make/ls,||/;chains, quoted separators, pipes and flag values (--target out pkgA/pkgB) are matched on the whole job└ error, andfailedafter the turn ends