release v1.3: fix crash loop (FileNotFoundError), add content chunking

ERROR FIXED:
- FileNotFoundError on deleted session files caused 2,551 restarts/24h
- Embedding token overflow for long messages (exceeded 4K token limit)

ROOT CAUSES:
1. File opened before existence check - crash when OpenClaw deletes session files
2. No content truncation for embedding - long messages failed silently

FIXES:
1. Added pre-check for file existence before open()
2. Added try/catch for FileNotFoundError
3. Added chunk_text() for long content (6000 char chunks with 200 char overlap)
4. Each chunk stored separately with metadata (chunk_index, total_chunks)

IMPACT:
- Eliminates crash loop
- No memory loss for long messages
- Graceful recovery on session rotation
This commit is contained in:
root
2026-03-10 12:11:50 -05:00
parent b71a16891d
commit e2d485b4af
2 changed files with 101 additions and 1 deletions

View File

@@ -1,11 +1,14 @@
#!/usr/bin/env python3
"""
TrueRecall v1.2 - Real-time Qdrant Watcher
TrueRecall v1.3 - Real-time Qdrant Watcher
Monitors OpenClaw sessions and stores to memories_tr instantly.
This is the CAPTURE component. For curation and injection, install v2.
Changelog:
- v1.3: Fixed crash loop (2551 restarts/24h) from FileNotFoundError on deleted session files.
Added chunking for long content (6000 char chunks) to prevent embedding token overflow.
Improved error handling for session file lifecycle.
- v1.2: Fixed session rotation bug - added inactivity detection (30s threshold)
and improved file scoring to properly detect new sessions on /new or /reset
- v1.1: Added 1-second mtime polling for session rotation