Skip to content

fix(context): reduce tool output truncation limits to 10K chars#107

Merged
xiami762 merged 1 commit intomainfrom
fix/reduce-tool-output-truncation-limits
Apr 13, 2026
Merged

fix(context): reduce tool output truncation limits to 10K chars#107
xiami762 merged 1 commit intomainfrom
fix/reduce-tool-output-truncation-limits

Conversation

@duguwanglong
Copy link
Copy Markdown
Contributor

Tighten tool output size limits to reduce context window pressure:

  • truncation.py: MAX_LINES 2000→200, MAX_BYTES 50KB→10KB, HARD_MAX_TOOL_RESULT_CHARS 400K→10K, MIN_KEEP_CHARS 2K→1K, tail_budget cap 4K→2K
  • runner.py: align MIN_CHAR_BUDGET 12K→8K, MIN_TURN_BUDGET 6K→4K to stay consistent with the new per-tool hard cap
  • runner.py: skip dynamic truncation for outputs already truncated by the static first-gate, preventing the hint (with the persisted file path) from being cut off by the second-gate 10K limit
  • read.py: align read tool limits (DEFAULT_READ_LIMIT 2000→200, MAX_LINE_LENGTH 2000→500, MAX_BYTES 50KB→8KB) to stay within the 10K-char result budget

Full tool output is still persisted to workspace/tool-output/ so agents can access it via Grep/Read with offset/limit.

@duguwanglong duguwanglong requested a review from xiami762 April 13, 2026 08:27
@duguwanglong duguwanglong force-pushed the fix/reduce-tool-output-truncation-limits branch from aca1166 to 7933e7d Compare April 13, 2026 08:58
Tighten tool output size limits to reduce context window pressure:

- truncation.py: MAX_LINES 2000→200, MAX_BYTES 50KB→10KB,
  HARD_MAX_TOOL_RESULT_CHARS 400K→10K, MIN_KEEP_CHARS 2K→1K,
  tail_budget cap 4K→2K
- runner.py: align MIN_CHAR_BUDGET 12K→8K, MIN_TURN_BUDGET 6K→4K
  to stay consistent with the new per-tool hard cap
- runner.py: skip dynamic truncation for outputs already truncated
  by the static first-gate, preventing the hint (with the persisted
  file path) from being cut off by the second-gate 10K limit
- read.py: align read tool limits (DEFAULT_READ_LIMIT 2000→200,
  MAX_LINE_LENGTH 2000→500, MAX_BYTES 50KB→8KB) to stay within
  the 10K-char result budget

Full tool output is still persisted to workspace/tool-output/ so
agents can access it via Grep/Read with offset/limit.

Made-with: Cursor
@duguwanglong duguwanglong force-pushed the fix/reduce-tool-output-truncation-limits branch from 7933e7d to 2087efb Compare April 13, 2026 09:16
@xiami762 xiami762 merged commit 913c381 into main Apr 13, 2026
2 checks passed
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.

2 participants