feat(always-on): workspace retention cleanup + test script fix#163
Open
hernandez42 wants to merge 2 commits into
Open
feat(always-on): workspace retention cleanup + test script fix#163hernandez42 wants to merge 2 commits into
hernandez42 wants to merge 2 commits into
Conversation
added 2 commits
June 5, 2026 08:43
- Add AlwaysOnRetention: cleanup old worktrees/snapshots workspaces - retentionDays (default 14) + maxRetainedWorkspaces (default 8) - Protects active cycle workspaces and run context cwds - Best-effort: errors logged but never block Always-On startup - Does NOT touch .apex-mem (persistent memory data) - Integrate AlwaysOnRetention into AlwaysOnRuntime.start() - Runs before scheduler.start() - Reads WorkCycleStore cycle index to protect active workspaces - Protects active run context cwds - Fix package.json test script - Default 'test' now runs WITHOUT --test-force-exit - Open handles naturally exposed in CI - 'test:force' preserves the --test-force-exit mode Co-authored-by: Xuanji <xuanji@ouvaton.org>
Collaborator
|
The current design guarantees at most one isolated workspace per project. So workspace accumulation shouldn't happen under normal operation. Are you seeing orphaned workspaces that weren't cleaned up properly? That would help clarify what this retention mechanism is meant to address. |
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
Add workspace retention for Always-On isolated workspaces and fix the test script to expose open handles naturally.
Changes
New file:
src/always-on/runtime/AlwaysOnRetention.tsworktrees/andsnapshots/directories under the Always-On rootretentionDays(default 14 days)maxRetainedWorkspacesnewest (default 8)active/applying/appliedcycle status.apex-mem— persistent memory data is preservedNew file:
src/always-on/runtime/AlwaysOnRetention.test.tsModified:
src/always-on/runtime/AlwaysOnRuntime.tsstart()now callsrunRetentionCleanup()beforescheduler.start()config.workspace.retention.enabledis trueretentionConfigfields:enabled,retentionDays,maxRetainedWorkspacesModified:
package.jsontestscript now runs without--test-force-exit— open handles are naturally exposedtest:forceas the explicit--test-force-exitmode (legacy behavior)Why this matters
.apex-mem(database, index, vector store) is explicitly preserved — only workspace directories are cleaned.--test-force-exitwas masking resource leaks. Natural exit innpm testnow catches them.Verification
Config example
Co-authored-by: Xuanji xuanji@ouvaton.org