[Bug] `<system_reminder>` 每轮写入对话历史且不被清理,导致上下文持续增长
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 78/100
Research direction
Start in astr_main_agent.py at _append_system_reminders, comparing the current-time reminder with the knowledge-base injection around lines 310-314. Reproduce multiple requests in one session and inspect req.contexts through the on_llm_request hook; done means the reminder is temporary and no longer accumulates in conversation history.
Written by the indexing model from the issue text.
Description
问题描述
_append_system_reminders 在追加"当前时间"提醒时没有调用 .mark_as_temp(),导致这条本应只对当前请求生效的临时内容被持久化进对话历史,并在之后每一轮请求中重复发送。
同一个文件里的知识库注入(astr_main_agent.py:310-314)正确调用了 .mark_as_temp(),说明这是遗漏而非设计。
影响
- 对话历史随轮次线性增长,每轮多一条时间提醒,且永不清理
- 过期的时间信息对当前轮次无意义,属于无效上下文
- 白占 token,并会更早触发上下文压缩;压缩会额外调用一次 LLM 做总结,增加成本与延迟
如何复现?
在同一会话中连续进行多轮对话
通过 on_llm_request 钩子抓取请求,观察 req.contexts
AstrBot 版本
null
操作系统
Windows
部署方式
null
使用的消息平台适配器
nc
错误日志
-
辅助信息
No response
检查清单
- Dominant language
- Python
- Stars
- 40.7k
- Forks
- 2.9k
- Avg merge
- 1d 5h
- Merged PRs (30d)
- 112
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from AstrBotDevs/AstrBot
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
AstrBotDevs/AstrBot#9999 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
AstrBotDevs/AstrBot#9945 · 2 comments ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
AstrBotDevs/AstrBot#9938 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
AstrBotDevs/AstrBot#9929 · 2 comments ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
AstrBotDevs/AstrBot#9904 ·
All issues in AstrBotDevs/AstrBot
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100