GitHub PR:deleteAfterRun 与 cleanup 行为对齐(避免子会话长期堆积)
解决“cron 任务设置删除会话却不生效”的场景:把 cleanup 从硬编码 keep 改为读取 job.deleteAfterRun,跑完后可按预期删除隔离会话。
GITHUBDiscovered 2026-02-13Author arosstale
Prerequisites
- You run isolated cron jobs (`sessionTarget=isolated`) and care about session retention size.
- Your version includes or cherry-picks PR #15427 changes.
Steps
- Create two test jobs: one with `deleteAfterRun: true`, one unset/false.
- Run both jobs multiple times and record child session counts after each run.
- Confirm the true-flag job maps to cleanup=delete while default job remains cleanup=keep.
- Keep a small retention/audit policy for critical jobs before enabling delete globally.
Commands
openclaw gateway statusopenclaw logs --local-timeopenclaw helpVerify
Jobs with `deleteAfterRun: true` no longer accumulate completed isolated sessions; control jobs still retain history as configured.
Caveats
- Deleting sessions reduces forensic visibility; keep compliance-sensitive workflows on retention mode.
- Observed behavior still depends on runtime version and announcement flow path(需验证)。
Source attribution
This tip is aggregated from community/public sources and preserved with attribution.
Open original source ↗