OpenClaw Version | OpenClaw 版本
0.14.0(Hermes)
Plugin Version | 插件版本
0.3.4
Operating System | 操作系统
Ubuntu 24.04
System Specification | 系统配置
No response
Describe the bug | 问题描述
L2 管道运行 SceneExtractor.extract() 时,会先备份已有的 scene_blocks/ 目录(Phase 1),然后调用 LLM 重写场景块(Phase 4,在 scene_blocks/ 中写入)。如果 LLM 调用失败(超时、API 错误、模型崩溃等),catch 块直接返回而不恢复备份,导致 scene_blocks/ 处于被沙箱写入部分破坏或清空的状态。
后续召回周期无法生成场景导航(scene index 为空),记忆系统退化为纯碎片化召回,用户感知到"记忆丢失"。
To Reproduce | 复现步骤
- 配置使用非 OpenAI 的 LLM 提供商(如 DeepSeek),或在 L2 提取过程中制造 API 超时/错误
- 确保 L2 pipeline 已经至少成功运行过一次,
scene_blocks/ 目录中存在有效场景块文件
- 触发新一轮 L2 提取(设置
l2_pending_l1_count 触发或等待定时周期)
- 观察 L2 提取失败——日志输出
SceneExtractor.extract() LLM runner failed
- 检查
scene_blocks/ 目录——原有文件已被删除,目录为空或仅有部分写入的文件
- 用
POST /recall 验证——返回结果中没有 scene_navigation 字段
Expected behavior | 预期行为
- LLM 提取失败后,应从 Phase 1 的最新备份快照恢复
scene_blocks/ 目录
- 重启 gateway 后,若
scene_blocks/ 文件与 scene_index.json 不一致,应自动校验并恢复
- 场景导航功能在恢复后可重建,不依赖人工干预
Error Logs / Screenshots | 报错日志/截图
No response
Additional context | 补充信息
根因代码位置: src/core/scene/scene-extractor.ts 第 221-226 行
} catch (err) {
const errMsg = err instanceof Error ? err.message : String(err);
const totalMs = Date.now() - extractStartMs;
this.logger?.error(`${TAG} extract() LLM runner failed after ${totalMs}ms: ${errMsg}`);
return { memoriesProcessed: 0, success: false, error: errMsg };
}
Phase 1(第 143 行)在 LLM 运行前已执行 bm.backupDirectory(sceneBlocksDir, ...),有效备份存在但未被使用。
已应用的本地修复:
- catch 块中增加从最新备份恢复的逻辑
- 启动脚本中增加 scene_blocks 校验+恢复步骤
建议上游在 scene-extractor.ts catch 块增加恢复逻辑,并在 gateway 启动流程中增加启动校验。
OpenClaw Version | OpenClaw 版本
0.14.0(Hermes)
Plugin Version | 插件版本
0.3.4
Operating System | 操作系统
Ubuntu 24.04
System Specification | 系统配置
No response
Describe the bug | 问题描述
L2 管道运行
SceneExtractor.extract()时,会先备份已有的scene_blocks/目录(Phase 1),然后调用 LLM 重写场景块(Phase 4,在scene_blocks/中写入)。如果 LLM 调用失败(超时、API 错误、模型崩溃等),catch 块直接返回而不恢复备份,导致scene_blocks/处于被沙箱写入部分破坏或清空的状态。后续召回周期无法生成场景导航(scene index 为空),记忆系统退化为纯碎片化召回,用户感知到"记忆丢失"。
To Reproduce | 复现步骤
scene_blocks/目录中存在有效场景块文件l2_pending_l1_count触发或等待定时周期)SceneExtractor.extract() LLM runner failedscene_blocks/目录——原有文件已被删除,目录为空或仅有部分写入的文件POST /recall验证——返回结果中没有scene_navigation字段Expected behavior | 预期行为
scene_blocks/目录scene_blocks/文件与scene_index.json不一致,应自动校验并恢复Error Logs / Screenshots | 报错日志/截图
No response
Additional context | 补充信息
根因代码位置:
src/core/scene/scene-extractor.ts第 221-226 行Phase 1(第 143 行)在 LLM 运行前已执行
bm.backupDirectory(sceneBlocksDir, ...),有效备份存在但未被使用。已应用的本地修复:
建议上游在
scene-extractor.tscatch 块增加恢复逻辑,并在 gateway 启动流程中增加启动校验。