Session/Cron maintenance hardening and cleanup UX#24753
Merged
shakkernerd merged 12 commits intomainfrom Feb 23, 2026
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
47b39fb to
7533b85
Compare
Member
|
Merged via squash. Thanks @gumadeiras! |
3 tasks
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 <5599352+gumadeiras@users.noreply.github.com> Co-authored-by: shakkernerd <165377636+shakkernerd@users.noreply.github.com> 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 <5599352+gumadeiras@users.noreply.github.com> Co-authored-by: shakkernerd <165377636+shakkernerd@users.noreply.github.com> 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 <5599352+gumadeiras@users.noreply.github.com> Co-authored-by: shakkernerd <165377636+shakkernerd@users.noreply.github.com> Reviewed-by: @shakkernerd
brianleach
pushed a commit
to brianleach/openclaw
that referenced
this pull request
Feb 26, 2026
Merged via /review-pr -> /prepare-pr -> /merge-pr. Prepared head SHA: 7533b85 Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com> Co-authored-by: shakkernerd <165377636+shakkernerd@users.noreply.github.com> Reviewed-by: @shakkernerd
2 tasks
mylukin
pushed a commit
to mylukin/openclaw
that referenced
this pull request
Feb 26, 2026
Merged via /review-pr -> /prepare-pr -> /merge-pr. Prepared head SHA: 7533b85 Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com> Co-authored-by: shakkernerd <165377636+shakkernerd@users.noreply.github.com> Reviewed-by: @shakkernerd
rod-nxtlevel
added a commit
to rod-nxtlevel/openclaw
that referenced
this pull request
Feb 27, 2026
…hardening Merges 5,432 upstream commits including: - pi-coding-agent/pi-agent-core/pi-ai 0.54.1 - Session/Cron maintenance hardening (openclaw#24753) - Thread-bound subagents on Discord - Model fallback visibility - HSTS header hardening Preserves local additions: - PenPot Design Bridge extension - Session-end flush (flushMemoryOnReset) - Compaction dedicated model support - Workspace bootstrap cache-optimized ordering - Session reset updatedAt patches Co-authored-by: Cursor <cursoragent@cursor.com>
r4jiv007
pushed a commit
to r4jiv007/openclaw
that referenced
this pull request
Feb 28, 2026
Merged via /review-pr -> /prepare-pr -> /merge-pr. Prepared head SHA: 7533b85 Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com> Co-authored-by: shakkernerd <165377636+shakkernerd@users.noreply.github.com> Reviewed-by: @shakkernerd
zooqueen
pushed a commit
to hanzoai/bot
that referenced
this pull request
Mar 6, 2026
Merged via /review-pr -> /prepare-pr -> /merge-pr. Prepared head SHA: 7533b85 Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com> Co-authored-by: shakkernerd <165377636+shakkernerd@users.noreply.github.com> 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