Skip to content

feat: configurable thinking truncation via CCBOT_MAX_THINKING_CHARS#63

Open
asturwebs wants to merge 1 commit intosix-ddc:mainfrom
asturwebs:feat/thinking-completo
Open

feat: configurable thinking truncation via CCBOT_MAX_THINKING_CHARS#63
asturwebs wants to merge 1 commit intosix-ddc:mainfrom
asturwebs:feat/thinking-completo

Conversation

@asturwebs
Copy link
Contributor

@asturwebs asturwebs commented Mar 21, 2026

Summary

  • Configurable thinking truncation: Replace hardcoded 500-char limit with CCBOT_MAX_THINKING_CHARS env var. Defaults to 0 (no truncation, full thinking forwarded to Telegram). Set to e.g. 500 to restore compact thinking messages.

Changes

src/ccbot/handlers/response_builder.py

  • build_response_parts() gains max_thinking_chars parameter (default 0)
  • When max_thinking_chars > 0, truncates thinking content at the configured limit
  • When 0 (default), full thinking content is forwarded unchanged

src/ccbot/config.py

  • New config field: max_thinking_chars from CCBOT_MAX_THINKING_CHARS env var (default 0)

src/ccbot/bot.py

  • Passes config.max_thinking_chars to build_response_parts()

tests/ccbot/handlers/test_response_builder.py

  • Tests for default (no truncation), truncation with expandable quotes, and plain text truncation

Usage

# Default: no truncation (full thinking)
ccbot

# Restore old behavior: truncate at 500 chars
CCBOT_MAX_THINKING_CHARS=500 ccbot

Test plan

  • All 10 tests pass
  • ruff check passes
  • ruff format passes (our files)
  • pyright — 0 errors

Note: pre-existing ruff format failure on bot.py is unrelated to this PR (see comment).

@asturwebs
Copy link
Contributor Author

Same as #64 — the 2 failing checks are pre-existing issues on main, not introduced by this PR.

  • check (3.12): ruff format --check fails on bot.py — already needs reformatting on the base branch
  • check (3.13): Cancelled as a dependency of the above
  • claude-review: Internal error in the Claude Code Action, unrelated to this change

All 3 files in this PR (response_builder.py, update.sh, test_response_builder.py) are clean.

@asturwebs asturwebs force-pushed the feat/thinking-completo branch from 4e557fb to 1d9de04 Compare March 21, 2026 09:08
@asturwebs asturwebs changed the title feat: disable thinking truncation + auto-update script feat: configurable thinking truncation via CCBOT_MAX_THINKING_CHARS Mar 21, 2026
- Replace hardcoded 500-char thinking truncation with env-var config
- CCBOT_MAX_THINKING_CHARS defaults to 0 (no truncation, full thinking)
- Set to e.g. 500 to restore compact thinking messages
- Add scripts/update.sh for hourly auto-updates from upstream

Co-Authored-By: BytIA <bytia@asturwebs.com>
@asturwebs asturwebs force-pushed the feat/thinking-completo branch from 1d9de04 to 7689255 Compare March 21, 2026 09:12
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.

1 participant