TUI: cycled tool display with compact Worked-for summaries by default - #682
Closed
alejandro-ao wants to merge 7 commits into
Closed
TUI: cycled tool display with compact Worked-for summaries by default#682alejandro-ao wants to merge 7 commits into
alejandro-ao wants to merge 7 commits into
Conversation
Ctrl+O now cycles three modes instead of toggling two states:
- summary: each contiguous burst of tool rows collapses into one line
("Worked for 1m 23s · 5 tool calls", with live "Running… 2/5 tool
calls" progress while tools execute); terminal ! commands and
extension-rendered tool cards never collapse
- calls: the previous default compact per-call lines
- expanded: call lines plus exact commands and result previews
TuiState.tool_display replaces show_tool_results (kept as a property
mapping to expanded) and cycle_tool_display() advances the mode. Tool
rows now record finished_at (started_at is no longer cleared on
completion; restored sessions set _restoring so no invented timing).
TranscriptView collapses runs via _display_rows and keeps per-member
mappings so live updates recompute the summary line in place; entering
or leaving summary mode rebuilds the window while calls/expanded still
update rows without remounting.
Summary mode now mirrors the request flow instead of collapsing live: while the agent works, tool rows render as compact call lines so progress stays visible; when the turn settles (AgentEndEvent or AgentSettledEvent), the window rebuilds with each completed run compacted into its "Worked for ... · N tool calls" line. Starting the next turn expands the rows again. Ctrl+O still cycles summary / calls / expanded at any time. TranscriptView._collapsing() gates run collapsing on state.running, and the app rebuilds the mounted transcript window at turn boundaries.
A run representing exactly one call renders as its own compact call row in summary mode instead of a "Worked for ... · 1 tool call" line; only runs of two or more calls (counting batch/group members via tool_run_leaves) compact. When a second call arrives while idle, the existing single row is replaced in place by a run summary.
The collapsed Worked-for line now renders fully in the theme tool success color with a green left border, matching tool rows. Runs containing failures render red, and pending runs keep the neutral accent. The synthetic summary item carries a check/cross/ellipsis status marker plus a tool_run_summary flag so the plain-body renderer can style the whole line instead of only the invocation segment.
In summary mode, thinking blocks interleaved with a multi-call tool run are folded into the run's summary line instead of rendering as their own rows (even when thinking tokens are toggled on). Standalone thinking stays under Ctrl+T control, and single-call runs keep both their row and adjacent thinking. tool_run_leaves now counts only tool-role members so thinking items do not inflate call counts or trigger the pending state.
Skill load rows (role skill backed by a tool call id) interleaved with a collapsed tool burst now fold into its Worked-for summary line and count toward the call total, since they are re-labeled reads. User-invoked skill rows keep their own place in the transcript. Items mapped to a run summary are no longer re-rendered through the per-row update path.
TuiState.tool_display now starts at summary, so tool activity collapses into Worked-for lines (with swallowed thinking and skill loads) unless the user cycles Ctrl+O to calls or expanded. Tests that exercise per-row rendering pin the calls mode through a _set_tool_display_mode helper that also lets Textual settle the async removal of replaced widgets before identity-sensitive queries.
Collaborator
Author
Defective — closed without mergeClosed at the maintainer's request following isolated-worktree review of Reproduced defects:
Validation: full suite 1865 passed, 3 skipped; TUI suite 399 passed; Ruff lint/format, mypy, and diff whitespace checks passed. Existing tests do not cover these reproduced defects. |
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.
Description
Reworks tool activity rendering in the TUI around a three-way display cycle and a new compact default.
Ctrl+O now cycles three modes (announced in a toast):
Worked for 1m 23s · 5 tool calls(failures counted, e.g.· 1 failed; bursts left pending after a cancel showRunning… 2/5 tool calls). Thinking blocks and tool-driven skill loads interleaved with a summarized burst are swallowed into its line and skill loads count toward the call total. A single tool call keeps its own row.The line renders in the tool status color (green on success, red on failures, neutral while pending). Starting a new turn expands the rows again; cycling is available at any time, including mid-turn.
User-experience improvement
Long turns no longer bury the narrative under dozens of tool rows: the default transcript shows one green line per burst of work ("Worked for 1m 23s · 5 tool calls"), with full call/results detail still one Ctrl+O press away. Terminal
!commands, extension-rendered tool cards, and user-invoked skill rows never collapse.Implementation notes
TuiState.tool_display(summary | calls | expanded) replacesshow_tool_results(kept as a property mapping toexpanded, so per-row rendering call sites are unchanged);cycle_tool_display()advances the mode.finished_at(started_atis no longer cleared on completion; batch pending detection usestool_result_text); restored sessions set a_restoringflag so no timing is invented and summaries fall back to call counts.TranscriptViewowns collapse rendering via_display_rows()(hidden-thinking-placeholder pattern); member→summary-widget mappings let liveupdate_itemcalls recompute the summary line in place. Turn boundaries (AgentStartEvent/AgentEndEvent/AgentSettledEvent) drive the expand/compact rebuilds.always_show_tool_resultrows, and user-invoked skills are exempt from collapsing.Manual validation
uv run pytest tests— 1866 passed, 2 skippeduv run ruff check ./uv run ruff format --check .— cleanuv run mypy— cleanWorked for …summaries after; press Ctrl+O to cycle summary → calls → expanded.