mirror of
https://github.com/AstrBotDevs/AstrBot
synced 2026-07-15 17:30:13 +08:00
* fix(context): restore turn cap, serialize content parts and tool calls for llm compress, fix AftCompact debug log Three context-compaction regression fixes after #8226: 1. Restore max_context_length -> enforce_max_turns propagation so normal turn-based truncation works again. 2. Serialize ContentPart and ToolCall objects into plain dicts in _message_to_dict so llm_compress no longer fails with JSON serialization errors. 3. Print _provider_messages (compacted) instead of run_context.messages (unchanged) in AftCompact debug log; truncate long role lists to first4,...,last4 to avoid log spam. Assertions in tests are also hardened to avoid coupling to exact prompt wording. * fix(tool_loop_agent_runner): simplify context handling by removing redundant provider messages * fix(tool_loop_agent_runner): rename context manager variables for clarity * fix: update context compression to use recent token ratio instead of fixed count * fix: enhance LLMSummaryCompressor to sanitize contexts and improve message handling * ruff format --------- Co-authored-by: Soulter <905617992@qq.com>