Description
The openclaw memory-tdai seed command has multiple reliability issues that cause it to silently lose data during bulk import.
Issues
1. L1 extraction JSON parse failures (silent data loss)
The L1 extractor calls the LLM to extract structured memories from conversation pairs. When the LLM returns malformed JSON (common with non-OpenAI models), parseExtractionResult() fails and returns an empty array. The extraction count shows extracted=0, stored=0 with no retry.
[l1-extractor] Failed to parse extraction result: Expected ',' or '}' after property value in JSON at position 212
[l1] L1 complete: extracted=0, stored=0 (1 group(s))
The aggressive JSON sanitization (aggressiveSanitizeJson) handles trailing commas and control chars, but cannot fix structural JSON errors (missing quotes, unescaped special chars in string values, etc).
Root cause: Non-OpenAI LLMs (DeepSeek, MiMo, etc) frequently produce JSON with syntax errors in the content field when the extracted memory contains markdown, quotes, or special characters.
2. L2/L3 timer conflicts with seed main loop
The seed pipeline starts L2/L3 runners with timers. When L2 fires during the seed loop, it can cause:
L2 enqueue conflict on queue "L2": task already queued/running
- The L3 persona generation (
Starting persona generation: 首次冷启动) blocks the pipeline
The seed loop only waits for L1 idle, but L2/L3 operations can interfere with the pipeline state.
3. No retry mechanism
When L1 extraction fails for a batch:
- The failed messages are NOT retried (cursor not advanced:
NOT advancing cursor — messages will be retried)
- But in practice, the retry never happens because the seed loop moves on
- The checkpoint records
extracted=0 and the messages are lost
4. Process exits prematurely
In multiple runs, the seed process exits with code 0 after processing only 10-60 out of 155 rounds. The exit is clean (no error), suggesting the pipeline destroy or L3 completion signal triggers an early exit.
Expected Behavior
- L1 extraction should retry on JSON parse failure (at least 1 retry with a simplified prompt)
- Failed messages should be reliably retried, not silently skipped
- L2/L3 timers should not interfere with the seed main loop
- Seed should process ALL input rounds before exiting
Environment
- OpenClaw 2026.5.22
- TencentDB Agent Memory (latest npm)
- LLM: DeepSeek V4 Pro (for L1 extraction)
- Input: 155 conversation rounds (pseudo-Q&A pairs from memory files)
- Result: Only 10 L1 memories extracted from 310 L0 messages
Description
The
openclaw memory-tdai seedcommand has multiple reliability issues that cause it to silently lose data during bulk import.Issues
1. L1 extraction JSON parse failures (silent data loss)
The L1 extractor calls the LLM to extract structured memories from conversation pairs. When the LLM returns malformed JSON (common with non-OpenAI models),
parseExtractionResult()fails and returns an empty array. The extraction count showsextracted=0, stored=0with no retry.The aggressive JSON sanitization (
aggressiveSanitizeJson) handles trailing commas and control chars, but cannot fix structural JSON errors (missing quotes, unescaped special chars in string values, etc).Root cause: Non-OpenAI LLMs (DeepSeek, MiMo, etc) frequently produce JSON with syntax errors in the
contentfield when the extracted memory contains markdown, quotes, or special characters.2. L2/L3 timer conflicts with seed main loop
The seed pipeline starts L2/L3 runners with timers. When L2 fires during the seed loop, it can cause:
L2 enqueue conflict on queue "L2": task already queued/runningStarting persona generation: 首次冷启动) blocks the pipelineThe seed loop only waits for L1 idle, but L2/L3 operations can interfere with the pipeline state.
3. No retry mechanism
When L1 extraction fails for a batch:
NOT advancing cursor — messages will be retried)extracted=0and the messages are lost4. Process exits prematurely
In multiple runs, the seed process exits with code 0 after processing only 10-60 out of 155 rounds. The exit is clean (no error), suggesting the pipeline destroy or L3 completion signal triggers an early exit.
Expected Behavior
Environment