fix(sandbox): 对齐 Manus——读文件不默认硬截断 - #207
Merged
Merged
Conversation
The file/read API defaulted to max_length=10000, which cut Computer panel file views, diffs, and agent file_read results with a "(truncated)" suffix. Worse, str_replace and find_in_content reused that truncated read, so replacing in files larger than 10KB could wipe the tail of the file. Default max_length to None (full content); keep optional truncation when callers pass an explicit limit. Always read the full file for replace/search. Co-authored-by: Simpleyyt <simpleyyt@gmail.com>
Restore the default 10k cap on file/read so agents cannot dump huge files into context, with a clearer truncation hint to use start_line/end_line. str_replace / find_in_content still read the full file to avoid corruption. Computer panel / file_view request max_length=null for untruncated display. Co-authored-by: Simpleyyt <simpleyyt@gmail.com>
Match official Manus: file/read has no default max_length; agents are guided to use start_line/end_line (start with first 20 lines when unsure). Context size is bounded by backend max_tool_result_chars (16k), not the sandbox API. Keep optional max_length for explicit caps; replace/search and UI still read full files. Co-authored-by: Simpleyyt <simpleyyt@gmail.com>
Simpleyyt
marked this pull request as ready for review
August 13, 2026 17:33
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.
对齐官方 Manus
官方 Manus 的
file_read没有max_length,靠工具说明引导模型:start_line/end_line进模型的上下文体积由上层预算控制,而不是 sandbox API 硬砍。
改动
file/readmax_length仅作可选硬上限str_replace/find_in_contentfile_viewmax_tool_result_chars测试