fix: include user message in auto-capture when prePromptMessageCount excludes it (#1248)#1256
fix: include user message in auto-capture when prePromptMessageCount excludes it (#1248)#1256r266-tech wants to merge 1 commit intovolcengine:mainfrom
Conversation
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
4cce47d to
1c5ee11
Compare
…excludes it Closes volcengine#1248 When OpenClaw's prePromptMessageCount points to an index that excludes the current turn's user message, the VLM extractor receives only assistant-role text (a recap/acknowledgment), yielding 0 extractable memories. This adds an ensureLastUserMessage parameter to extractNewTurnTexts. When true, if no user message appears in the extracted window, the last user message in the transcript is prepended to results. Adapted from the original PR (volcengine#1256) which targeted the now-renamed openclaw-memory-plugin directory.
…excludes it Closes volcengine#1248 When OpenClaw's prePromptMessageCount points to an index that excludes the current turn's user message, the VLM extractor receives only assistant-role text (a recap/acknowledgment), yielding 0 extractable memories. This adds an ensureLastUserMessage parameter to extractNewTurnTexts. When true, if no user message appears in the extracted window, the last user message in the transcript is prepended to results. Adapted from the original PR (volcengine#1256) which targeted the now-renamed openclaw-memory-plugin directory.
1c5ee11 to
daacb84
Compare
Problem
The hook's auto-capture only captures the assistant reply, not the user's original message. This causes the VLM extractor to receive text with only an [assistant] role message (a recap/acknowledgment), which yields 0 extractable memories.
Root Cause
OpenClaw's (used as in ) points to an index that may exclude the current turn's user message. When is too high, the user message falls outside the extraction window.
Fix
text-utils.ts: Add optional parameter to . When true, after normal extraction, check if any user message exists in the extracted results. If not, find the last user message in the full transcript and prepend it.
index.ts: Pass when calling from the handler.
This is a defensive fix — it ensures the user message is always captured even if the OpenClaw host passes an incorrect value.
Testing
Verified the logic:
Fixes #1248