Skip to content

Reduce aggressive response truncation to preserve more content#54

Merged
RichardAtCT merged 4 commits intomainfrom
claude/review-response-truncation-ZUVxJ
Feb 19, 2026
Merged

Reduce aggressive response truncation to preserve more content#54
RichardAtCT merged 4 commits intomainfrom
claude/review-response-truncation-ZUVxJ

Conversation

@RichardAtCT
Copy link
Copy Markdown
Owner

  • Increase max_code_block_length from 3000 to 15000 chars, allowing code
    blocks to be split across multiple Telegram messages instead of truncated
  • Raise conversation_mode default max_content_length from 3000 to 50000,
    deferring splitting to the message formatter instead of discarding content
  • Increase git diff display limit from 2000 to 3500 chars
  • Update tests to match new thresholds and add coverage for split-not-truncate

https://claude.ai/code/session_01HYsPu4ncZCvp5PnRNjiT6w

- Increase max_code_block_length from 3000 to 15000 chars, allowing code
  blocks to be split across multiple Telegram messages instead of truncated
- Raise conversation_mode default max_content_length from 3000 to 50000,
  deferring splitting to the message formatter instead of discarding content
- Increase git diff display limit from 2000 to 3500 chars
- Update tests to match new thresholds and add coverage for split-not-truncate

https://claude.ai/code/session_01HYsPu4ncZCvp5PnRNjiT6w
@FridayOpenClawBot
Copy link
Copy Markdown

PR Review
Reviewed head: 6658f4feb0f6b306a40618bc3d4f553c69e056e9

Summary

  • Raises truncation thresholds so long assistant responses/code blocks are preserved more often.
  • Aligns callback diff preview budget with Telegram’s 4096-char limit by increasing diff snippet cap.
  • Updates formatter tests to validate split-vs-truncate behavior for larger code blocks.

What looks good

  • src/bot/features/conversation_mode.py now treats truncation as an extreme fallback and relies on caller-level message splitting for normal cases, which matches the comment and intended flow.
  • tests/unit/test_bot/test_formatting.py adds a useful distinction between truly huge blocks (truncate) and medium blocks (split), which is the right behavioral contract.

Issues / questions

  1. [Important] poetry.lock — this PR changes lock metadata from python-versions = "^3.10" to "^3.11" and removes several py3.10-era deps. Is dropping Python 3.10 support intentional for this repo right now? If not, this lockfile refresh could unintentionally narrow runtime/CI compatibility.
  2. [Important] src/bot/utils/formatting.py (ResponseFormatter.max_code_block_length) + src/bot/features/conversation_mode.py (max_content_length) — thresholds were increased significantly (3k→15k, 3k→50k). Could we add/confirm an integration test that exercises an end-to-end oversized response through the actual Telegram send path to ensure no edge case still trips message too long errors after HTML escaping / headers / keyboards are added?

Suggested tests (if needed)

  • Add one integration-style test around the final outbound Telegram payload size (post-formatting, with HTML markup and any suffix text/buttons metadata) to verify no single outbound message exceeds platform limits.
  • Add a regression test for handle_git_callback diff previews near 3500 chars including HTML-sensitive characters (<, >, &) to validate effective rendered length remains safe.

Verdict

  • ⚠️ Merge after fixes

The lock regeneration changed python-versions from ^3.10 to ^3.11 and
dropped py3.10-era deps, which would narrow runtime/CI compatibility.

https://claude.ai/code/session_01HYsPu4ncZCvp5PnRNjiT6w
Verify every chunk stays under Telegram's 4096-char hard limit across
five scenarios: large plain text, huge code blocks, HTML-entity expansion
(& < > characters), mixed markdown content with file operations, and
format_code_output.

https://claude.ai/code/session_01HYsPu4ncZCvp5PnRNjiT6w
@RichardAtCT RichardAtCT merged commit ba9279d into main Feb 19, 2026
1 check failed
@RichardAtCT RichardAtCT deleted the claude/review-response-truncation-ZUVxJ branch February 19, 2026 17:19
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.

3 participants