feat: Honcho session pruning CLI (#33436) - #33893
Conversation
…33436) Adds 'hermes honcho prune' CLI command with --dry-run, --force, and --include-active flags. Classifies sessions by age vs configured maxAgeDays (default 90), protects current session, and supports interactive confirmation. Adds prune_enabled and prune_max_age_days config fields to HonchoClientConfig.
teknium1
left a comment
There was a problem hiding this comment.
Thanks for splitting the Honcho pruning work out of the closed mega PR #33884. Current main still has no hermes honcho prune command (plugins/memory/honcho/cli.py:1760-1864), so the feature remains independently useful.
Problems
plugins/memory/honcho/cli.py:294-299:--forceis documented as confirmation bypass but also marks every undated session stale.hermes honcho prune --forcecan therefore delete sessions whose age was not established.plugins/memory/honcho/client.py:364-368: the new automatic-pruning fields are neither resolved byfrom_global_config()nor consumed by a gateway caller; the advertised startup/24-hour behavior is not implemented.- The diff changes no tests (
gh pr diff 33893 --name-only), leaving destructive classification and deletion paths uncovered.
Suggested changes
- Separate confirmation bypass from any override for unknown timestamps, and default unknown timestamps to retention.
- Remove or fully wire and test the automatic-pruning configuration.
- Add fake-SDK tests for dry run, timestamp boundaries, unknown timestamps, confirmation, and partial deletion failures.
Automated hermes-sweeper review.
| stale.append(entry) | ||
| elif age_days is None: | ||
| # No timestamp — too old to judge, skip unless --force | ||
| if force: |
There was a problem hiding this comment.
--force is documented as skipping confirmation, but here it also makes an undated session eligible for deletion. Please retain sessions whose age cannot be established, or use a separate explicit override for that destructive behavior.
| # stray HONCHO_API_KEY env var. | ||
| explicitly_configured: bool = False | ||
|
|
||
| # Session pruning — automatic cleanup of stale Honcho sessions. |
There was a problem hiding this comment.
These fields are not populated by from_global_config() and this PR adds no gateway startup/periodic caller. Please either wire the documented automatic-pruning behavior end-to-end with tests or remove these unused fields from this manual-CLI PR.
What does this PR do?
Adds
hermes honcho prunecommand to prune stale Honcho sessions older than configured max age.Fixes #33436
Type of Change
Changes Made
plugins/memory/honcho/cli.py: Addedcmd_prune()with --dry-run, --force, --include-active flags + command routing + argparse registrationplugins/memory/honcho/client.py: Addedprune_enabledandprune_max_age_daysto HonchoClientConfigHow to Test
hermes honcho prune --dry-runto previewhermes honcho prune --forceto executeChecklist