docs(config): document the tool_output truncation thresholds - #45238
Open
harshil-mistry wants to merge 1 commit into
Open
docs(config): document the tool_output truncation thresholds#45238harshil-mistry wants to merge 1 commit into
harshil-mistry wants to merge 1 commit into
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue for this PR
Closes #45232
Type of change
What does this PR do?
tool_outputhas worked since #23770 (merged 2026-04-22) and appears nowhere in the docs. Searchingpackages/web/src/content/docs/fortool_output,max_linesormax_bytesreturns 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 outputsection toconfig.mdxwith 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 theMAX_LINES/MAX_BYTESconstants inpackages/opencode/src/tool/truncate.ts.Placed before
### Sharingso 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.mdxto check this was a real gap and not something documented under another name:tool_outputgenuinely appears nowhere. I confirmed the values I wrote by tracing the read path —truncate.tsresolvescfg?.tool_output?.max_lines ?? MAX_LINESandcfg?.tool_output?.max_bytes ?? MAX_BYTES, withMAX_LINES = 2000andMAX_BYTES = 50 * 1024, andoutput()truncates whenlines.length > maxLines || totalBytes > maxBytes, which is what "whichever limit is reached first" describes.I deliberately kept this to
tool_outputrather 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