Repository navigation
Session/Cron maintenance hardening and cleanup UX - #24753
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR completes session and cron maintenance with safer cleanup semantics, clearer operator UX, and stronger observability. It introduces first-class maintenance controls for session stores and cron jobs, adds a new openclaw sessions cleanup command with dry-run preview capabilities, and hardens transcript archival to prevent mutations outside designated directories.
Changes:
- Adds session maintenance controls (
resetArchiveRetention,maxDiskBytes,highWaterBytes) with disk budget enforcement - Adds
openclaw sessions cleanupcommand with--dry-run,--enforce,--json, and multi-agent support (--agent,--all-agents) - Adds cron maintenance controls (
sessionRetention,runLog.maxBytes,runLog.keepLines) for automated cleanup - Enhances parseDurationMs to support compound durations like "1h30m" and "2m500ms"
- Improves doctor state-integrity messaging with actionable OpenClaw-specific verification commands
- Fixes enforce-mode reporting to use actual applied maintenance stats instead of preview values
Reviewed changes
Copilot reviewed 47 out of 47 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/config/sessions/artifacts.ts | New helpers for session archive artifact classification and timestamp formatting |
| src/config/sessions/disk-budget.ts | New disk budget enforcement with oldest-first eviction, path safety validation |
| src/config/sessions/store.ts | Integration of disk budget, reset archive retention, and maintenance reporting callbacks |
| src/gateway/session-utils.fs.ts | Adds restrictToStoreDir flag to prevent archival of external paths |
| src/cron/session-reaper.ts | Archives transcripts for pruned cron run sessions with retention-based cleanup |
| src/cron/run-log.ts | Adds resolveCronRunLogPruneOptions for configurable run-log size and line limits |
| src/gateway/server-cron.ts | Integrates run-log pruning options into cron event logging |
| src/commands/sessions-cleanup.ts | New cleanup command with dry-run preview tables and enforce-mode application |
| src/commands/sessions.ts | Multi-agent support with --agent and --all-agents flags |
| src/commands/session-store-targets.ts | Agent store selection and validation logic |
| src/commands/sessions-table.ts | Shared session display formatting utilities |
| src/commands/doctor-state-integrity.ts | Detects orphan transcripts with archival remediation and OpenClaw-specific hints |
| src/cli/parse-duration.ts | Enhanced to support compound durations (e.g., "1h30m") |
| src/cli/program/routes.ts | Fast-path routing updated to handle sessions subcommands |
| src/cli/program/register.status-health-sessions.ts | Registers sessions cleanup subcommand with option forwarding |
| src/cli/program/command-registry.ts | Marks sessions as hasSubcommands: true |
| src/config/zod-schema.ts | Adds cron.runLog validation with maxBytes and keepLines |
| src/config/zod-schema.session.ts | Adds validation for resetArchiveRetention, maxDiskBytes, highWaterBytes |
| src/config/types.base.ts | Type definitions for new session maintenance fields |
| src/config/types.cron.ts | Type definitions for runLog pruning config |
| src/config/schema.labels.ts | UI labels for new config fields |
| src/config/schema.help.ts | Help text for new config fields |
| docs/* | Comprehensive documentation updates for maintenance features |
shakkernerd
added a commit
that referenced
this pull request
Feb 23, 2026
shakkernerd
force-pushed
the
codex/session-maintenance-high-signal
branch
from
February 23, 2026 22:38
47b39fb to
7533b85
Compare
Contributor
|
Merged via squash. Thanks @gumadeiras! |
mreedr
pushed a commit
to mreedr/openclaw-custom
that referenced
this pull request
Feb 24, 2026
Merged via /review-pr -> /prepare-pr -> /merge-pr. Prepared head SHA: 7533b85 Co-authored-by: gumadeiras <[email protected]> Co-authored-by: shakkernerd <[email protected]> Reviewed-by: @shakkernerd
plgs2005
pushed a commit
to plgs2005/openclaw
that referenced
this pull request
Feb 24, 2026
Merged via /review-pr -> /prepare-pr -> /merge-pr. Prepared head SHA: 7533b85 Co-authored-by: gumadeiras <[email protected]> Co-authored-by: shakkernerd <[email protected]> Reviewed-by: @shakkernerd
margulans
pushed a commit
to margulans/Neiron-AI-assistant
that referenced
this pull request
Feb 25, 2026
Merged via /review-pr -> /prepare-pr -> /merge-pr. Prepared head SHA: 7533b85 Co-authored-by: gumadeiras <[email protected]> Co-authored-by: shakkernerd <[email protected]> Reviewed-by: @shakkernerd
This was referenced Apr 30, 2026
Closed
Closed
ogt-redknie
pushed a commit
to ogt-redknie/OPENX
that referenced
this pull request
May 2, 2026
Merged via /review-pr -> /prepare-pr -> /merge-pr. Prepared head SHA: 7533b85 Co-authored-by: gumadeiras <[email protected]> Co-authored-by: shakkernerd <[email protected]> Reviewed-by: @shakkernerd
github-actions Bot
pushed a commit
to Desicool/openclaw
that referenced
this pull request
May 9, 2026
Merged via /review-pr -> /prepare-pr -> /merge-pr. Prepared head SHA: 7533b85 Co-authored-by: gumadeiras <[email protected]> Co-authored-by: shakkernerd <[email protected]> Reviewed-by: @shakkernerd
This was referenced May 19, 2026
This was referenced May 27, 2026
This was referenced Jun 12, 2026
This was referenced Jun 21, 2026
This was referenced Jun 29, 2026
This was referenced Jul 10, 2026
lhfer
pushed a commit
to lhfer/openclaw
that referenced
this pull request
Oct 11, 2026
Merged via /review-pr -> /prepare-pr -> /merge-pr. Prepared head SHA: 7533b85 Co-authored-by: gumadeiras <[email protected]> Co-authored-by: shakkernerd <[email protected]> Reviewed-by: @shakkernerd
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
This PR completes and hardens session/cron maintenance with safer cleanup semantics, clearer operator UX, and stronger observability.
session.maintenance.resetArchiveRetentionsession.maintenance.maxDiskBytessession.maintenance.highWaterBytesopenclaw sessions cleanupwith--dry-run,--enforce,--json, and active-session protection.--agent <id>and--all-agents.Action,Key,Age,Model,Flags).cron.sessionRetentiontranscript archival/cleanupcron.runLog.maxBytes/cron.runLog.keepLinespruningDefaults and compatibility
warn,30d,500,10mb; cron24h; run-log2_000_000bytes /2000lines).Tests
pnpm vitest src/config/sessions/artifacts.test.ts src/config/sessions/store.pruning.integration.test.ts src/commands/sessions-cleanup.test.ts src/cron/session-reaper.test.tspnpm vitest src/gateway/session-utils.fs.test.ts src/commands/doctor-state-integrity.test.ts src/commands/doctor-state-integrity.test.tspnpm checkGreptile Summary
This PR implements comprehensive session and cron maintenance hardening with safer cleanup semantics and improved operator UX. The changes add first-class session maintenance controls (
session.maintenance.resetArchiveRetention,maxDiskBytes,highWaterBytes), a newopenclaw sessions cleanupcommand with dry-run and enforce modes, multi-agent targeting via--agentand--all-agents, and cron maintenance controls for session retention and run-log pruning.Key improvements:
restrictToStoreDirensures cleanup operations stay scoped to the owning store directoryArchitecture:
src/config/sessions/disk-budget.tswith proper file/entry size accountingsrc/commands/sessions-cleanup.tshandles both dry-run preview and enforce modessrc/cron/session-reaper.tshandles ephemeral run session cleanup with throttlingConfidence Score: 4/5
src/config/sessions/disk-budget.tsfor the core cleanup logic and path safety validationLast reviewed commit: a202c52