You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is the same underlying defect as #2951, reported from the eviction angle: when a large tool result is evicted to a file it is written as a single long line, and read_file (which paginates by line only and is excluded from eviction via DEFAULT_EXCLUDED_TOOLS) returns the entire line, re-inflating the model context.
We have independently confirmed the root cause in #2951 against current main: LocalFilesystem.read() applies no character/byte cap, and read_file is in ToolResultEvictionConfig.DEFAULT_EXCLUDED_TOOLS, so an oversized single-line result bypasses eviction. The direction discussed above (char-level pagination, e.g. char_offset/char_limit, keeping line semantics and the eviction file intact) is consistent with the fix being tracked under #2951.
Recommendation: consolidate with #2951 — the fix belongs in the filesystem read path (char/byte budget + continuation metadata), which resolves both the direct-read case (#2951) and the evicted-artifact case described here. We recommend maintainers keep this issue linked to #2951 rather than treating it as a separate change.
Activity
logicwu0 commentedon Sep 3, 2026
我看了一下当前实现,问题应该在于分页维度不一致:
ToolResultEvictionMiddleware会把完整结果原样写入文件,而read_file的offset/limit只按行分页。对于单行超长 JSON,即使只读取一行,也会把整行重新放回模型上下文,因此驱逐并没有真正限制下一次读取量。我不太建议只对 JSON 做 pretty-print:如果某个字段本身是超长字符串,或者结果不是 JSON,仍然会出现超长单行。更通用的方案是给
read_file增加可选的字符分页参数,例如char_offset和char_limit:offset/limit的行分页语义;char_offset=20000;计划补充的测试包括:单行超长 JSON 的首次读取和续读、多行文件现有分页行为、短文件不截断、中文/emoji 边界,以及驱逐文件内容保持不变。驱逐后的占位提示也可以明确建议带
char_limit调用read_file。请问维护者是否接受按这个“字符分页 + 保留原文件”的方向处理?如果方向认可,我可以再基于最新
main提交一个聚焦的修复和回归测试。oss-maintainer commentedon Sep 3, 2026
Issue Evaluation
Category:
enhancement| Status: EvaluatedThis is the same underlying defect as #2951, reported from the eviction angle: when a large tool result is evicted to a file it is written as a single long line, and
read_file(which paginates by line only and is excluded from eviction viaDEFAULT_EXCLUDED_TOOLS) returns the entire line, re-inflating the model context.We have independently confirmed the root cause in #2951 against current
main:LocalFilesystem.read()applies no character/byte cap, andread_fileis inToolResultEvictionConfig.DEFAULT_EXCLUDED_TOOLS, so an oversized single-line result bypasses eviction. The direction discussed above (char-level pagination, e.g.char_offset/char_limit, keeping line semantics and the eviction file intact) is consistent with the fix being tracked under #2951.Recommendation: consolidate with #2951 — the fix belongs in the filesystem read path (char/byte budget + continuation metadata), which resolves both the direct-read case (#2951) and the evicted-artifact case described here. We recommend maintainers keep this issue linked to #2951 rather than treating it as a separate change.
Automated evaluation by github-manager-bot