openclaw - 💡(How to fix) Fix /new 命令在群聊中未清除磁盘 session 持久化,导致会话重置无效

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Fix Action

Fix / Workaround

在飞书群聊中使用 @BOT /new\ 命令重置会话时,命令被检测并投递(\detected system command\ → \dispatched\),但会话历史并未被清除,后续消息仍携带旧上下文。

\
[feishu][casebot]: detected system command, using plain-text dispatch [feishu][casebot]: system command dispatched (delivered=false) \\

RAW_BUFFERClick to expand / collapse

描述

在飞书群聊中使用 @BOT /new\ 命令重置会话时,命令被检测并投递(\detected system command\ → \dispatched\),但会话历史并未被清除,后续消息仍携带旧上下文。

复现步骤

  1. 在飞书群聊中 @bot 发送多条消息,建立会话历史
  2. 发送 @BOT /new\ 尝试重置会话
  3. 再发一条正常消息 → 发现 bot 仍记得之前的对话内容

相关日志

\
[feishu][casebot]: detected system command, using plain-text dispatch [feishu][casebot]: system command dispatched (delivered=false) \\

  • \delivered=false\ 仅表示命令未产生文本输出(/new 是静默命令,本不应输出),不代表执行失败
  • 命令被 lark 插件正确投递给了 Gateway,投递链路正常

根因分析

经测试验证,问题出在 OpenClaw 核心的会话管理:

  1. /new\ 被 Gateway 接收后,内存中的会话状态可能被重置
  2. 但磁盘上的会话持久化文件 未被清除
    • ~/.openclaw/agents/<agent>/sessions/sessions.json\ 中的 session entry 仍然存在
    • 对应的 .jsonl\ trajectory 文件也未被清理
  3. 下一条消息到达时,Gateway 从磁盘恢复会话,旧历史被重新加载

验证方法: 手动删除 \sessions.json\ 中对应群聊的 session entry → 会话立即变为全新上下文 ✅

影响版本

  • OpenClaw: 2026.5.7
  • @larksuite/openclaw-lark: 2026.5.7
  • Node.js: v24.15.0
  • OS: Windows 10

(此问题不限于飞书群聊,理论上影响所有群聊 channel)

期望行为

/new\(/reset\)应完整清除会话的所有持久化状态,包括:

  • 内存中的会话上下文
  • \sessions.json\ 中的 entry
  • .jsonl\ trajectory 文件
  • 其他与会话相关的持久化数据

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING