Skip to content

feat: [memos-local-plugin] tool_result_persist hook returns Promise (should be sync) and agent_end times out at 30000ms #1815

@RuiWei9623

Description

@RuiWei9623

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 的,而不是一般软件问题

Problem Statement | 问题陈述

Bug Description | 问题描述


[hooks] tool_result_persist handler from memos-local-plugin returned a Promise; this hook is synchronous and the result was ignored.
[hooks] agent_end handler from memos-local-plugin failed: timed out after 30000ms

How to Reproduce | 如何重现


1. Run OpenClaw 2026.5.18 with memos-local-plugin 2.0.5
2. Have the Agent complete any conversation turn
3. Check Gateway logs — both warnings appear on every turn

Environment | 环境信息

Environment:

  • OpenClaw: 2026.5.18
  • memos-local-plugin: 2.0.5
  • Node.js: 22.22.2
  • Platform: Linux (WSL2)

Additional Context | 其他信息

Root cause — Issue 1:
// adapters/openclaw/index.ts:307,async 声明导致 Promise 被忽略
In adapters/openclaw/index.ts line 307, the handler is declared as async. OpenClaw's hook runner calls isPromiseLike() on the return value and ignores it if it's a Promise. The handler should either be synchronous, or heavy work should be dispatched asynchronously without blocking the return.
// 建议修复:将耗时操作改为 fire-and-forget

api.on("tool_result_persist", (event, ctx) => {
  backgroundPersist(event, ctx).catch(() => {}) // non-blocking
})

Root cause — Issue 2:
// OpenClaw 硬编码 30 秒超时,暂时无法通过配置调整
OpenClaw hard-codes DEFAULT_VOID_HOOK_TIMEOUT_MS_BY_HOOK = { agent_end: 3e4 } with no public config override. memos's agent_end chain includes SQLite writes and vector embedding operations, which occasionally exceed this threshold under I/O pressure.

Willingness to Implement | 实现意愿

  • I'm willing to implement this myself | 我愿意自己解决
  • I would like someone else to implement this | 我希望其他人来解决

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestpendingPending items to be addressed | 待解决事项。pluginPlugin/adapter/bridge layer (apps/ directory)

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions