Repository navigation
轻量模式强制打开检索用的 LLM 过滤,它自己的 2 秒上限让本地模型每轮都被中止,然后静默改用宿主模型 #2499
Description
Pre-submission checklist | 提交前检查
- I have searched existing issues and this hasn't been mentioned before | 我已搜索现有问题,确认此问题尚未被提及
- I have read the project documentation and confirmed this issue doesn't already exist | 我已阅读项目文档并确认此问题尚未存在
- This issue is specific to MemOS and not a general software issue | 该问题是针对 MemOS 的,而不是一般软件问题
Bug Description | 问题描述
我配了个本地的 OpenAI 兼容端点(就是为了不花 API 钱),摘要没问题,但每个 turn_start 都会留下这么一对记录:
system_error {"role":"llm","provider":"openai_compatible","model":"gpt-oss-20b",
"message":"llm_unavailable: openai_compatible request failed: This operation was aborted",
"code":"llm_unavailable"}
system_model_status {"role":"llm","op":"retrieval.retrieval.filter.v5","status":"fallback",
"provider":"openai_compatible","model":"gpt-oss-20b","fallbackProvider":"host"}
也就是本地模型被白调一次,活是宿主模型干的,检索统计里看到的是:
stats.llmFilter = {"outcome":"llm_failed_safe_cutoff","kept":1,"dropped":4}
三个原因叠在一起。
-
轻量分支把操作者的配置覆盖掉。deps.js 里原来是:
llmFilterEnabled: alg.lightweightMemory.enabled ? true : alg.retrieval.llmFilterEnabled,所以默认(轻量)安装下过滤是强制开的,配置里写
algorithm: retrieval: llmFilterEnabled: false是空操作:文件能读、schema 能过、不打任何警告,然后在组装检索依赖时被覆盖。
-
过滤自己的预算是硬编码的 2000ms(retrieve.js 里 Math.max(1, Math.min(2_000, deadlineAt - now)))。
我这边本地 gpt-oss-20b 按过滤真实构造的提示词(query + 候选列表)要 2.4–2.6 秒,5 次全超。
提醒一句:别拿同一个提示词反复打来做基准,那会命中 KV 前缀缓存,看着只要 1.25 秒;冷启动实测是 8.3 秒。 -
超时被记成"provider 不可用"。fetcher.js 合并调用方信号和自己的超时控制器,超时触发时调的是
ctrl.abort(),不带 reason ⇒ 抛出来的是 AbortError 而不是 TimeoutError。判超时那几条件找的是字符串
"ABORT_ERR",而 DOMException 的 code 是数字 20 ⇒ 一条都不中 ⇒ 落成 llm_unavailable。
这个类是可回退的,于是门面又拿宿主模型重放了一次。
影响:配置本地端点本来就是为了省钱,结果每轮都往本地发一个注定超时的请求,真正干活的还是宿主模型(花钱的那个)。
期望做到其中一条就能解决:
① 轻量分支别覆盖 retrieval.llmFilterEnabled(轻量模式管的是演化链,不该顺手改检索配置);
② 把过滤的时间预算做成可配的(或者提高 2000ms),否则自建模型按设计就没法用;
③ 超时判定认 AbortError / DOMException code 20;超时应该降级(passthrough 或 safe cutoff),而不是换一家 provider 重放。
环境:@memtensor/memos-local-plugin 2.0.20,Windows 11,Node 24(Electron 宿主);lightweightMemory 用默认值;
llm.provider = openai_compatible 指向私网自建端点(不需要 key)。以上数字来自插件自己落盘的 api_logs,
外加一次离线的过滤耗时复现,没有改插件代码去插桩。
How to Reproduce | 如何重现
- llm.provider = openai_compatible 指向自建端点;algorithm.lightweightMemory 保持默认;
- 在 config 里写 algorithm.retrieval.llmFilterEnabled: false(期望关掉过滤);
- 跑任意一次 turn_start,然后看插件的 api_logs:
- retrieval.retrieval.filter.v5 仍然被调用(配置被轻量分支覆盖);
- 若该端点一次请求要 2 秒以上,就会出现 status=fallback、fallbackProvider=host,
以及配对的 llm_unavailable / "This operation was aborted"。
- 注意测法:同一个提示词连续打会命中 KV 前缀缓存(看着只要 ~1.25s),
要用新提示词冷跑才准。
Environment | 环境信息
@memtensor/memos-local-plugin 2.0.20;Windows 11;Node 24(Electron 宿主);algorithm.lightweightMemory 用默认值。
Additional Context | 其他信息
No response
Willingness to Implement | 实现意愿
- I'm willing to implement this myself | 我愿意自己解决
- I would like someone else to implement this | 我希望其他人来解决
Activity