GeezerVison is showing github.com — feat(storage): opt-in auto-cleanup policy (phase 3, #42) by Wibias · Pull Request #559 · lidge-jun/opencodex
Conversation
Wibias
commented
Jul 27, 2026
•
edited by coderabbitai
Bot
Loading
Uh oh!
There was an error while loading. Please reload this page.
Summary
- Adds opt-in archived auto-cleanup policy (storageCleanupPolicy, default
enabled: false) with config persistence and GET/PUT /api/storage/cleanup-policy plus POST .../run.
- Policy engine selects oldest archives (percent or reduce-to), runs Phase 2
executeArchivedCleanup in quarantine/permanent mode, defers on codex_busy, and records lastRun/nextRun; hooks startup + hourly schedule tick.
- Storage page controls (enable/threshold/target/schedule/mode/Run now), docs + i18n; no Phase 2.1 restore UI.
Depends on Phase 2 (#529, merged). Independent of Phase 2.1 restore. Closes / toward #42 Phase 3.
Test plan
-
bun test tests/storage-policy.test.ts tests/api-storage-policy.test.ts
-
bun test tests/storage-cleanup.test.ts tests/api-storage-cleanup.test.ts (Phase 2 regression)
-
bun run typecheck
- Manual: Storage page shows policy default OFF; enable + Run now quarantines oldest when over threshold
- Manual: busy Codex defers without deleting; permanent mode shows GUI warning
Summary by CodeRabbit
- New Features
- Added an optional archived storage auto-cleanup policy that’s opt-in and disabled by default.
- Added Storage page controls for thresholds, targets, schedule (manual/startup/daily/weekly), and quarantine vs permanent mode.
- Included a “Run now” action with live status, last/next run details, and completion/skipped outcomes.
- Documentation
- Updated the Storage dashboard guide and configuration reference across supported languages to clarify the policy behavior.
- Tests
- Expanded automated coverage for the policy API, job concurrency, and UI responsiveness.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Persist a default-OFF archived cleanup policy, evaluate it on startup/schedule/manual runs via Phase 2 helpers, and surface controls on the Storage page.
This comment was marked as outdated.
This comment was marked as resolved.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Keep live config synced after background policy runs, execute exact
reduceToBytes candidate sets, preserve nextRun on unchanged schedules,
and harden the Storage policy UI against invalid drafts and raw errors.
This comment was marked as resolved.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Reject cleared thresholds, fail closed on malformed targets, tear down scheduler on shutdown, and defer startup policy off the microtask queue.
This comment was marked as resolved.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Move archive scan/FS/SQLite cleanup into a Bun Worker behind a single-flight job controller so POST /run returns immediately and /healthz stays responsive.
Replace the 100-file FS fixture with synthetic over-select math plus a small exact-path check, and raise timeouts on concurrent satellite restore cases that measure multi-second on Windows runners.
…tion
Reload persisted policy before saving lastRun/nextRun so concurrent PUTs during a long worker run are not silently reverted.
This comment was marked as resolved.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Abort/reset now cancel the active worker promise and generation-guard late completions; GUI distinguishes already_running, aborts poll on unmount, and test-stream returns 404 when disabled.
Uh oh!
There was an error while loading. Please reload this page.
This was referenced Jul 30, 2026
agentHits
pushed a commit
to agentHits/opencodex
that referenced
this pull request
Sep 17, 2026
…-policy
feat(storage): opt-in auto-cleanup policy (phase 3, lidge-jun#42)
Reviewers
lidge-jun
Awaiting requested review from lidge-jun
lidge-jun is a code owner
Ingwannu
Awaiting requested review from Ingwannu
Ingwannu is a code owner
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
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.
|