Skip to content

[BUG]: V2 TUI generic tool summary prints full tool input on the collapsed line (untruncated) #48783

Open

Description

@Abrahamism

What happened

In the V2 TUI, a tool call without a dedicated renderer (plugin or MCP tool) is rendered by GenericTool. Its collapsed one-line summary prints every primitive input argument as key=value with no truncation or elision, so calling a tool with a long string argument dumps that entire string into the transcript without the user expanding anything.

Note: the tool body (output) is correctly collapsed (createSignal(false), opened on click). Only the summary line is affected.

Steps to reproduce

  1. Use any V2 TUI build (reproduced on @opencode/cli 2.0.3, tag v2.0.3).
  2. Call a plugin/MCP tool whose input contains a long string, e.g. a document ingestion tool:
    ingest_document(content="<~5 KB document text>")
  3. The collapsed row renders ingest_document [content=<the whole ~5 KB document>], soft-wrapped across many lines, with no click required.

Tools whose long payload is in the output (not the input) are unaffected, because the body stays behind the toggle. Any tool taking a large string argument hits this.

Expected behavior

The collapsed summary should truncate/elide long argument values (e.g. ingest_document [content="Hallazgos del 2026-09-13…"]) and keep the full input behind the existing expand toggle, so a single tool call occupies a single line.

Root cause

  • packages/tui/src/routes/session/index.tsx: GenericTool renders genericToolSummary(props.tool, props.input).
  • genericToolSummary calls primitiveInputSummary(input), which builds [key=value, ...] from all primitive arguments with no truncation, no slice, no ellipsis.
  • InlineToolRow renders its children inside <text flexGrow={1}> with no maxWidth (the maxWidth="100%" only applies to InlineToolLabel, which GenericTool does not use), so the text soft-wraps over the full line budget.

Suggested fix

Truncate/elide values in primitiveInputSummary/genericToolSummary (e.g. a per-argument character cap plus …), and/or make InlineToolRow respect the available viewport width. This affects every plugin and MCP tool, since any name outside the hardcoded renderer set falls through to GenericTool.

Related

Version

@opencode/cli 2.0.3 (channel latest), Windows, TUI (no desktop app).

Activity

  1. opencodejr commented on Oct 28, 2026

    @opencodejr
    Contributor

    Thanks for the detailed report. I confirmed this on the latest dev (b94a305), and the code is the same in v2.0.3.

    primitiveInputSummary, which genericToolSummary uses for the collapsed row of plugin and MCP tools, puts every string, number and boolean argument in as key=value with no length limit. I ran it from source with a ~5.4 KB content argument: the collapsed summary came out at 5,429 characters and contained the whole document. GenericTool already shows each full input value behind its expand toggle, so the collapsed row repeats that text and defeats the collapse.

    I couldn't get a TUI recording of the simulated plugin tool call in my environment. The confirmation is from running the summary function directly, and the script below shows it. The same helper also builds Code Mode execute call rows, so those may show long arguments the same way.

    Related issues, none of them the same:

    Reproduction script (summary-check.ts)
    import { primitiveInputSummary } from "/workspace/repo/packages/tui/src/util/tool-display.ts"
    const content = "Hallazgos del 2026-09-13: findings. ".repeat(150) + "END"
    const s = `ingest_document ${primitiveInputSummary({ content }).replace(/\s+/g, " ")}`
    console.log("summary length:", s.length, "ends with:", s.slice(-20))

    Run it: bun summary-check.ts

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions