feat(health): session-store retention check (#435)#495
Merged
Conversation
Read-only per-agent session-store disk stats (entries, file count, bytes) on the sessions concept. OpenClaw implementation walks <home>/agents/*/sessions; runtimes without a file-backed store omit the capability. Feeds the upcoming session-store doctor check (#435). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Early warning on runtime session-store accumulation (#435): per-agent warn at 500MB / error at 1GB, plus an orphaned-artifact signal when file count exceeds 10x live store entries (min 100 files). Read-only and never auto-fixed — remediation is OpenClaw's own cleanup CLI + session.maintenance.maxDiskBytes. Runtimes without storeStats get a clean ok result. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
OpenClaw 2026.6.5 ships session.maintenance (enforce/30d/500 entries, opt-in disk budget; runs on writes + manual CLI, never startup) — the #435 'raise upstream' item is moot. Point at the new session-store doctor check and check in the spec + plan for the close-out. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…an signal Real sessions dirs carry skills-prompts/sha256/** caches: recurse for diskBytes (true disk pressure) but keep fileCount top-level-only so the orphaned-artifact ratio measures session artifacts, not caches. Found during the #435 coverage audit against the live store layout. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Closes the remaining scope of #435 (session retention) now that OpenClaw 2026.6.5 ships built-in session-store maintenance.
What changed
runtime.sessions.storeStats()— optional read-only adapter capability returning per-agent session-store stats (live store entries, top-level artifact file count, recursive disk bytes). OpenClaw implementation walks<home>/agents/*/sessions; runtimes without a file-backed store omit it.session-storedoctor check (health plugin) — warns at 500MB / errors at 1GB per agent, plus an orphaned-artifact signal at 10× files-per-store-entry (min 100 files).autoFixable: false; the message points atopenclaw sessions cleanup --enforce+session.maintenance.maxDiskBytes. Verified live: fired the expected WARN onmain(321MB, 24× ratio) day one..claude/specs/.Verified on this machine (OpenClaw 2026.6.5)
session.maintenancedefaults:mode: enforce,pruneAfter: 30d,maxEntries: 500; runs on store writes + manual CLI, never on startup. Disk-budget eviction is opt-in viamaxDiskBytes.openclaw sessions cleanup --enforce --all-agentsfreed 91.5MB (400 artifacts) frommain;session.maintenance.maxDiskBytes=512MBset and gateway restarted.Tests
15 new tests (5 adapter, 10 check); full suite 4,993 pass / 0 fail.
Closes #435
🤖 Generated with Claude Code