← Back to library

GitHub Issue:Cron 子代理 cleanup=delete 被忽略的排查与临时规避

解决“定时任务长期堆积子会话”的场景:先验证 `cleanup` 行为,再加会话巡检与兜底清理,防止历史会话膨胀。

GITHUBDiscovered 2026-02-13Author joesuarez
Prerequisites
  • You are using cron jobs with `sessionTarget=isolated` and payload kind `agentTurn`.
  • You can inspect session count regularly (via sessions list/status tooling).
Steps
  1. Create a minimal cron test job with `cleanup: "delete"` and run it several times.
  2. Check whether completed isolated sessions are actually removed; record counts before/after each run.
  3. If deletion is ignored, add an operations fallback: periodic session audit + manual/automated stale-session cleanup.
  4. Track upstream fix progress and remove fallback only after behavior is confirmed in your environment.
Commands
openclaw gateway status
openclaw help
openclaw logs --local-time
Verify

Session count remains bounded after repeated cron runs, with no unbounded growth from completed jobs.

Caveats
  • Do not mass-delete sessions without retention policy if compliance/audit is required.
  • Issue root-cause references internal code path; exact behavior may differ by version(需验证)。
Source attribution

This tip is aggregated from community/public sources and preserved with attribution.

Open original source ↗
Visit original post