Bug Description
memory_session table stores created_at and last_accessed timestamps in mixed units — some rows use seconds (Unix epoch), others use milliseconds. This breaks all time-based queries, cleanup, and backup operations.
Reproduction
- Run
memory-lancedb-pro with autoCapture: true over several days
- Some entries get
created_at in seconds (e.g., 1774509333), others in milliseconds (e.g., 1774509333015)
- Time-based filtering fails —
pd.to_datetime() with unit="ms" renders seconds-era rows as 1970-01-21
Data Evidence
Total rows: 73,291
Seconds unit (< 2e9): 1,604 rows ← migrated/older data
Milliseconds unit (≥ 2e9): 71,687 rows ← newer data
After fixing manually (×1000 for seconds rows), the data spans 2026-03-07 → 2026-04-22 as expected.
Root Cause
Likely inconsistency in src/store.ts:
- Some code paths use
Date.now() (milliseconds)
- Others use
Math.floor(Date.now() / 1000) or receive seconds from migration/import paths
- No unit validation on write
Impact
Suggested Fix
store.ts: Add a normalizeTimestamp() utility that detects unit:
function normalizeTimestamp(ts: number): number {
// Values < 1e12 are likely seconds — convert to ms
return ts < 1e12 ? ts * 1000 : ts;
}
- Apply on every write to
created_at and last_accessed
- Add a migration in
openclaw memory-pro upgrade to fix existing rows
- Add unit tests asserting all timestamps are in milliseconds after write
Environment
- Plugin: memory-lancedb-pro 1.1.0-beta.9
- LanceDB: memory_session table
- OpenClaw: 2026.4.21
Bug Description
memory_sessiontable storescreated_atandlast_accessedtimestamps in mixed units — some rows use seconds (Unix epoch), others use milliseconds. This breaks all time-based queries, cleanup, and backup operations.Reproduction
memory-lancedb-prowithautoCapture: trueover several dayscreated_atin seconds (e.g.,1774509333), others in milliseconds (e.g.,1774509333015)pd.to_datetime()withunit="ms"renders seconds-era rows as 1970-01-21Data Evidence
After fixing manually (×1000 for seconds rows), the data spans 2026-03-07 → 2026-04-22 as expected.
Root Cause
Likely inconsistency in
src/store.ts:Date.now()(milliseconds)Math.floor(Date.now() / 1000)or receive seconds from migration/import pathsImpact
delete-bulk --beforeCLI command produces incorrect resultscreated_atandlast_accessedare unreliable for lifecycle decay calculationsBigInterrors when JS tries arithmetic on mixed-unit int64 values (related to [BUG] Smart-extractor skips [cases] category due to misleading BigInt prompt guidance #640)Suggested Fix
store.ts: Add anormalizeTimestamp()utility that detects unit:created_atandlast_accessedopenclaw memory-pro upgradeto fix existing rowsEnvironment