fix: prune expired orphaned Action Scheduler logs#2891
Closed
chubes4 wants to merge 2 commits into
Closed
Conversation
This was referenced Jul 13, 2026
Member
Author
|
Follow-up scheduling defect filed as #2892: this recovery pass is bounded and ready to run, but the observed retention recurrence has no pending replacement after cancellation. |
This reverts commit 8bfc4bf.
Member
Author
|
Closing without merge. A follow-up lock-respecting LEFT JOIN check found 0 orphan logs; the retention diagnosis in this PR was incorrect. The actionable recurrence failure is tracked in #2892. |
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
Action Scheduler custom tables have no foreign key between actions and logs. When another cleanup removes an action, Data Machine retention previously joined only to surviving terminal actions and left expired orphan logs indefinitely.
This adds a bounded orphan-log pass to the existing Action Scheduler retention task. It deletes only logs that are older than the configured global retention window, have a nonzero
action_id, and no longer have a parent action. The pass shares the existing batch, iteration, and runtime caps. Dry-run counts and cleanup results now include these orphan logs.Related upstream defect: woocommerce/action-scheduler#1347
Related retention investigation: #2792
How to test
php tests/retention-action-scheduler-batching-smoke.php.expired orphan logs are removed while fresh orphan logs survive.php -l inc/Engine/AI/System/Tasks/Retention/RetentionCleanup.phpandphp -l tests/retention-action-scheduler-batching-smoke.php.AI assistance