Skip to content

docs(config): document the tool_output truncation thresholds - #45238

Open
harshil-mistry wants to merge 1 commit into
anomalyco:devfrom
harshil-mistry:docs-config-tool-output
Open

docs(config): document the tool_output truncation thresholds#45238
harshil-mistry wants to merge 1 commit into
anomalyco:devfrom
harshil-mistry:docs-config-tool-output

Conversation

@harshil-mistry

Copy link
Copy Markdown

Issue for this PR

Closes #45232

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

tool_output has worked since #23770 (merged 2026-04-22) and appears nowhere in the docs. Searching packages/web/src/content/docs/ for tool_output, max_lines or max_bytes returns nothing.

That matters because the behaviour it controls is visible and often unwanted: once a tool's output crosses 2000 lines or 50 KB, the model gets a preview and a file path instead of the output. The only knob for that was undiscoverable — this adds a ### Tool output section to config.mdx with an example, both fields, their defaults, and the fact that whichever limit trips first wins.

Defaults quoted from the schema annotations in packages/core/src/v1/config/config.ts (2000 lines, 51200 bytes), which match the MAX_LINES / MAX_BYTES constants in packages/opencode/src/tool/truncate.ts.

Placed before ### Sharing so it sits next to the other runtime-behaviour options rather than in with the provider/model sections.

How did you verify your code works?

I diffed all 36 top-level keys in the v1 config schema against config.mdx to check this was a real gap and not something documented under another name:

NOT mentioned anywhere in config.mdx:
  autoshare, config, enterprise, layout, mode, reference,
  references, remote_config, skills, tool_output, username
25/36 documented

tool_output genuinely appears nowhere. I confirmed the values I wrote by tracing the read path — truncate.ts resolves cfg?.tool_output?.max_lines ?? MAX_LINES and cfg?.tool_output?.max_bytes ?? MAX_BYTES, with MAX_LINES = 2000 and MAX_BYTES = 50 * 1024, and output() truncates when lines.length > maxLines || totalBytes > maxBytes, which is what "whichever limit is reached first" describes.

I deliberately kept this to tool_output rather than closing all eleven gaps at once. Several of the others (autoshare, mode, layout) are legacy keys that probably should not be documented, and a bulk sync is a different kind of change. Happy to do the remaining live ones separately if you want them.

Screenshots / recordings

Docs change.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

tool_output has worked since anomalyco#23770 but appears nowhere in the docs, so
the only knob for tool-output truncation was undiscoverable.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

tool_output config option is undocumented

1 participant