Skip to content

Agent turn silently fails ("couldn't generate a response") when tool output exceeds ~25K chars #85801

Description

@Mr-Godot

Summary

When a tool returns a large output, the agent turn silently dies with the generic Agent couldn't generate a response message. No size/token error is surfaced anywhere user-visible.

Confirmed reproductions

  • config.schema.lookup on agents.defaults — returns 25K+ chars of schema. Turn fails silently.
  • grep invocation returning ~184K chars of matches. Same silent failure.

Both cases: the tool itself succeeds, output is collected, then the next model call to integrate the output fails without an explicit error about size/tokens. The user just sees the generic "couldn't generate a response".

Ask

  1. Truncate tool output that exceeds a configurable threshold. Suggest tools.maxOutputChars (or agents.defaults.tools.maxOutputChars), default ~16K. Append a clear marker so the model knows it was truncated:

    [truncated: N chars omitted, original was M chars total]
    
  2. Surface oversize/truncation as an explicit log event at user-visible log level so it can actually be debugged. Currently zero signal.

  3. Document the limit in the tool docs and in the config.schema entry for the new key.

Why it matters

Discovery is painful. The only debug path today is: guess that output was too big, retry the same tool with head/narrower args, see if it works. This burns hours on what could be a one-line log message.

Version

  • 2026.4.23 on Ubuntu 24.04 (LX)
  • Local workaround documented (cap tool output preemptively), but the silent-failure mode is the real bug.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Normal backlog priority with limited blast radius.impact:message-lossChannel message delivery can be lost, duplicated, or misrouted.

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions