Skip to content

Multiple problems with current truncation implementation #13770

Closed as not planned

Description

@jakub300

Description

Hi, when using OpenCode for non-coding task I encountered truncation problems. Investigating complains from my agent led me to discovering multiple problems around truncation in OpenCode.

First, truncation is not documented. As far as I can tell it is not mentioned in the docs at all.

Second, it is not configurable. MAX_LINES/BYTES are hardcoded and cannot be changed.

Third, model receives misleading instructions.

const hint = hasTaskTool(agent)
? `The tool call succeeded but the output was truncated. Full output saved to: ${filepath}\nUse the Task tool to have explore agent process this file with Grep and Read (with offset/limit). Do NOT read the full file yourself - delegate to save context.`
: `The tool call succeeded but the output was truncated. Full output saved to: ${filepath}\nUse Grep to search the full content or Read with offset/limit to view specific sections.`

Message received by model is conditional based on the presence of task tool but not agents or other tools. "Use the Task tool to have explore agent..." is an incorrect instruction if explore agent is disabled. "Use Grep to search the full content or Read with offset/limit to view specific sections." is an incorrect instruction if Grep/Read tools are disabled. In scenario when those tools are not available it is completely impossible for the agent to access the full response in any way.

Fourth, inconsistent execution order of truncation and tool.execute.after hook. I tried to use the hook to reverse the truncation but for MCP calls it is called before truncation. I've not tested it but as far as I understand the code for all other tools (built-in and from plugins) it is called after truncation. This should be consistent.

Thanks

Plugins

No response

OpenCode version

1.2.5

Steps to reproduce

  1. Add MCP that returns response beyond truncation.
  2. Disable all tools besides the mentioned MCP server.
  3. Observe confused agent struggling with truncated output.

Screenshot and/or share link

I think the description is clear enough. I guess I can prepare dedicated example but it should not be necessary.

Operating System

Windows WSL

Terminal

Windows Terminal

Activity

  1. jakub300 commented on Feb 15, 2026

    @jakub300
    Author

    Hi @rekram1-node, looks like you were responsible for a lot of work around truncation

  2. stantonk commented on Mar 27, 2026

    @stantonk

    This is definitely a huge usability problem

  3. assigned and unassigned on Apr 26, 2026
  4. github-actions commented on Jul 3, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions