feat(session-cleanup): preview cleanup plans - #3652
Open
tang-vu wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
?## Summary
--dry-runto the OpenClaw session cleanup entrypointWhy 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 fileods/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.shbash ods/tests/test-session-cleanup-dry-run.shbash ods/tests/test-session-cleanup.sh(19 passed, including injected interruption)git diff --checkThe 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 was17e0791c.Combined validation: all focused boundary suites passed,
make lintpassed, and every GitHub Actions check on all ten PRs passed.make testreaches the pre-existingHermes template bounds each model turnfailure; the same command/failure was reproduced on a cleanupstream/main@6ff9b4fcworktree. No live hardware, physical-print, archive/restore, or deployment claim is inferred from static/simulated validation.