Skip to content

feat(health): session-store retention check (#435)#495

Merged
markhayden merged 4 commits into
mainfrom
feat/session-store-retention-check
Jun 12, 2026
Merged

feat(health): session-store retention check (#435)#495
markhayden merged 4 commits into
mainfrom
feat/session-store-retention-check

Conversation

@markhayden

Copy link
Copy Markdown
Owner

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-store doctor 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 at openclaw sessions cleanup --enforce + session.maintenance.maxDiskBytes. Verified live: fired the expected WARN on main (321MB, 24× ratio) day one.
  • Docs — session-forensics retention note now records the verified upstream behavior; doctor system-checks table gains the new row; spec + plan checked in under .claude/specs/.

Verified on this machine (OpenClaw 2026.6.5)

  • session.maintenance defaults: mode: enforce, pruneAfter: 30d, maxEntries: 500; runs on store writes + manual CLI, never on startup. Disk-budget eviction is opt-in via maxDiskBytes.
  • Remediation performed: openclaw sessions cleanup --enforce --all-agents freed 91.5MB (400 artifacts) from main; session.maintenance.maxDiskBytes=512MB set and gateway restarted.

Tests

15 new tests (5 adapter, 10 check); full suite 4,993 pass / 0 fail.

Closes #435

🤖 Generated with Claude Code

markhayden and others added 4 commits June 11, 2026 21:42
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>
@markhayden markhayden merged commit 396bf2b into main Jun 12, 2026
1 check passed
@markhayden markhayden deleted the feat/session-store-retention-check branch June 12, 2026 03:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Rig validation: OpenClaw gateway per-agent concurrency + session retention

1 participant