Skip to content

fix(disk-cleanup): prune protected cleanup walks - #46629

Merged
teknium1 merged 3 commits into
mainfrom
salvage/disk-cleanup-prune-walks
Jun 15, 2026
Merged

fix(disk-cleanup): prune protected cleanup walks#46629
teknium1 merged 3 commits into
mainfrom
salvage/disk-cleanup-prune-walks

Conversation

@teknium1

Copy link
Copy Markdown
Contributor

Summary

Disk-cleanup quick cleanup now prunes protected state trees before traversal, so the session-end sweep cannot recursively scan the Hermes checkout, venv, or vendor directories under HERMES_HOME.

Changes

  • Replaces the HERMES_HOME.rglob("*") empty-dir sweep with an explicit post-order stack walk.
  • Skips protected top-level trees (hermes-agent, plugins, skills, profiles, etc.) before descending.
  • Prunes vendor/VCS/cache-heavy dirs such as node_modules, .git, venv, .venv, site-packages, and __pycache__ inside managed subtrees.
  • Adds regression coverage for protected-tree pruning and managed empty-dir cleanup.

Validation

Check Result
scripts/run_tests.sh tests/plugins/test_disk_cleanup_plugin.py 48 passed
py_compile for plugin + tests passed
real-path temp HERMES_HOME probe protected hermes-agent/node_modules/.../empty stayed; managed scratch/ emptied
git diff --check origin/main..HEAD passed

Closes #46601.
Salvages #46610 with @BlackishGreen33's authorship preserved.

Infographic

Disk cleanup protected walk pruning

@github-actions

Copy link
Copy Markdown
Contributor

🔎 Lint report: salvage/disk-cleanup-prune-walks vs origin/main

ruff

Total: 0 on HEAD, 0 on base (➖ 0)

🆕 New issues: none

✅ Fixed issues: none

Unchanged: 0 pre-existing issues carried over.

ty (type checker)

Total: 10905 on HEAD, 10905 on base (➖ 0)

🆕 New issues: none

✅ Fixed issues: none

Unchanged: 5738 pre-existing issues carried over.

Diagnostics are surfaced as warnings — this check never fails the build.

@alt-glitch alt-glitch added type/bug Something isn't working comp/plugins Plugin system and bundled plugins P2 Medium — degraded but workaround exists labels Jun 15, 2026
@teknium1
teknium1 merged commit a688d2a into main Jun 15, 2026
30 checks passed
@teknium1
teknium1 deleted the salvage/disk-cleanup-prune-walks branch June 15, 2026 12:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/plugins Plugin system and bundled plugins P2 Medium — degraded but workaround exists type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

disk-cleanup quick() walks all of HERMES_HOME on the gateway event loop → ~20min UI freeze

3 participants