Skip to content

fix(ai): periodically maintain event stores during long-running sessions - #163

Merged
2977094657 merged 3 commits into
LifeArchiveProject:mainfrom
xiaoshengbao:codex/periodic-ai-maintenance
Sep 27, 2026
Merged

2977094657 merged 3 commits into
LifeArchiveProject:mainfrom
xiaoshengbao:codex/periodic-ai-maintenance

Conversation

@xiaoshengbao

Copy link
Copy Markdown
Contributor

变更

PR #162 解决了本地检索进度事件在 ai.sqlite3 中持续追加的问题,但维护动作只在应用启动时执行。长时间运行的应用仍可能积累其他事件,或延迟回收过期事件。

本 PR 增加长期运行维护机制:

  • 为 summary 和 local search 存储启动独立后台维护线程;
  • 默认每 6 小时执行一次现有 AIStore.maintain();
  • 使用可中断的 threading.Event 等待,应用停止时立即结束等待;
  • 防止重复生命周期调用启动重复维护线程;
  • 增加维护循环持续执行并在停止信号后退出的回归测试。

验证

  • python -m pytest -q tests/test_ai_storage_retention.py(8 passed)
  • python -m compileall -q src/wechat_decrypt_tool/ai/lifecycle.py tests/test_ai_storage_retention.py
  • git diff --check

@2977094657
2977094657 merged commit 198c652 into LifeArchiveProject:main Sep 27, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants