Repository navigation
Conversation
The OpenClaw plugin re-posts a session's whole visible transcript on every agent_end. A message that was already carved into a memcell has left unprocessed_buffer, so the buffer's message_id PK no longer dedupes it, and message_id is not stable anyway (its _idx is the position in the request). Since 2026-10-07 each message landed in 5-18 memcells (35x for the main session on 2026-10-13), atomic_fact grew from ~3k to ~34k rows a day, and the derived load (unindexed rows, slow searches, cascade diffs) drove the daemon into MemoryHigh repeatedly. A new memorized_message table records (app, project, session, timestamp_ms) for every item written into a memcell. buffer_messages and prepare_cells drop fresh messages whose timestamp is already buffered or recorded before boundary detection, so duplicates cost no LLM call either. Matching on the timestamp keeps late routed messages that carry an older, never-memorized timestamp (a high-water mark would have dropped 74 of them since 10-07). Replaying 10-07..10-13 history: 84% of memcell items dropped, 0 duplicates left among the kept ones. scripts/backfill_memorized_messages.py seeds the table from existing memcells (14,119 memcells -> 134,496 timestamps in ~9 s; idempotent). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题
同一条消息被重复投递时(聊天平台重发/重试),memorize 流程会把它当作新消息再次处理,产生重复的 memcell 内容。
改法
memorized_message表与仓库:已在某 memcell 中的重复转发消息在进入 memorize 前被识别并丢弃。验证
test_memorize_window_segmentation覆盖);Ruff check/format 通过。范围
仅含通用修复与测试,不含本地环境文件。