Repository navigation
fix(tui): fold a loaded run like a live one - #806
Merged
Merged
Conversation
A session loaded through the history pager never folded, even with the compact view on. The agent stores a tool-using turn as one assistant entry per call (the `tool_call` step, which carries no text) followed by the call's own `tool` entry, so `history_rows_to_messages` built an empty assistant message per call. Those rendered no row of their own while still taking a separator — a second blank line between calls, which the live view does not have — and, worse, they broke every run of consecutive calls: `read` x4 folded to nothing, one call per row. The mapper now drops a row that would render nothing (no text, no reasoning), which is exactly the structural tool-call step. A call row is never dropped on that ground: it has a row of its own to render and the live view shows it too, including when the call returned nothing. Also hardens the paging tests: the page-triggered ones waited on `pump`'s wall-clock quiesce window instead of the page itself, which a loaded host can outrun; they now wait for the request to settle (and fail loudly if it never starts). Tests: a loaded run folds like a live one (and, unfolded, keeps exactly one blank line between calls), a call with no output keeps its row.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Screenshots of the new compact view (
ctrl+d, #804) showed the fold working on a live run but not on a loaded one: a session reopened from history rendered every call as its own row, fold or not.Cause
The agent stores a tool-using turn as one assistant entry per call — the
tool_callstep, which carries no text — followed by the call's owntoolentry:history_rows_to_messageskept every row that had atool_callblock, so each call produced an empty assistant message. It rendered no row of its own but still took a separator, which had two visible consequences:▸ read 4 filescame out as four separatereadrows.Fix
A row that would render nothing — no text, no reasoning — is dropped: that is exactly the structural tool-call step (the tool row that follows carries the call, and the name/args index is still built from the dropped row's blocks). A call row is never dropped on that ground: it has a row of its own to render, and the live view shows it too, including when the call returned nothing — which was the second half of the same inconsistency (
toolentries with an emptytool_resultused to disappear on reload).Unfolded, a loaded run now has exactly one blank line between calls, matching live.
Also
The page-triggered paging tests (added in #803) waited on
pump's wall-clock quiesce window rather than on the page itself, which a loaded host can outrun — one such failure showed up locally while these screenshots were being taken (it did not reproduce in 10 isolated runs or 3 full-suite runs). They now wait for the request to settle, and fail loudly if the request never starts.Tests
a_loaded_run_folds_like_a_live_one— a page in the agent's real shape folds to▸ thinking+▸ read 3 files, and unfolded keeps one blank line between calls.a_loaded_call_with_no_output_keeps_its_row.cargo test -p future-tui(2088),cargo fmt --check,cargo clippy --all-targets --no-deps -D warnings,tui/tests/tmux-diff.sh(57 passed).Screenshots
Captured from the real agent (isolated home, a planted journal) and the real TUI in tmux, before/after in one sheet —
.screenshots/tui-compact-view.png(gitignored).