Media: recurse TTL cleanup in nested subdirs#29211
Media: recurse TTL cleanup in nested subdirs#29211jink-ucla wants to merge 6 commits intoopenclaw:mainfrom
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f142a207b3
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Greptile SummaryImplemented recursive TTL cleanup for media files in nested subdirectories, fixing a bug where files beyond the first level weren't removed. The solution properly handles arbitrary nesting depth while preserving directory structure.
Confidence Score: 4/5
Last reviewed commit: 03e37ee |
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6315604710
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 75c287c9f3
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
@codex reivew |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9cbf73c27f
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| if (stat.isDirectory()) { | ||
| await removeExpiredFilesInDir(full); | ||
| await removeExpiredFilesRecursively(fullPath); |
There was a problem hiding this comment.
Skip symlinked top-level dirs before recursive cleanup
Using fs.stat on top-level media entries means symlinked directories are treated as real directories, and this new recursive call now walks the entire symlink target tree. In a setup like .openclaw/media/inbound -> /some/other/path, cleanOldMedia() can delete expired files outside the media store at arbitrary depth, which is a broader data-loss risk introduced by this recursion change; top-level entries should be lstated and symlink directories skipped.
Useful? React with 👍 / 👎.
|
Ready to merge. @vincentkoc could you merge this when you have a moment? |
|
Ready to merge. @Takhoffman @Lukavyi could any of you merge this when you have a moment? |
|
I'm not a maintainer....yet 😅 |
|
@vincentkoc @Takhoffman Bumping this as it's fully verified, all checks are passing, and it's marked as low-risk/XS. Would appreciate the merge when you have a second so I can clear these from my queue. |
|
Folding this into #38292 so the media retention fix lands as one reviewable path. That branch keeps the recursive cleanup coverage from here and combines it with the Keeping this linked for contributor credit because the nested-subdirectory cleanup work came from this PR. |
|
Resolved in #38292 |
Summary
cleanOldMedia()only deleted expired files in the media root and first-level subdirectories.Change Type
Scope
User-visible / Behavior Changes
Files Changed
src/media/store.tssrc/media/store.test.tsVerification
src/media/store.test.ts.pnpm checkformat stage passes; type-check currently fails on unrelated baseline error insrc/agents/pi-embedded-runner-extraparams.test.ts(TS2352).
spawn EPERM).Risks and Mitigations
mtime > ttland only removes files; directories are preserved.