Skip to content

Render bash batch mode in TUI tool_call line #451

Description

@hoblin

Problem to solve

When the agent invokes the bash tool in batch mode (commands: [...], mode: "parallel"|"sequential"), the TUI verbose tool_call line renders as just $ with an empty command. The reader can't see what's about to run; the tool_response panel shows the per-command outputs ([1/5] $ sleep 5, …), so the information leaks back later — but the call line itself is uninformative.

Solution

Update ToolCallDecorator#format_input to handle the batch-mode shape — render either each command on its own line prefixed with $ (preserving the per-line look that matches the response panel), or a single $ commands × N (mode: parallel) summary, depending on view density. The single-command branch stays unchanged.

Where

  • app/decorators/tool_call_decorator.rb:132-144format_input, when "bash" branch only handles input&.dig("command"). Add a branch for input["commands"].is_a?(Array).
  • lib/tools/bash.rb:23-37 — schema reference: tool accepts command (string) OR commands (array) + mode ("sequential"|"parallel").

Reproduce

  1. Ask Ani: "sleep 5 times in parallel with different durations".
  2. Ani picks Bash batch mode (mode: "parallel", commands: ["sleep 5", "sleep 10", …]) — one tool_use, one tool_response.
  3. TUI verbose tool_call line shows:
    💻 bash
      $
    

Suggested rendering

Compact batch summary:

💻 bash (parallel × 5)
  $ sleep 5
  $ sleep 10
  $ sleep 15
  $ sleep 20
  $ sleep 25

Or, for very wide batches, truncate with the existing truncate_lines helper (used by the generic fallback at line 142).

Why this stays in the decorator

The TUI is purely a rendering surface. Bash batch shape is already a stable part of the tool API (per lib/tools/bash.rb); only the rendering needs to keep up. No model or pipeline changes required.

Acceptance

  • Verbose tool_call line shows the actual commands when batch mode is used
  • Single-command path still renders $ <command> exactly as today
  • Spec coverage in spec/decorators/tool_call_decorator_spec.rb for both shapes

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions