Skip to content

feat(session-cleanup): preview cleanup plans - #3652

Open
tang-vu wants to merge 1 commit into
Osmantic:mainfrom
tang-vu:feat/session-cleanup-dry-run
Open

feat(session-cleanup): preview cleanup plans#3652
tang-vu wants to merge 1 commit into
Osmantic:mainfrom
tang-vu:feat/session-cleanup-dry-run

Conversation

@tang-vu

@tang-vu tang-vu commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

?## Summary

  • add --dry-run to the OpenClaw session cleanup entrypoint
  • inventory inactive, bloated, deleted, and backup artifacts without mutating them
  • preview index-reference removals and report planned counts
  • reject unknown flags instead of silently running a destructive cleanup

Why this matters

Session cleanup removes files and atomically rewrites the live OpenClaw session index. Operators need to see the exact impact of threshold or path changes before enabling the timer or running cleanup manually, especially on installations with valuable long-running agent context.

Behavioral invariant: dry-run mode performs all validation and classification but never deletes debris/session files or changes sessions.json.

Overlap check

Searched open and closed PRs for session-cleanup, session cleanup dry run, and production file ods/scripts/session-cleanup.sh. PR #3564 fixes the empty-active-set parser path; issue #2931 concerns a concurrent creation race. Neither provides a preview mode. This feature retains their transaction order and can compose with the parser fix.

Test plan

  • bash -n ods/scripts/session-cleanup.sh
  • bash ods/tests/test-session-cleanup-dry-run.sh
  • bash ods/tests/test-session-cleanup.sh (19 passed, including injected interruption)
  • git diff --check

The boundary fixture creates active-bloated, inactive, deleted, and backup artifacts; it verifies the plan text, hashes the index before/after, and proves every file remains present.

Safety, portability, and rollback

The new path is read-only. Normal cleanup retains its index-first transaction and interruption invariant. The shell logic uses existing Linux/macOS-compatible find, stat, and Bash constructs; Windows runs under WSL. Rollback removes only the option parser and dry-run branches.

Generated with Codex

Batch compatibility

This PR is independently mergeable. For the September feature batch, the tested order is #3647 ? #3656. All ten heads cherry-picked without conflict onto upstream/main@6ff9b4fc; the resulting synthetic integration head was 17e0791c.

Combined validation: all focused boundary suites passed, make lint passed, and every GitHub Actions check on all ten PRs passed. make test reaches the pre-existing Hermes template bounds each model turn failure; the same command/failure was reproduced on a clean upstream/main@6ff9b4fc worktree. No live hardware, physical-print, archive/restore, or deployment claim is inferred from static/simulated validation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant