anomalyco / anomalyco/opencode

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

Open
#48,783 0 comments 0 reactions 1 assignee View on GitHub

@simonklee is already working on this.

Since Sep 13, 2026.

Dominant language
TypeScript
Stars
209k
Forks
27.5k
PR merge metrics
PR metrics pending

Description

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
  • #45872 — tool-call visibility toggles in the V2 TUI. The runtime toggle it discusses gates the body only; it does not affect this summary. session.toggle.generic_tool_output is also absent from the current v2.0.3 / beta keybind config.
  • #45028 — tool output preview does not soft-wrap long lines.
Version

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.