Repository navigation
Closed
Labels
enhancementNew feature or requestepic:memory-lifecycleMemory lifecycle: soft-delete, deprecation, aging, Dream safetylifecycleMemory lifecycle management (deprecation, pruning, aging)priority:mediumFix soonrustPull requests that update rust codesafetyData safety — prevents accidental data lossscope:serveruteke-server / uteke-mcp binaries
Milestone
Description
Overview
Server saat ini punya background thread yang memanggil aging_cleanup() (hard delete) setiap N hours. Ganti dengan auto_lifecycle_cycle() yang menggunakan dynamic soft-delete.
Current Behavior (crates/uteke-server/src/main.rs:312-365)
// Auto-aging background thread
std::thread::spawn(move || {
let interval = Duration::from_secs(aging_hours * 60 * 60);
loop {
std::thread::sleep(interval);
match aging_uteke.lock() {
Ok(u) => {
match u.aging_cleanup(age_days, max_access, None) {
Ok(result) => { /* logs deleted count */ }
}
}
}
}
});Target Behavior
// Auto-lifecycle background thread (replaces auto-aging)
let lifecycle_config = config.lifecycle.clone();
let lifecycle_enabled = lifecycle_config.auto_aging_enabled;
let interval_hours = lifecycle_config.auto_aging_interval_hours.max(1);
if lifecycle_enabled {
info!("Auto-lifecycle: enabled (every {interval_hours}h, cap={:.1}%)",
lifecycle_config.max_deprecate_percent);
std::thread::spawn(move || {
let interval = Duration::from_secs(interval_hours * 60 * 60);
loop {
std::thread::sleep(interval);
if SHUTDOWN.load(Ordering::SeqCst) { break; }
match lifecycle_uteke.lock() {
Ok(u) => {
u.set_lifecycle_config(lifecycle_config.clone());
match u.auto_lifecycle_cycle(false) {
Ok(report) => {
if report.deprecated > 0 || report.pruned > 0 {
info!(
"Auto-lifecycle: deprecated={}, pruned={}, total={}",
report.deprecated, report.pruned, report.total_memories
);
}
}
Err(e) => warn!("Auto-lifecycle failed: {e}"),
}
}
Err(_) => debug!("Auto-lifecycle: lock busy, skipping cycle"),
}
}
});
}Migration Notes
[maintenance] auto_aging_enabled→[lifecycle] auto_aging_enabled[maintenance] auto_aging_interval_hours→[lifecycle] auto_aging_interval_hours[aging] max_age_days→[lifecycle] min_age_days[aging] max_access_count→[lifecycle] max_access_count[maintenance] auto_dream_*→ stays in[maintenance](dream config separate)- Backward compat: parse old config sections, fall back to lifecycle config
Files Changed
| File | Change |
|---|---|
crates/uteke-server/src/main.rs |
Replace auto-aging thread with lifecycle thread |
crates/uteke-cli/src/config.rs |
Add backward-compat merge: old [aging]/[maintenance] → [lifecycle] |
Acceptance Criteria
- Server starts lifecycle thread instead of aging thread
- Thread respects
auto_aging_interval_hours(default 168 = weekly) - Thread calls
auto_lifecycle_cycle(false)(not dry-run) - Logs show deprecated/pruned counts with total memory context
- SHUTDOWN flag respected (clean exit)
- Lock-busy handled gracefully (skip, not crash)
- Old config sections still work (backward compat)
- Startup log clearly shows lifecycle config summary
Dependencies
- Depends on feat: Dynamic auto-lifecycle cycle — percentage-based soft-delete scheduler #933 (auto_lifecycle_cycle)
- Depends on feat: LifecycleConfig struct with conservative safe defaults #928 (LifecycleConfig)
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestepic:memory-lifecycleMemory lifecycle: soft-delete, deprecation, aging, Dream safetylifecycleMemory lifecycle management (deprecation, pruning, aging)priority:mediumFix soonrustPull requests that update rust codesafetyData safety — prevents accidental data lossscope:serveruteke-server / uteke-mcp binaries
Activity
ajianaz commentedon Aug 8, 2026
Implemented in PR #938 (merged). Closing as completed.
feat(#928-#937): safe memory lifecycle — soft delete, dynamic cap, CL…