Skip to content

Tool-call output collapse: verify landed defaults, fix details-hint chord, decide remaining gaps #3256

Description

@Hmbown

Problem

The original complaint: tool-call output showed full command + all stdout regardless of outcome, so successful runs were ~80% scaffolding noise; the ask was collapsed intent-first success rendering, auto-expanded failures, configurable verbosity, rollups for batched calls, and removal of the then-broken Alt+V affordance. Since filing, most of that has landed (see evidence). What remains is one verified inconsistency — the in-transcript details hints advertise a chord (v) that does not open details, the inverse of the original dead-Alt+V complaint — plus two explicit product decisions and a close-out audit of the original checkboxes.

Current evidence

Verified at v0.9.1 (2026-07-18) — landed behavior:

  • Collapse mode + config: ToolCollapseMode (Compact default / Expanded / Calm) at crates/tui/src/tui/app.rs:510; from_setting accepts collapsed/collapse as aliases for canonical compact (comment cites this issue; landed via feat(settings): accept collapsed as alias for default tool-collapse mode (#3256) #3695, commit 7a70455 per maintainer comment). Setting tool_collapse_mode defaults to "compact" (crates/tui/src/settings.rs:221,393), settable via tool_collapse / tool_collapse_mode / collapse (settings.rs:759) with round-trip tests (settings.rs:2102).
  • Success collapse: a successful shell call renders as a single header line in Live mode (+time only if ≥1s) — ExecCell::render, crates/tui/src/tui/history.rs:722–739. Non-failed tool cells truncate to 2 lines + a details affordance when show_tool_details is off (history.rs:290–299; show_tool_details defaults to false, settings.rs:407, keys show_tool_details/tool_details settings.rs:810).
  • Failure verbosity: the 2-line and calm-mode truncations skip failed cells (!cell.is_failed() guards, history.rs:290/301), and failed exec cells fall through to command + output rendering (history.rs:741–812). Live output is capped at TOOL_OUTPUT_LINE_LIMIT = 6 with an explicit "N lines omitted; … full output" marker (crates/tui/src/tui/history/tool_output.rs:385–397); the pager holds the full text.
  • Batched rollups: crates/tui/src/tui/history/tool_run.rs groups contiguous successful low-risk tool cells into ToolRuns with summaries like "Explored 3 files, 2 searches: read_file, grep_files, ran 1 command" (tool_run_summary, tool_run.rs:258). Failed/running/patch/review/diff/plan cells split runs (is_collapsible_tool_cell, tool_run.rs:132). Consumed by crates/tui/src/tui/widgets/mod.rs:209,585, gated by App::tool_collapse_active (app.rs:4290) with run threshold hardcoded to 3 (app.rs:3145).
  • Alt+V is no longer dead: is_tool_details_shortcut (crates/tui/src/tui/shell_key_routing.rs:115 — Alt+V, or macOS Option+V legacy ; plain v/V never match, tested at shell_key_routing.rs:158–169) routes to open_tool_details_pager (crates/tui/src/tui/ui/activity_detail.rs:530) from the main input loop (crates/tui/src/tui/ui.rs:5052). The keybinding catalog documents Alt+V with a guard test tool_details_documents_alt_v_only_never_bare_v (crates/tui/src/tui/keybindings.rs:214,499).

Verified remaining gap:

  • The transcript affordance hints are built from tool_details_shortcut_label() which returns "v" (crates/tui/src/tui/key_shortcuts.rs:61–63), so cells show "v opens details" / "v opens full command" / "v opens full output" (history.rs:294,305,1710; tool_output.rs:392) — but in the transcript/composer context bare v only types v (by design, TUI-DOG-002). The advertised chord does not work; the working chord (Alt+V, ⌥V on macOS) is not advertised.

Not implemented from the original ask:

  • An "intent" line (one line saying why the call was made). The first line today is tool name + arg/command summary (summarize_tool_args, tool_output.rs:93; command_header_summary, history.rs:1726), not model-stated intent.
  • The rollup threshold (min run size 3) is not exposed as a setting.

Scope

  1. Fix the details-hint chord: make tool_details_shortcut_label() (key_shortcuts.rs:61) return the chord that actually opens details in the transcript (Alt+V, platform-aware for ⌥V), or source it from the keybinding catalog entry (keybindings.rs:214). Update the existing hint assertion at crates/tui/src/tui/ui/tests.rs:3905 and any history/tests.rs lines that snapshot affordance text.
  2. Add a regression test tying the hint label to the working binding (alongside tool_details_documents_alt_v_only_never_bare_v, keybindings.rs:499) so hint and handler cannot drift again.
  3. Decision (maintainer): is tool-name + arg/command summary sufficient for the "intent" line, or should an explicit intent source be added? Record the decision on this issue; implement only if accepted.
  4. Decision (maintainer): expose tool_collapse_threshold (app.rs:3145) as a setting, or document it as fixed. Record and implement/close accordingly.
  5. Close-out audit: re-verify each original checkbox against the anchors above and close this issue once 1–2 land and 3–4 are recorded.

Key files

  • crates/tui/src/tui/key_shortcuts.rs
  • crates/tui/src/tui/shell_key_routing.rs
  • crates/tui/src/tui/keybindings.rs
  • crates/tui/src/tui/history.rs
  • crates/tui/src/tui/history/tool_output.rs
  • crates/tui/src/tui/history/tool_run.rs
  • crates/tui/src/settings.rs
  • crates/tui/src/tui/app.rs

Acceptance criteria

  • Every visible details affordance names a chord that actually opens tool details in the focus state where the hint is rendered (no "v opens …" text where bare v types v).
  • A test fails if the hint label and the details keybinding diverge.
  • Collapsed-by-default success rendering, failure verbosity, tool_collapse config (including collapsed/collapse aliases), and run rollups are confirmed against the anchors above — re-verified, not reimplemented.
  • Decisions on the intent line and threshold setting are recorded on this issue (implemented or explicitly descoped).
  • Issue closed with a comment mapping each original checkbox to its landing commit/anchor.

Verification

cargo test -p codewhale-tui --bin codewhale-tui --locked history
cargo test -p codewhale-tui --bin codewhale-tui --locked keybindings
cargo test -p codewhale-tui --bin codewhale-tui --locked shell_key_routing
cargo test -p codewhale-tui --bin codewhale-tui --locked settings
cargo fmt

Manual: run the TUI, execute a failing and a succeeding shell call, confirm the truncated cell's hint chord opens the details pager as advertised.

Out of scope

  • Restructuring the history renderer modules (v0.9.2: Split TUI history renderers into focused modules #3308 owns that; this issue only changes hint text/labels and records decisions).
  • Changing collapse/rollup grouping rules or the failure-split behavior.
  • New keybindings beyond making the advertised chord truthful.

Related

Triage note: body restructured for agent execution on 2026-07-18; prior comment refinements folded in. Original wording preserved in edit history.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingv0.9.2Targeting v0.9.2

    Projects

    Status
    Backlog

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions