Skip to content

[Bug] LLM context compression inserts empty summary without logs or warning #8133

@yuuuuuouo

Description

@yuuuuuouo

What happened / 发生了什么

预期行为:

  1. 如果 LLM 压缩成功,应写入实际摘要内容;
  2. 如果压缩模型返回空内容、调用失败或解析失败,应在日志中输出明确 warning/error;
  3. 最好能记录 context compression 的触发、请求、返回、写入结果,方便排查。

实际行为:

  • summary 占位被插入;
  • summary 内容为空;
  • 日志中没有任何与 LLM context compression / summary 相关的信息;
  • 用户无法判断是压缩模型未调用、返回为空、解析失败,还是保存字段失败。

Reproduce / 如何复现?

启用“由 LLM 压缩上下文”后,当上下文压缩逻辑触发时,历史消息中会插入一段空摘要
Our previous history conversation summary: 后没有任何摘要正文,但系统仍然继续对话,且没有在日志中打印压缩失败、空返回或保存失败等信息。

AstrBot version, deployment method (e.g., Windows Docker Desktop deployment), provider used, and messaging platform used. / AstrBot 版本、部署方式(如 Windows Docker Desktop 部署)、使用的提供商、使用的消息平台适配器

AstrBot version: v4.24.2
Deployment: Windows
Provider: Gemini 3.1 Pro(用于上下文压缩)
Messaging platform: QQ / aiocqhttp / NapCat

OS

Windows

Logs / 报错日志

目前没有相关报错日志。问题的一部分正是:触发 LLM context compression 后,即使 summary 为空,也没有任何 warning/error/debug 日志输出,导致无法进一步定位。

附件:

  1. 上下文管理策略配置截图;
Image 3. 后台实际消息 json 数据,显示 summary 占位存在但内容为空。```json { "role": "user", "content": "Our previous history conversation summary: " }, { "role": "assistant", "content": "Acknowledged the summary of our previous conversation history." } ```

建议增加日志:

  • context compression 触发时打印 debug;
  • 压缩模型请求开始/结束打印 debug;
  • 压缩模型返回空内容时打印 warning;
  • 压缩结果写入失败时打印 error;
  • 最终写入 summary 的长度/状态打印 debug。

Are you willing to submit a PR? / 你愿意提交 PR 吗?

  • Yes!

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:coreThe bug / feature is about astrbot's core, backendbugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions