Skip to content

fix(cli): summarize cleanup dry-run by label - #93565

Merged
vincentkoc merged 3 commits into
openclaw:mainfrom
AgentArcLab:fix/76826-session-cleanup-label-summary
Jun 16, 2026
Merged

vincentkoc merged 3 commits into
openclaw:mainfrom
AgentArcLab:fix/76826-session-cleanup-label-summary

Conversation

@AgentArcLab

Copy link
Copy Markdown
Contributor

Summary

  • add a text-mode sessions cleanup --dry-run summary grouped by session label
  • count each label's kept vs pruned preview rows, with an Unlabeled bucket for entries without SessionEntry.label
  • keep cleanup policy, JSON output, and apply behavior unchanged
  • document the new dry-run text output in the sessions CLI docs

Fixes #76826.

Proof

Red check before implementation:

pnpm test -- src/commands/sessions-cleanup.test.ts -t "renders a dry-run summary grouped by session label"

Failed as expected because Summary by Label: was absent from dry-run output.

Focused verification after implementation:

pnpm test -- src/commands/sessions-cleanup.test.ts -t "renders a dry-run summary grouped by session label"
pnpm test -- src/commands/sessions-cleanup.test.ts
pnpm exec oxfmt --check --threads=1 src/commands/sessions-cleanup.ts src/commands/sessions-cleanup.test.ts src/commands/sessions-table.ts docs/cli/sessions.md
git diff --check

All commands passed locally.

Surface map

  • Direct CLI dry-run path: renderStoreDryRunPlan now renders the existing action table and then a label summary from the same preview rows.
  • Cleanup engine: unchanged; action classification still comes from resolveSessionCleanupAction and preview key sets.
  • JSON/API output: unchanged; the label summary is text-only and does not alter serializeSessionCleanupResult.
  • Apply path: unchanged; renderAppliedSummaries and gateway delegation are untouched.
  • Multi-agent dry-runs: covered through the existing per-store render loop because each preview store renders its own label summary.
  • Docs: docs/cli/sessions.md now describes the text-mode action table plus label summary.

Risk notes

This does not add config, touch restricted CODEOWNERS paths, change retention rules, or modify session store data. Non-keep preview actions are counted as pruned in the summary because the dry-run asks what would be kept vs removed.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation commands Command implementations size: S triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. labels Jun 16, 2026
@clawsweeper

clawsweeper Bot commented Jun 16, 2026 •

Copy link
Copy Markdown
Contributor

ClawSweeper review: did not complete due to Codex infrastructure failure. Reviewed June 16, 2026, 4:51 AM ET / 08:51 UTC.

Summary
Review failed before ClawSweeper could summarize the requested change.

PR surface: Source +48, Tests +74, Docs 0. Total +122 across 4 files.

Reproducibility: unclear. The review failed before ClawSweeper could establish a reproduction path.

Review metrics: none identified.

Stored data model
Persistent data-model change detected: serialized state: src/commands/sessions-cleanup.test.ts, serialized state: src/commands/sessions-cleanup.ts, serialized state: src/commands/sessions-table.ts, unknown-data-model-change: src/commands/sessions-cleanup.test.ts, unknown-data-model-change: src/commands/sessions-cleanup.ts. Confirm migration or upgrade compatibility proof before merge.

Merge readiness
Not assessed.
Failure reason: invalid structured output.

This is a ClawSweeper/Codex infrastructure failure, not a PR readiness or patch-quality verdict.
Keep any merge decision on the normal maintainer review path until ClawSweeper can complete a fresh review.

Risk before merge

  • [P1] No close action taken because the review did not complete.

Maintainer options:

  1. Decide the mitigation before merge
    Retry the Codex review after fixing the execution failure.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Next step before merge

  • Review did not complete, so no work-lane recommendation was made.
Review details

Best possible solution:

Retry the Codex review after fixing the execution failure.

Do we have a high-confidence way to reproduce the issue?

Unclear. The review failed before ClawSweeper could establish a reproduction path.

Is this the best way to solve the issue?

Unclear. Retry the review first so ClawSweeper can evaluate the actual issue and fix direction.

AGENTS.md: unclear because the file could not be read completely.

Codex review notes: model internal, reasoning high; reviewed against c14793d35a10.

Evidence reviewed

PR surface:

Source +48, Tests +74, Docs 0. Total +122 across 4 files.

View PR surface stats
Area Files Added Removed Net
Source 2 48 0 +48
Tests 1 74 0 +74
Docs 1 1 1 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 123 1 +122

What I checked:

  • failure reason: invalid structured output.
  • codex failure detail: Codex review failed for this PR with exit 0 and wrote invalid JSON or schema-invalid output to /home/runner/work/clawsweeper/clawsweeper/artifacts/event/codex/93565.json: decision.rootCauseCluster.currentItemRelationship fixed_by_candidate requires a canonical PR.
  • codex stderr: No stderr captured.
  • codex stdout: docs, session table display, and session metadata/storage paths that this PR extends.","commits":["538d36eaaaa6349a6539a2ad3d13dac7ed4c1f1d","4967bcb16bf767bf6785a3d039479fe56434b005","b151694e0048cefaaf5c2f143c37eeb49348fb8f","828b6be39d85b38a4d7b8ceba117cd7415742e1a"],"files":["src/commands/sessions-cleanup.ts","src/commands/sessions-cleanup.test.ts","src/commands/sessions-table.ts","docs/cli/sessions.md"],"confidence":"high"},{"person":"BunsDev","role":"adjacent cleanup feature contributor","reason":"Merged work added --fix-dm-scope across the same cleanup CLI, service, docs, and tests, including dry-run/action behavior adjacent to this summary.","commits":["d4e04f33a65f555adb7ac41a617b6d9ff8ff1926","6b4ff8be81e7731512d84c9f01b234df5e39d46b"],"files":["src/commands/sessions-cleanup.ts","src/config/sessions/cleanup-service.ts","src/commands/sessions-cleanup.test.ts","doc.

Likely related people:

  • unknown: Codex failed before it could trace repository history. (role: review did not complete; confidence: low)
How this review workflow works
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@vincentkoc vincentkoc self-assigned this Jun 16, 2026
@vincentkoc
vincentkoc force-pushed the fix/76826-session-cleanup-label-summary branch from 4b03dce to b0dd1d0 Compare June 16, 2026 09:22
@vincentkoc vincentkoc changed the title CLI: summarize cleanup dry-run by label fix(cli): summarize cleanup dry-run by label Jun 16, 2026
@vincentkoc

Copy link
Copy Markdown
Member

Land-ready maintainer pass complete.

Repairs made:

  • kept label data local to the cleanup renderer instead of expanding the shared session-table row contract
  • sanitized labels before terminal interpolation
  • distinguished missing labels from a literal Unlabeled label
  • tolerated malformed persisted non-string labels

Verification:

  • node scripts/run-vitest.mjs src/commands/sessions-cleanup.test.ts — 7 passed after final rebase
  • pnpm exec oxfmt --check --threads=1 src/commands/sessions-cleanup.ts src/commands/sessions-cleanup.test.ts docs/cli/sessions.md — passed
  • git diff --check — passed
  • pnpm build — passed
  • fresh Codex autoreview — clean, no accepted/actionable findings

Known proof gap: repo-wrapper broad pnpm check hit the unrelated database-first legacy-store guard local Node heap OOM. The maintainer Testbox changed gate could not start because the blacksmith executable is unavailable on this host. The focused changed surface is green.

@vincentkoc
vincentkoc merged commit a89e6e0 into openclaw:main Jun 16, 2026
162 of 170 checks passed
@vincentkoc

Copy link
Copy Markdown
Member

Merged via squash.

Thanks @AgentArcLab!

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jun 17, 2026
Merged via squash.

Prepared head SHA: b0dd1d0
Co-authored-by: AgentArcLab <[email protected]>
Co-authored-by: vincentkoc <[email protected]>
Reviewed-by: @vincentkoc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

commands Command implementations docs Improvements or additions to documentation size: S triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature: Session cleanup dry-run should show per-label breakdown

2 participants