Skip to content

command:new hook fires ~20 times on new empty session, blocking all LLM requests #381

@xiaolietu

Description

@xiaolietu

Plugin Version

memory-lancedb-pro v1.1.0-beta.10

OpenClaw Version

OpenClaw: v2026.3.24

Bug Description

When executing /new in the web UI (openclaw-control-ui) to create a new session, the command:new hook fires approximately 20 times on the newly created empty session, instead of only running reflection on the previous (old) session. Each invocation logs conversation empty/unusable and silently fails, but the calls occupy the internal lane queue, blocking normal LLM requests and causing cascading timeouts across all configured model providers.

Expected Behavior

The command:new hook should only trigger memory reflection on the old session (which has actual conversation content). The newly created empty session should be detected and skipped — no redundant hook invocations should occur.

Steps to Reproduce

  1. Open the web UI (openclaw-control-ui v2026.3.24)
  2. In an active agent:main:main session, execute /new to create a new session
  3. Observe the gateway logs
  4. The command:new hook fires ~20 times on the new empty session within ~100ms

Error Logs / Screenshots

# 1. Old session reflection starts normally
memory-reflection: command:new hook start; sessionKey=agent:main:main; source=webchat; sessionId=<old-session-id>; sessionFile=~/.openclaw/agents/main/sessions/<old-session-id>.jsonl
memory-reflection: command:new reflection generation start for session <old-session-id>; timeoutMs=20000
# 2. WebSocket disconnects and reconnects at the same time
webchat disconnected code=1001
webchat connected
# 3. Plugin re-registers after reconnect
memory-reflection: integrated hooks registered (command:new, command:reset, after_tool_call, before_prompt_build, session_end)
# 4. New session created — hook fires ~20 times on the empty session (all within 100ms)
memory-reflection: command:new hook start; sessionKey=agent:main:main; source=webchat; sessionId=<new-session-id>; sessionFile=~/.openclaw/agents/main/sessions/<new-session-id>.jsonl
memory-reflection: command:new conversation empty/unusable for session <new-session-id>
memory-reflection: command:new hook start; sessionKey=agent:main:main; source=webchat; sessionId=<new-session-id>; ...
memory-reflection: command:new conversation empty/unusable for session <new-session-id>
... (repeated ~20 times)

Embedding Provider

Other

OS / Platform

Windows 11 (WSL2, Ubuntu 24.04)

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions