From 5c29c7cf4589e662342ffb74319234c3878990fe Mon Sep 17 00:00:00 2001 From: Kailigithub <12250313+Kailigithub@users.noreply.github.com> Date: Fri, 24 Jul 2026 03:10:22 +0800 Subject: [PATCH] fix(agentmain): make /resume fall back to L4 archives The /resume handler hardcoded the prompt to read temp/model_responses/ but the archival pipeline in memory/L4_raw_sessions/compress_session.py deletes the raw .txt files once it has merged them into all_histories.txt and the monthly {YYYY-MM}.zip archives. The data is still recoverable; the agent just isn't told to look for it. Extend the /resume prompt so the agent falls back to the L4 archives when fewer than 5 files remain in temp/model_responses/. Re-roll of #653 onto current main (original PR drifted into CONFLICTING state at 23 days stale). Closes #630 --- agentmain.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/agentmain.py b/agentmain.py index 6c5746bd9..4f48f4580 100644 --- a/agentmain.py +++ b/agentmain.py @@ -130,7 +130,14 @@ def _handle_slash_cmd(self, raw_query, display_queue): display_queue.put({'done': smart_format(f"✅ session.{k} = {repr(v)}", max_str_len=500), 'source': 'system'}) return None if raw_query.strip() == '/resume': - return r'帮我看看最近有哪些会话可以恢复。读model_responses/目录,按修改时间取最近10个文件,从每个文件里找最后一个...块,用一句话总结每个会话在聊什么,列表给我选。注意读文件后要把字面的\n替换成真换行才能正确匹配。' + return (r'帮我看看最近有哪些会话可以恢复。' + r'先列 temp/model_responses/ 目录(按修改时间取最近10个文件)。' + r'如果该目录里的 .txt 少于 5 个(L4 归档已清理原始文件),' + r'回退读 memory/L4_raw_sessions/all_histories.txt(汇总的会话历史),' + r'或解压 memory/L4_raw_sessions/{YYYY-MM}.zip 取最近的月度归档。' + r'从每个文件里找最后一个...块,' + r'用一句话总结每个会话在聊什么,列表给我选。' + r'注意读文件后要把字面的\n替换成真换行才能正确匹配。') return raw_query def run(self):