fix: add automatic temp folder cleanup at Maestro startup#158
Merged
leonvanzyl merged 1 commit intoAutoForgeAI:masterfrom Feb 5, 2026
Merged
fix: add automatic temp folder cleanup at Maestro startup#158leonvanzyl merged 1 commit intoAutoForgeAI:masterfrom
leonvanzyl merged 1 commit intoAutoForgeAI:masterfrom
Conversation
Problem: When AutoForge runs agents that use Playwright for browser testing or mongodb-memory-server for database tests, temporary files accumulate in the system temp folder (%TEMP% on Windows, /tmp on Linux/macOS). These files are never cleaned up automatically and can consume hundreds of GB over time. Affected temp items: - playwright_firefoxdev_profile-* (browser profiles) - playwright-artifacts-* (test artifacts) - playwright-transform-cache - mongodb-memory-server* (MongoDB binaries) - ng-* (Angular CLI temp) - scoped_dir* (Chrome/Chromium temp) - .78912*.node (Node.js native module cache, ~7MB each) - claude-*-cwd (Claude CLI working directory files) - mat-debug-*.log (Material/Angular debug logs) Solution: - New temp_cleanup.py module with cleanup_stale_temp() function - Called at Maestro (orchestrator) startup in autonomous_agent_demo.py - Only deletes files/folders older than 1 hour (safe for running processes) - Runs every time the Play button is clicked or agent auto-restarts - Reports cleanup stats: dirs deleted, files deleted, MB freed Why cleanup at Maestro startup: - Reliable hook point (runs on every agent start, including auto-restart after rate limits which happens every ~5 hours) - No need for background timers or scheduled tasks - Cleanup happens before new temp files are created Testing: - Tested on Windows with 958 items in temp folder - Successfully cleaned 45 dirs, 758 files, freed 415 MB - Files younger than 1 hour correctly preserved Closes AutoForgeAI#155 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Collaborator
|
Thanks |
leonvanzyl
added a commit
that referenced
this pull request
Feb 5, 2026
PR #158 added temp_cleanup.py and its import in autonomous_agent_demo.py but did not include the file in the package.json "files" array. This caused ModuleNotFoundError for npm installations since the module was missing from the published tarball. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
CoreAspectStu
pushed a commit
to CoreAspectStu/autocoder-custom
that referenced
this pull request
Feb 9, 2026
fix: add automatic temp folder cleanup at Maestro startup
CoreAspectStu
pushed a commit
to CoreAspectStu/autocoder-custom
that referenced
this pull request
Feb 9, 2026
PR AutoForgeAI#158 added temp_cleanup.py and its import in autonomous_agent_demo.py but did not include the file in the package.json "files" array. This caused ModuleNotFoundError for npm installations since the module was missing from the published tarball. Co-Authored-By: Claude Opus 4.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.
Summary
Adds automatic cleanup of stale temporary files at Maestro (orchestrator) startup to prevent temp folder bloat.
Problem: When AutoForge runs agents that use Playwright for browser testing or mongodb-memory-server for database tests, temporary files accumulate in the system temp folder. These files are never cleaned up automatically and can consume hundreds of GB over time.
Solution: New
temp_cleanup.pymodule that runs at every Maestro startup (Play button click or auto-restart after rate limits).What gets cleaned up
playwright_firefoxdev_profile-*playwright-artifacts-*playwright-transform-cachemongodb-memory-server*ng-*scoped_dir*.78912*.nodeclaude-*-cwdmat-debug-*.logSafety
ignore_errors=Truefor graceful handling of locked filesChanges
temp_cleanup.py- Cleanup module withcleanup_stale_temp()functionautonomous_agent_demo.py- Calls cleanup at orchestrator startup (not in subprocess agents)Testing
Manual test:
Output:
Cleanup complete: X dirs, Y files, Z MB freedIntegration test:
Dto open Debug panel[CLEANUP] Removed X dirs, Y files (Z MB freed)Verified working:
Screenshot shows cleanup running at Maestro startup:
Why cleanup at Maestro startup?
Closes #155
Co-Authored-By: Claude Opus 4.5 noreply@anthropic.com